summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/messages.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-01-16 18:55:22 -0300
committerTomás Touceda <chiiph@leap.se>2014-01-16 18:55:22 -0300
commite3692d50ca2fa4110ba37322b1f46d71d93ac135 (patch)
tree951497ce242b3ad165764c295fcd80fe4b253b82 /src/leap/mail/imap/messages.py
parent06eebf54ab572ebaf6730f2095a062cd9549f12e (diff)
parent6c7207a5667d8158572b2a900a3506e3c3ecc6e5 (diff)
Merge remote-tracking branch 'refs/remotes/kali/bug/fix-store-iteration' into develop
Diffstat (limited to 'src/leap/mail/imap/messages.py')
-rw-r--r--src/leap/mail/imap/messages.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/leap/mail/imap/messages.py b/src/leap/mail/imap/messages.py
index 22de356..1b996b6 100644
--- a/src/leap/mail/imap/messages.py
+++ b/src/leap/mail/imap/messages.py
@@ -467,7 +467,8 @@ class LeapMessage(fields, MailParser, MBoxParser):
:rtype: C{str}
:return: An RFC822-formatted date string.
"""
- return str(self._hdoc.content.get(self.DATE_KEY, ''))
+ date = self._hdoc.content.get(self.DATE_KEY, '')
+ return str(date)
#
# IMessagePart
@@ -1077,12 +1078,12 @@ class MessageCollection(WithMsgFields, IndexedDB, MailParser, MBoxParser,
hd[self.MSGID_KEY] = msgid
if not subject and self.SUBJECT_FIELD in headers:
- hd[self.SUBJECT_KEY] = first(headers[self.SUBJECT_FIELD])
+ hd[self.SUBJECT_KEY] = headers[self.SUBJECT_FIELD]
else:
hd[self.SUBJECT_KEY] = subject
if not date and self.DATE_FIELD in headers:
- hd[self.DATE_KEY] = first(headers[self.DATE_FIELD])
+ hd[self.DATE_KEY] = headers[self.DATE_FIELD]
else:
hd[self.DATE_KEY] = date
return hd
@@ -1337,6 +1338,18 @@ class MessageCollection(WithMsgFields, IndexedDB, MailParser, MBoxParser,
fields.TYPE_FLAGS_VAL, self.mbox))
return (u for u in sorted(all_uids))
+ def reset_last_uid(self, param):
+ """
+ Set the last uid to the highest uid found.
+ Used while expunging, passed as a callback.
+ """
+ try:
+ self.last_uid = max(self.all_uid_iter()) + 1
+ except ValueError:
+ # empty sequence
+ pass
+ return param
+
def all_flags(self):
"""
Return a dict with all flags documents for this mailbox.