summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-02-17 11:08:37 -0400
committerKali Kaneko <kali@leap.se>2014-02-17 11:39:51 -0400
commitb89804979afe974ff574f710abda3b93c3a48903 (patch)
treed8b002d5e06a274b88fff0fbc9caca122795a95d
parenta59925867360660a464fef1705d6fc438491ce78 (diff)
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.
-rw-r--r--mail/src/leap/mail/imap/server.py28
1 files changed, 1 insertions, 27 deletions
diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py
index 7c097848..5da9bfd9 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.