diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2017-04-27 15:20:24 +0200 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2017-05-16 19:28:35 +0200 |
commit | c980cae46d101c0def23bf3398b65b2e0c614d2a (patch) | |
tree | 6e421dc1d1a65572ab621f564b281ed1ffe5a0f3 /src/leap/bitmask/mail/imap/mailbox.py | |
parent | 401bf8067bf6eb1fd27477550a6edc0ab08647e4 (diff) |
[bug] fix notification for incoming mail with several listeners registered
When setting the listeners in the IMAP Folder, we avoid setting more
than one listener for the same imap mailbox (because in some situations
we were registering way too many listeners).
this was making the pixelated inbox registering the notification and
therefore the imap mailbox not being registered.
this MR also refactors the way pixelated is initialized, so that it
avoid creating a second Account instance. In this way, we make sure that
the pixelated mua and the imap server share the same collections for a
given mailbox, and therefore any of the two is able to get a
notification whenever the other adds a message to the mailbox.
- Resolves: #8846, #8798
Diffstat (limited to 'src/leap/bitmask/mail/imap/mailbox.py')
-rw-r--r-- | src/leap/bitmask/mail/imap/mailbox.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/leap/bitmask/mail/imap/mailbox.py b/src/leap/bitmask/mail/imap/mailbox.py index f74910f9..9e74cfc9 100644 --- a/src/leap/bitmask/mail/imap/mailbox.py +++ b/src/leap/bitmask/mail/imap/mailbox.py @@ -64,14 +64,14 @@ def make_collection_listener(mailbox): def __init__(self, mbox): self.mbox = mbox - # See #8083, pixelated adaptor seems to be misusing this class. - self.mailbox_name = self.mbox.mbox_name + # See #8083, pixelated adaptor introduces conflicts in the usage + self.mailbox_name = self.mbox.mbox_name + 'IMAP' def __hash__(self): - return hash(self.mbox.mbox_name) + return hash(self.mailbox_name) def __eq__(self, other): - return self.mbox.mbox_name == other.mbox.mbox_name + return self.mailbox_name == other.mbox.mbox_name + 'IMAP' def notify_new(self): self.mbox.notify_new() @@ -397,8 +397,6 @@ class IMAPMailbox(object): :param args: ignored. """ - if not NOTIFY_NEW: - return def cbNotifyNew(result): exists, recent = result @@ -887,15 +885,8 @@ class IMAPMailbox(object): uid when the copy succeed. :rtype: Deferred """ - # A better place for this would be the COPY/APPEND dispatcher - # in server.py, but qtreactor hangs when I do that, so this seems - # to work fine for now. - # d.addCallback(lambda r: self.reactor.callLater(0, self.notify_new)) - # deferLater(self.reactor, 0, self._do_copy, message, d) - # return d - - d = self.collection.copy_msg(message.message, - self.collection.mbox_uuid) + d = self.collection.copy_msg( + message.message, self.collection.mbox_uuid) return d # convenience fun |