summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/messages.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-01-16 17:18:11 -0400
committerKali Kaneko <kali@leap.se>2014-01-16 17:18:11 -0400
commitae56191d2d6f2953bd49f43b9dedb322a7f0db8c (patch)
tree2cff3711577d3e98cbfe1098b811f60e66d0fa58 /src/leap/mail/imap/messages.py
parent61454c82de35778d27bcd1a2c89fe20ee3d5b142 (diff)
reset last uid on expunge
Diffstat (limited to 'src/leap/mail/imap/messages.py')
-rw-r--r--src/leap/mail/imap/messages.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/leap/mail/imap/messages.py b/src/leap/mail/imap/messages.py
index 22de356..02df38e 100644
--- a/src/leap/mail/imap/messages.py
+++ b/src/leap/mail/imap/messages.py
@@ -1337,6 +1337,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.