diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2017-05-17 22:28:29 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-05-17 22:28:29 +0200 |
commit | 07f96373082c917421d862746fda3c921bf38a10 (patch) | |
tree | 49dbb3a5031f2a124ef31f255370b1534fd22214 /src/leap/bitmask/mua/pixelizer.py | |
parent | bf5e72973f40f56f741a1bfbf98042fa1541ff41 (diff) |
[refactor] define class only if we are importing pixelated
Diffstat (limited to 'src/leap/bitmask/mua/pixelizer.py')
-rw-r--r-- | src/leap/bitmask/mua/pixelizer.py | 29 |
1 files changed, 15 insertions, 14 deletions
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): |