summaryrefslogtreecommitdiff
path: root/alot/command.py
diff options
context:
space:
mode:
authorpazz <patricktotzke@gmail.com>2011-07-31 11:16:36 +0100
committerpazz <patricktotzke@gmail.com>2011-07-31 11:16:36 +0100
commit506a3ce7d782a177b9946235555f877cbd915e74 (patch)
treeb3de7a8431636d0c15663b2a4a0a5ce51acb66d4 /alot/command.py
parent0b9f1ac237fa1c6f64cb2932b13a13dde2708de0 (diff)
attach mode forwarding doesnt copy body content
Diffstat (limited to 'alot/command.py')
-rw-r--r--alot/command.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/alot/command.py b/alot/command.py
index 1c7e9eaa..17edadc3 100644
--- a/alot/command.py
+++ b/alot/command.py
@@ -535,25 +535,30 @@ class ReplyCommand(Command):
class ForwardCommand(Command):
- def __init__(self, attach_original=False, **kwargs):
- self.attach_original = attach_original
+ def __init__(self, inline=False, **kwargs):
+ self.inline = inline
Command.__init__(self, **kwargs)
def apply(self, ui):
msg = ui.current_buffer.get_selected_message()
mail = msg.get_email()
- # set body text
- mailcontent = '\nForwarded message from %s:\n' % msg.get_author()[0]
- for line in msg.accumulate_body().splitlines():
- mailcontent += '>' + line + '\n'
- Charset.add_charset('utf-8', Charset.QP, Charset.QP, 'utf-8')
- bodypart = MIMEText(mailcontent.encode('utf-8'), 'plain', 'UTF-8')
reply = MIMEMultipart()
- reply.attach(bodypart)
-
- # attach original msg
- if self.attach_original:
+ Charset.add_charset('utf-8', Charset.QP, Charset.QP, 'utf-8')
+ if self.inline: # inline mode
+ # set body text
+ mailcontent = '\nForwarded message from %s:\n' % msg.get_author()[0]
+ for line in msg.accumulate_body().splitlines():
+ mailcontent += '>' + line + '\n'
+
+ bodypart = MIMEText(mailcontent.encode('utf-8'), 'plain', 'UTF-8')
+ reply.attach(bodypart)
+
+ else: # attach original mode
+ # create empty text msg
+ bodypart = MIMEText('', 'plain', 'UTF-8')
+ reply.attach(bodypart)
+ # attach original msg
reply.attach(mail)
# copy subject
@@ -746,7 +751,7 @@ COMMANDS = {
# thread
'reply': (ReplyCommand, {}),
'groupreply': (ReplyCommand, {'groupreply': True}),
- 'forward': (ForwardCommand, {'attach_original': True}),
+ 'forward': (ForwardCommand, {}),
'bounce': (BounceMailCommand, {}),
# taglist
@@ -834,8 +839,6 @@ def interpret_commandline(cmdline, mode):
logging.debug('not allowed in mode %s: %s' % (mode, cmd))
return None
- # use optionparser here.
- # forward to?
if not params: # commands that work without parameter
if cmd in ['exit', 'flush', 'pyshell', 'taglist', 'close', 'compose',
'openfocussed', 'closefocussed', 'bnext', 'bprevious',