summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/services/mail/imapcontroller.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/leap/bitmask/services/mail/imapcontroller.py b/src/leap/bitmask/services/mail/imapcontroller.py
index e5313477..5053d897 100644
--- a/src/leap/bitmask/services/mail/imapcontroller.py
+++ b/src/leap/bitmask/services/mail/imapcontroller.py
@@ -27,6 +27,7 @@ class IMAPController(object):
"""
IMAP Controller.
"""
+
def __init__(self, soledad, keymanager):
"""
Initialize IMAP variables.
@@ -63,12 +64,11 @@ class IMAPController(object):
self._soledad,
userid=userid)
- def start_incoming_service(incoming_mail):
- d = incoming_mail.startService()
- d.addCallback(lambda started: incoming_mail)
- return d
-
- def assign_incoming_service(incoming_mail):
+ def start_and_assign_incoming_service(incoming_mail):
+ # this returns a deferred that will be called when the looping call
+ # is stopped, we could add any shutdown/cleanup callback to that
+ # deferred, but unused by the moment.
+ incoming_mail.startService()
self.incoming_mail_service = incoming_mail
return incoming_mail
@@ -78,8 +78,7 @@ class IMAPController(object):
self._soledad,
self.imap_factory,
userid)
- d.addCallback(start_incoming_service)
- d.addCallback(assign_incoming_service)
+ d.addCallback(start_and_assign_incoming_service)
d.addErrback(lambda f: logger.error(f.printTraceback()))
def stop_imap_service(self):