summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-02-08 22:42:36 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2012-02-08 22:42:36 +0000
commitee4f6a9c9e0c48e0e2890eab8d39c520dd32ef9e (patch)
treee6ca195746827e3f46447521eab7b2138a52af83
parentae74ff7dae97c255d4ccb4fa20042ec7f133d24a (diff)
flush after adding mails in Draft/SendCommand
-rw-r--r--alot/commands/envelope.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index 33cddfb8..f67f8f8f 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -91,10 +91,17 @@ class SaveCommand(Command):
return
mail = envelope.construct_mail()
- account.store_draft_mail(mail)
- ui.apply_command(commands.globals.BufferCloseCommand())
+ # store mail locally
+ path = account.store_draft_mail(mail)
ui.notify('draft saved successfully')
+ # add mail to index if maildir path available
+ if path is not None:
+ logging.debug('adding new mail to index')
+ ui.dbman.add_message(path, account.draft_tags)
+ ui.apply_command(globals.FlushCommand())
+ ui.apply_command(commands.globals.BufferCloseCommand())
+
@registerCommand(MODE, 'send')
class SendCommand(Command):
@@ -133,9 +140,13 @@ class SendCommand(Command):
envelope.sent_time = datetime.datetime.now()
ui.apply_command(commands.globals.BufferCloseCommand())
ui.notify('mail sent successfully')
- # add mail to index
- logging.debug('adding new mail to index')
- account.store_sent_mail(mail)
+ # store mail locally
+ path = account.store_sent_mail(mail)
+ # add mail to index if maildir path available
+ if path is not None:
+ logging.debug('adding new mail to index')
+ ui.dbman.add_message(path, account.sent_tags)
+ ui.apply_command(globals.FlushCommand())
def errb(failure):
ui.clear_notify([clearme])