diff options
author | Kali Kaneko <kali@leap.se> | 2015-01-20 13:48:21 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-01-21 15:08:05 -0400 |
commit | 8c65f09a16e4e00452dffa7d72771d9fac21c9c0 (patch) | |
tree | 6eae92ea27ebaf4f8e2e0ee0e1d66ef8bf26ffcd /src/leap/mail/mailbox_indexer.py | |
parent | b8a2b00b379588de262ab30ccddba4e6d89e1a36 (diff) |
imap: complete FETCH implementation
Diffstat (limited to 'src/leap/mail/mailbox_indexer.py')
-rw-r--r-- | src/leap/mail/mailbox_indexer.py | 14 |
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): |