From 07f96373082c917421d862746fda3c921bf38a10 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Wed, 17 May 2017 22:28:29 +0200 Subject: [refactor] define class only if we are importing pixelated --- src/leap/bitmask/mua/pixelizer.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/leap/bitmask/mua') diff --git a/src/leap/bitmask/mua/pixelizer.py b/src/leap/bitmask/mua/pixelizer.py index c2dd7144..b9ceac9e 100644 --- a/src/leap/bitmask/mua/pixelizer.py +++ b/src/leap/bitmask/mua/pixelizer.py @@ -51,6 +51,21 @@ try: from pixelated.resources.root_resource import RootResource import pixelated_www HAS_PIXELATED = True + + class _LeapMailStore(LeapMailStore): + + def __init__(self, soledad, account): + self.account = account + super(_LeapMailStore, self).__init__(soledad) + + # We should rewrite the LeapMailStore in the coming pixelated fork so + # that we reuse the account instance. + @defer.inlineCallbacks + def add_mail(self, mailbox_name, raw_msg): + inbox = yield self.account.get_collection_by_mailbox(mailbox_name) + yield inbox.add_msg(raw_msg, ('\\Recent',), notify_just_mdoc=False) + + except ImportError as exc: HAS_PIXELATED = False @@ -148,20 +163,6 @@ class NickNym(object): return self.keymanager.send_key() -class _LeapMailStore(LeapMailStore): - - def __init__(self, soledad, account): - self.account = account - super(_LeapMailStore, self).__init__(soledad) - - # We should rewrite the LeapMailStore in the coming pixelated fork so that - # we reuse the account instance. - @defer.inlineCallbacks - def add_mail(self, mailbox_name, raw_msg): - inbox = yield self.account.get_collection_by_mailbox(mailbox_name) - yield inbox.add_msg(raw_msg, ('\\Recent',), notify_just_mdoc=False) - - class LeapSessionAdapter(object): def __init__(self, userid, soledad, keymanager, account): -- cgit v1.2.3