summaryrefslogtreecommitdiff
path: root/src/leap/mail/mailbox_indexer.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-01-20 13:48:21 -0400
committerKali Kaneko <kali@leap.se>2015-02-11 14:05:43 -0400
commit7542de6aeb370d647840a0b78b71f69c6fdacf8e (patch)
tree6eae92ea27ebaf4f8e2e0ee0e1d66ef8bf26ffcd /src/leap/mail/mailbox_indexer.py
parentc3f487002e33b4b4cb65a04f9c192c4e59ec4908 (diff)
imap: complete FETCH implementation
Diffstat (limited to 'src/leap/mail/mailbox_indexer.py')
-rw-r--r--src/leap/mail/mailbox_indexer.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/leap/mail/mailbox_indexer.py b/src/leap/mail/mailbox_indexer.py
index 22e57d4..43a1f60 100644
--- a/src/leap/mail/mailbox_indexer.py
+++ b/src/leap/mail/mailbox_indexer.py
@@ -305,12 +305,24 @@ class MailboxIndexer(object):
return 1
return uid + 1
+ d = self.get_last_uid(mailbox_id)
+ d.addCallback(increment)
+ return d
+
+ def get_last_uid(self, mailbox_id):
+ """
+ Get the highest UID for a given mailbox.
+ """
+ check_good_uuid(mailbox_id)
sql = ("SELECT MAX(rowid) FROM {preffix}{name} "
"LIMIT 1;").format(
preffix=self.table_preffix, name=sanitize(mailbox_id))
+ def getit(result):
+ return _maybe_first_query_item(result)
+
d = self._query(sql)
- d.addCallback(increment)
+ d.addCallback(getit)
return d
def all_uid_iter(self, mailbox_id):