summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/mail
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-12-08 18:10:13 +0100
committerKali Kaneko <kali@leap.se>2017-12-20 15:27:06 +0100
commitd2e5f8406b6101971c196f40e39322e36d6bdb33 (patch)
treecfe3fb852f80effd52b7a75688cd2a5118fe9a1f /src/leap/bitmask/mail
parentd5bd7394344afd2c6466f368a0de7566094a0d0d (diff)
[feat] Add msg_status call to the mail API
To get the status of a single message providing it's mailbox and message-id. For now it only returns encryption/signature status. - Resolves: #6914
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