summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/server.py
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
commit985ff0a78a8df0eafb7789383f711b9e5ceb1cb6 (patch)
tree0924be918d990628e73eb2059fb6eb1200748b7c /src/leap/mail/imap/server.py
parent2f114c5a85775f4044aa12cd421231ed92544549 (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.
Diffstat (limited to 'src/leap/mail/imap/server.py')
-rw-r--r--src/leap/mail/imap/server.py28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/leap/mail/imap/server.py b/src/leap/mail/imap/server.py
index 7c09784..5da9bfd 100644
--- a/src/leap/mail/imap/server.py
+++ b/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.