summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-03-18 15:11:30 -0300
committerTomás Touceda <chiiph@leap.se>2014-03-18 15:11:30 -0300
commit95709184a3a1f9b99e491579d0dcd21cd3a13c08 (patch)
tree0cd45d2ea99bd01695e7ff9bd521b1dd8ef3ec03
parent7edfdaef3934aa77089c44b45b215e0d16128da7 (diff)
parent8981ff7de49401fcc9c3031a386ae0402021a6e6 (diff)
Merge remote-tracking branch 'refs/remotes/drebs/feature/5191_signal-invalid-auth-token' into develop
-rw-r--r--changes/feature_5191_signal-invalid-auth-token1
-rw-r--r--src/leap/mail/decorators.py1
-rw-r--r--src/leap/mail/imap/fetch.py13
3 files changed, 12 insertions, 3 deletions
diff --git a/changes/feature_5191_signal-invalid-auth-token b/changes/feature_5191_signal-invalid-auth-token
new file mode 100644
index 0000000..f833a3e
--- /dev/null
+++ b/changes/feature_5191_signal-invalid-auth-token
@@ -0,0 +1 @@
+ o Signal the client when auth token is invalid for syncing Soledad (#5191).
diff --git a/src/leap/mail/decorators.py b/src/leap/mail/decorators.py
index ae115f8..5105de9 100644
--- a/src/leap/mail/decorators.py
+++ b/src/leap/mail/decorators.py
@@ -24,6 +24,7 @@ from functools import wraps
from twisted.internet.threads import deferToThread
+
logger = logging.getLogger(__name__)
diff --git a/src/leap/mail/imap/fetch.py b/src/leap/mail/imap/fetch.py
index 6e12b3f..5f951c3 100644
--- a/src/leap/mail/imap/fetch.py
+++ b/src/leap/mail/imap/fetch.py
@@ -45,6 +45,7 @@ from leap.common.events.events_pb2 import IMAP_MSG_DECRYPTED
from leap.common.events.events_pb2 import IMAP_MSG_SAVED_LOCALLY
from leap.common.events.events_pb2 import IMAP_MSG_DELETED_INCOMING
from leap.common.events.events_pb2 import IMAP_UNREAD_MAIL
+from leap.common.events.events_pb2 import SOLEDAD_INVALID_AUTH_TOKEN
from leap.common.mail import get_email_charset
from leap.keymanager import errors as keymanager_errors
from leap.keymanager.openpgp import OpenPGPKey
@@ -53,6 +54,7 @@ from leap.mail.imap.fields import fields
from leap.mail.utils import json_loads, empty, first
from leap.soledad.client import Soledad
from leap.soledad.common.crypto import ENC_SCHEME_KEY, ENC_JSON_KEY
+from leap.soledad.common.errors import InvalidAuthTokenError
logger = logging.getLogger(__name__)
@@ -218,9 +220,14 @@ class LeapIncomingMail(object):
:rtype: iterable or None
"""
with self.fetching_lock:
- log.msg('FETCH: syncing soledad...')
- self._soledad.sync()
- log.msg('FETCH soledad SYNCED.')
+ try:
+ log.msg('FETCH: syncing soledad...')
+ self._soledad.sync()
+ log.msg('FETCH soledad SYNCED.')
+ except InvalidAuthTokenError:
+ # if the token is invalid, send an event so the GUI can
+ # disable mail and show an error message.
+ leap_events.signal(SOLEDAD_INVALID_AUTH_TOKEN)
def _signal_fetch_to_ui(self, doclist):
"""