summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-01-29 16:43:15 -0400
committerKali Kaneko <kali@leap.se>2014-01-30 14:56:10 -0400
commit65f9d0316e981f6ba6423ff8c73cbe94249b596c (patch)
tree8b58d58bcbf5d2d215ce1f34baeb4adb9975df28
parent59e84d9f5c3cb518db4e63a6e037078f6fd4179d (diff)
Fix indexing error that was rendering attachments unusable
Also, check for empty body-doc
-rw-r--r--mail/src/leap/mail/imap/messages.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mail/src/leap/mail/imap/messages.py b/mail/src/leap/mail/imap/messages.py
index 5770868..2ace103 100644
--- a/mail/src/leap/mail/imap/messages.py
+++ b/mail/src/leap/mail/imap/messages.py
@@ -301,7 +301,7 @@ class LeapMessage(fields, MailParser, MBoxParser):
fd = StringIO.StringIO()
if self._bdoc is not None:
bdoc_content = self._bdoc.content
- if bdoc_content is None:
+ if empty(bdoc_content):
logger.warning("No BDOC content found for message!!!")
return write_fd("")
@@ -906,9 +906,10 @@ class MessageCollection(WithMsgFields, IndexedDB, MailParser, MBoxParser):
hd[key] = parts_map[key]
del parts_map
- # The MessageContainer expects a dict, zero-indexed
+ # The MessageContainer expects a dict, one-indexed
# XXX review-me
- cdocs = dict(enumerate(walk.get_raw_docs(msg, parts)))
+ cdocs = dict(((key + 1, doc) for key, doc in
+ enumerate(walk.get_raw_docs(msg, parts))))
self.set_recent_flag(uid)
@@ -960,7 +961,6 @@ class MessageCollection(WithMsgFields, IndexedDB, MailParser, MBoxParser):
fields.RECENTFLAGS_KEY, []))
return self.__rflags
- @profile
def _set_recent_flags(self, value):
"""
Setter for the recent-flags set for this mailbox.