summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-01-11 22:03:52 -0300
committerTomás Touceda <chiiph@leap.se>2014-01-11 22:03:52 -0300
commitd70911505e63402b26657c11a74cf7e15ecce381 (patch)
tree712a317ffac3275b6709b3c0457f1e87fd1aa13a /src
parent761ab0014553d6e742fb5cd19cdbea707f59d816 (diff)
parent241cde270f1ef37aa33332934869a58b143885d1 (diff)
Merge remote-tracking branch 'refs/remotes/kali/feature/offline-flag' into develop
Diffstat (limited to 'src')
-rw-r--r--src/leap/mail/imap/service/imap.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/leap/mail/imap/service/imap.py b/src/leap/mail/imap/service/imap.py
index dfd4862..c48e5c5 100644
--- a/src/leap/mail/imap/service/imap.py
+++ b/src/leap/mail/imap/service/imap.py
@@ -178,6 +178,7 @@ def run_service(*args, **kwargs):
check_period = kwargs.get('check_period', INCOMING_CHECK_PERIOD)
userid = kwargs.get('userid', None)
leap_check(userid is not None, "need an user id")
+ offline = kwargs.get('offline', False)
uuid = soledad._get_uuid()
factory = LeapIMAPFactory(uuid, userid, soledad)
@@ -187,12 +188,15 @@ def run_service(*args, **kwargs):
try:
tport = reactor.listenTCP(port, factory,
interface="localhost")
- fetcher = LeapIncomingMail(
- keymanager,
- soledad,
- factory.theAccount,
- check_period,
- userid)
+ if not offline:
+ fetcher = LeapIncomingMail(
+ keymanager,
+ soledad,
+ factory.theAccount,
+ check_period,
+ userid)
+ else:
+ fetcher = None
except CannotListenError:
logger.error("IMAP Service failed to start: "
"cannot listen in port %s" % (port,))
@@ -200,7 +204,7 @@ def run_service(*args, **kwargs):
logger.error("Error launching IMAP service: %r" % (exc,))
else:
# all good.
- fetcher.start_loop()
+ # (the caller has still to call fetcher.start_loop)
logger.debug("IMAP4 Server is RUNNING in port %s" % (port,))
leap_events.signal(IMAP_SERVICE_STARTED, str(port))
return fetcher, tport, factory