diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-05 09:27:35 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:31 +0200 |
commit | 579dab68cc73cd8e52b8f6feaa02a51b361c59bb (patch) | |
tree | 04d3ecc520f1cbf0a64deba47837266dc39b84fd /service/pixelated | |
parent | 59a052ca38972cf05e057a1c7bbd54fbb8046325 (diff) |
Implemented get_mailbox_names in MailStore.
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/mailstore/leap_mailstore.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py index 7bcd8a6a..60068322 100644 --- a/service/pixelated/adapter/mailstore/leap_mailstore.py +++ b/service/pixelated/adapter/mailstore/leap_mailstore.py @@ -93,6 +93,21 @@ class LeapMailStore(MailStore): defer.returnValue(mailbox) @defer.inlineCallbacks + def get_mailbox_names(self): + mbox_map = set((yield self._mailbox_uuid_to_name()).values()) + + defer.returnValue(mbox_map.union({'INBOX'})) + + @defer.inlineCallbacks + def _mailbox_uuid_to_name(self): + map = {} + mbox_docs = yield self.soledad.get_from_index('by-type', 'mbox') + for doc in mbox_docs: + map[doc.doc_id] = doc.content.get('mbox') + + defer.returnValue(map) + + @defer.inlineCallbacks def add_mail(self, mailbox_name, raw_msg): mailbox = yield self._get_or_create_mailbox(mailbox_name) message = SoledadMailAdaptor().get_msg_from_string(Message, raw_msg) |