From ad113e53d59213a5accc4f71564fd6ad0f73f74f Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 26 Jan 2015 23:41:52 -0400 Subject: save drafts: search by msg-id --- src/leap/mail/mail.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/leap/mail/mail.py') diff --git a/src/leap/mail/mail.py b/src/leap/mail/mail.py index d986f59..2766524 100644 --- a/src/leap/mail/mail.py +++ b/src/leap/mail/mail.py @@ -460,6 +460,25 @@ class MessageCollection(object): """ return self.mbox_indexer.all_uid_iter(self.mbox_uuid) + def get_uid_from_msgid(self, msgid): + """ + Return the UID(s) of the matching msg-ids for this mailbox collection. + """ + if not self.is_mailbox_collection(): + raise NotImplementedError() + + def get_uid(mdoc_id): + if not mdoc_id: + return None + d = self.mbox_indexer.get_uid_from_doc_id( + self.mbox_uuid, mdoc_id) + return d + + d = self.adaptor.get_mdoc_id_from_msgid( + self.store, self.mbox_uuid, msgid) + d.addCallback(get_uid) + return d + # Manipulate messages def add_msg(self, raw_msg, flags=tuple(), tags=tuple(), date=""): -- cgit v1.2.3