summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/mail
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask/mail')
-rw-r--r--src/leap/bitmask/mail/mail.py15
-rw-r--r--src/leap/bitmask/mail/utils.py5
2 files changed, 20 insertions, 0 deletions
diff --git a/src/leap/bitmask/mail/mail.py b/src/leap/bitmask/mail/mail.py
index 9a7b1aed..53b34132 100644
--- a/src/leap/bitmask/mail/mail.py
+++ b/src/leap/bitmask/mail/mail.py
@@ -1038,6 +1038,21 @@ class Account(object):
"""
raise NotImplementedError()
+ def get_message_by_msgid(self, mbox, msgid):
+ """
+ :rtype: Message
+ """
+ def get_msg_from_mdoc(mdoc_id):
+ if not mdoc_id:
+ return None
+
+ return self.adaptor.get_msg_from_mdoc_id(
+ Message, self.store, mdoc_id)
+
+ d = self.adaptor.get_mdoc_id_from_msgid(self.store, mbox, msgid)
+ d.addCallback(get_msg_from_mdoc)
+ return d
+
# Session handling
def end_session(self):
diff --git a/src/leap/bitmask/mail/utils.py b/src/leap/bitmask/mail/utils.py
index 64fca981..d5128573 100644
--- a/src/leap/bitmask/mail/utils.py
+++ b/src/leap/bitmask/mail/utils.py
@@ -373,3 +373,8 @@ class CaseInsensitiveDict(dict):
def __getitem__(self, key):
return super(CaseInsensitiveDict, self).__getitem__(key.lower())
+
+ def get(self, key, default=None):
+ if key.lower() in self:
+ return self[key]
+ return default