summaryrefslogtreecommitdiff
path: root/mail/src
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-12-19 14:44:14 -0300
committerTomás Touceda <chiiph@leap.se>2013-12-19 14:44:14 -0300
commiteabff1070531efaf30899fb13f66710233e04dd0 (patch)
tree566ec6f8e94bd11184be80130aa4bea1204ec2b5 /mail/src
parent69a27183254c96c30c36000641f9460018178959 (diff)
parent54538e2f203b9d82ed2303b6a3ef8d1730517a7a (diff)
Merge remote-tracking branch 'refs/remotes/kali/bug/defer-unset-recent' into develop
Diffstat (limited to 'mail/src')
-rw-r--r--mail/src/leap/mail/imap/server.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py
index b79e6918..c79cf856 100644
--- a/mail/src/leap/mail/imap/server.py
+++ b/mail/src/leap/mail/imap/server.py
@@ -31,8 +31,10 @@ from zope.proxy import sameProxiedObjects
from twisted.mail import imap4
from twisted.internet import defer
+from twisted.internet.threads import deferToThread
from twisted.python import log
+
from leap.common import events as leap_events
from leap.common.events.events_pb2 import IMAP_UNREAD_MAIL
from leap.common.check import leap_assert, leap_assert_type
@@ -1648,7 +1650,8 @@ class SoledadMailbox(WithMsgFields):
print "fetch %s, no msg found!!!" % msg_id
if self.isWriteable():
- self._unset_recent_flag()
+ deferToThread(self._unset_recent_flag)
+
return tuple(result)
def _unset_recent_flag(self):
@@ -1668,6 +1671,7 @@ class SoledadMailbox(WithMsgFields):
session is the first session to be notified about a message,
then that message SHOULD be considered recent.
"""
+ log.msg('unsetting recent flags...')
for msg in (LeapMessage(doc) for doc in self.messages.recent_iter()):
newflags = msg.removeFlags((WithMsgFields.RECENT_FLAG,))
self._update(newflags)