From 38d810d338ce671b6389cd47d665b87798bcd65c Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Fri, 31 Jul 2015 17:04:25 +0200 Subject: First steps migrating mail service to new data model. --- service/pixelated/adapter/services/mail_service.py | 6 +++--- service/pixelated/adapter/services/mailboxes.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'service/pixelated/adapter/services') diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index 23cbc5f7..708297b9 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -29,13 +29,13 @@ class MailService(object): @defer.inlineCallbacks def all_mails(self): - defer.returnValue((yield self.querier.all_mails())) + defer.returnValue((yield self.mail_store.all_mails())) @defer.inlineCallbacks def mails(self, query, window_size, page): mail_ids, total = self.search_engine.search(query, window_size, page) - mails = yield self.querier.mails(mail_ids) + mails = yield self.mail_store.get_mails(mail_ids) defer.returnValue((mails, total)) @@ -72,7 +72,7 @@ class MailService(object): @defer.inlineCallbacks def mail_exists(self, mail_id): - defer.returnValue(not(not((yield self.querier.get_header_by_chash(mail_id))))) + defer.returnValue(not (yield self.mail_store.get_mail(mail_id))) @defer.inlineCallbacks def send_mail(self, content_dict): diff --git a/service/pixelated/adapter/services/mailboxes.py b/service/pixelated/adapter/services/mailboxes.py index 80cc74fe..52c9c212 100644 --- a/service/pixelated/adapter/services/mailboxes.py +++ b/service/pixelated/adapter/services/mailboxes.py @@ -22,10 +22,11 @@ from twisted.mail.imap4 import MailboxCollision class Mailboxes(object): - def __init__(self, account, soledad_querier, search_engine): + def __init__(self, account, mail_store, soledad_querier, search_engine): self.account = account self.querier = soledad_querier self.search_engine = search_engine + self.mail_store = mail_store # for mailbox_name in account.mailboxes: # MailboxIndexerListener.listen(self.account, mailbox_name, soledad_querier) -- cgit v1.2.3