summaryrefslogtreecommitdiff
path: root/alot/commands/envelope.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-12-17 19:11:55 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2011-12-17 19:11:55 +0000
commit9537fa42835da7de8a944460d457e5ab8baaad6d (patch)
treedd01f0b9fe1ca169fdb68d6b21ec985cbb6b50d5 /alot/commands/envelope.py
parent76bb01bcc9f21f643933e40dc4f4de4d0136247e (diff)
parent81ff09caa17012d33364cbca2c7cc03413ae635e (diff)
Merge branch 'issue-159-bclose' into testing
Diffstat (limited to 'alot/commands/envelope.py')
-rw-r--r--alot/commands/envelope.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index 196eff24..31b0f201 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -5,8 +5,10 @@ import email
import tempfile
from twisted.internet.defer import inlineCallbacks
import threading
+import datetime
from alot import buffers
+from alot import commands
from alot.commands import Command, registerCommand
from alot import settings
from alot import helper
@@ -32,7 +34,7 @@ class AttachCommand(Command):
def apply(self, ui):
envelope = ui.current_buffer.envelope
- if self.path:
+ if self.path: # TODO: not possible, otherwise argparse error before
files = filter(os.path.isfile,
glob.glob(os.path.expanduser(self.path)))
if not files:
@@ -73,6 +75,13 @@ class SendCommand(Command):
def apply(self, ui):
currentbuffer = ui.current_buffer # needed to close later
envelope = currentbuffer.envelope
+ if envelope.sent_time:
+ warning = 'A modified version of ' * envelope.modified_since_sent
+ warning += 'this message has been sent at %s.' % envelope.sent_time
+ warning += ' Do you want to resend?'
+ if (yield ui.choice(warning, cancel='no',
+ msg_position='left')) == 'no':
+ return
frm = envelope.get('From')
sname, saddr = email.Utils.parseaddr(frm)
omit_signature = False
@@ -108,7 +117,8 @@ class SendCommand(Command):
def afterwards(returnvalue):
ui.clear_notify([clearme])
if returnvalue == 'success': # sucessfully send mail
- ui.buffer_close(currentbuffer)
+ envelope.sent_time = datetime.datetime.now()
+ ui.apply_command(commands.globals.BufferCloseCommand())
ui.notify('mail send successful')
else:
ui.notify('failed to send: %s' % returnvalue,