From b89804979afe974ff574f710abda3b93c3a48903 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 17 Feb 2014 11:08:37 -0400 Subject: Remove notify_new callbacks from fetch and copy. This fixes a bug with qtreactor that was making the 'OK foo copied' not being delivered. This or something similar will probably have to be re-added, because on the current state the destination folder will not receive the notification if it's selected *before* the copy operation has finished. But in this way we have a clean slate that is working properly. The bottleneck in the copy/append operations seems to have moved to the select operation now. --- mail/src/leap/mail/imap/server.py | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'mail') diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py index 7c09784..5da9bfd 100644 --- a/mail/src/leap/mail/imap/server.py +++ b/mail/src/leap/mail/imap/server.py @@ -20,9 +20,7 @@ Leap IMAP4 Server Implementation. from copy import copy from twisted import cred -from twisted.internet import defer from twisted.internet.defer import maybeDeferred -from twisted.internet.task import deferLater from twisted.mail import imap4 from twisted.python import log @@ -135,35 +133,11 @@ class LeapIMAPServer(imap4.IMAP4Server): ).addCallback( cbFetch, tag, query, uid ).addErrback( - ebFetch, tag - ).addCallback( - self.on_fetch_finished, messages) + ebFetch, tag) select_FETCH = (do_FETCH, imap4.IMAP4Server.arg_seqset, imap4.IMAP4Server.arg_fetchatt) - def on_fetch_finished(self, _, messages): - deferLater(self.reactor, 0, self.notifyNew) - deferLater(self.reactor, 0, self.mbox.unset_recent_flags, messages) - deferLater(self.reactor, 0, self.mbox.signal_unread_to_ui) - - def on_copy_finished(self, defers): - d = defer.gatherResults(filter(None, defers)) - - def when_finished(result): - self.notifyNew() - self.mbox.signal_unread_to_ui() - d.addCallback(when_finished) - - def do_COPY(self, tag, messages, mailbox, uid=0): - defers = [] - d = imap4.IMAP4Server.do_COPY(self, tag, messages, mailbox, uid) - defers.append(d) - deferLater(self.reactor, 0, self.on_copy_finished, defers) - - select_COPY = (do_COPY, imap4.IMAP4Server.arg_seqset, - imap4.IMAP4Server.arg_astring) - def notifyNew(self, ignored=None): """ Notify new messages to listeners. -- cgit v1.2.3