From c980cae46d101c0def23bf3398b65b2e0c614d2a Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Thu, 27 Apr 2017 15:20:24 +0200 Subject: [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 --- src/leap/bitmask/mail/imap/mailbox.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/leap/bitmask/mail/imap/mailbox.py') 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 -- cgit v1.2.3