diff options
author | Hamish Downer <hamish@foobacca.co.uk> | 2014-03-06 23:21:53 +0000 |
---|---|---|
committer | Christian Geier <geier@lostpackets.de> | 2017-01-02 18:49:18 +0100 |
commit | b5b915dcb22fe25130ed742f47e2beade4fab1d5 (patch) | |
tree | 374fd728b88cd1bfd84106b4ae73e71db4533323 | |
parent | f1631cf288cbcd2d513a93348e28cea41fd92913 (diff) |
On exit command, check if there are any unsent messages
-rw-r--r-- | alot/commands/globals.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 5090e653..4ce07a88 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -49,6 +49,15 @@ class ExitCommand(Command): msg_position='left')) == 'no': return + # check if there are any unsent messages + for buffer in ui.buffers: + if (isinstance(buffer, buffers.EnvelopeBuffer) and + not buffer.envelope.sent_time): + if (yield ui.choice('quit without sending message?', + select='yes', cancel='no', + msg_position='left')) == 'no': + raise CommandCanceled() + for b in ui.buffers: b.cleanup() ui.apply_command(FlushCommand(callback=ui.exit)) |