summaryrefslogtreecommitdiff
path: root/alot/commands.py
diff options
context:
space:
mode:
authorpazz <patricktotzke@gmail.com>2011-07-19 21:29:25 +0100
committerpazz <patricktotzke@gmail.com>2011-07-19 21:29:25 +0100
commit5a430ba8abe293907ac8f4c68beade4c1eb6f31a (patch)
tree48f1e0f30371c710fbff529c2c94fcb5f4b77e38 /alot/commands.py
parentda2f14c96b7c98ec38f2b59dadb135145f608cbd (diff)
re-edit mail in envolope
Diffstat (limited to 'alot/commands.py')
-rw-r--r--alot/commands.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/alot/commands.py b/alot/commands.py
index 2b230d15..b4e5d6b7 100644
--- a/alot/commands.py
+++ b/alot/commands.py
@@ -77,7 +77,6 @@ class OpenThreadCommand(Command):
self.thread.refresh()
-
class SearchCommand(Command):
"""open a new search buffer"""
def __init__(self, query, force_new=False, **kwargs):
@@ -492,3 +491,26 @@ class RefinePromptCommand(Command):
sbuffer = ui.current_buffer
oldquery = sbuffer.querystring
ui.commandprompt('refine ' + oldquery)
+
+
+class EnvelopeReeditCommand(Command):
+ """re-edits mail in from envelope buffer"""
+ def apply(self, ui):
+ in_mail = ui.current_buffer.get_email()
+
+ def readTmpfile():
+ f = open(tf.name)
+ editor_input = f.read()
+ out_mail = Parser().parsestr(editor_input)
+ f.close()
+ os.unlink(tf.name)
+ # TODO: attachments?
+ ui.current_buffer.set_email(out_mail)
+
+ tf = tempfile.NamedTemporaryFile(delete=False)
+ tf.write(in_mail.as_string())
+ tf.close()
+ ui.apply_command(EditCommand(tf.name,
+ on_success=readTmpfile,
+ refocus=False))
+