summaryrefslogtreecommitdiff
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
commit2bbf74071ea8d48d2daafb4c2f9a75b671bca77f (patch)
tree087b4baffad8facca772080674903156fe3e7bb6
parent43de35a50d17a764b2746998d81d7957629a5ff7 (diff)
parent04122fd0e1eacdcf4adb1815af53bdface04ffb5 (diff)
Merge remote-tracking branch 'refs/remotes/kali/feature/offline-flag' into develop
-rw-r--r--mail/changes/feature_4943-offline-flag1
-rw-r--r--mail/src/leap/mail/imap/service/imap.py18
2 files changed, 12 insertions, 7 deletions
diff --git a/mail/changes/feature_4943-offline-flag b/mail/changes/feature_4943-offline-flag
new file mode 100644
index 00000000..6edfd4d8
--- /dev/null
+++ b/mail/changes/feature_4943-offline-flag
@@ -0,0 +1 @@
+ o Add a flag for offline mode in imap. Related to #4943
diff --git a/mail/src/leap/mail/imap/service/imap.py b/mail/src/leap/mail/imap/service/imap.py
index dfd48624..c48e5c56 100644
--- a/mail/src/leap/mail/imap/service/imap.py
+++ b/mail/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