diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-26 23:42:27 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-26 23:42:27 +0000 |
commit | 7309b8cdf450af36de5d2734c160a96f8e571a2d (patch) | |
tree | 70bf53356a21b737f8b09dbeb774b56bc69839d1 /alot/account.py | |
parent | e7f7460cc92524c56bce12cf3ef55b434e3eae9b (diff) |
fix account.store_mail
this fixes an unsuccessful previous merge
Diffstat (limited to 'alot/account.py')
-rw-r--r-- | alot/account.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/alot/account.py b/alot/account.py index d1b2246d..c130fcd8 100644 --- a/alot/account.py +++ b/alot/account.py @@ -101,21 +101,22 @@ class Account(object): if not isinstance(mbx, mailbox.Mailbox): logging.debug('Not a mailbox') return False + + mbx.lock() + if isinstance(mbx, mailbox.Maildir): + logging.debug('Maildir') + msg = mailbox.MaildirMessage(mail) + msg.set_flags('S') else: - mbx.lock() - if isinstance(mbx, mailbox.Maildir): - logging.debug('Maildir') - msg = mailbox.MaildirMessage(mail) - msg.set_flags('S') - else: - logging.debug('no Maildir') - msg = mailbox.Message(mail) - id = mbx.add(msg) - mbx.flush() - mbx.unlock() - logging.debug('got id : %s' % id) - return True + logging.debug('no Maildir') + msg = mailbox.Message(mail) + + message_id = mbx.add(msg) + mbx.flush() + mbx.unlock() + logging.debug('got id : %s' % id) + # add new Maildir message to index and add tags if isinstance(mbx, mailbox.Maildir) and tags != None: # this is a dirty hack to get the path to the newly added file # I wish the mailbox module were more helpful... @@ -124,6 +125,7 @@ class Account(object): message = self.dbman.add_message(path) message.add_tags(tags) self.dbman.flush() + return True def store_sent_mail(self, mail): """ |