diff options
author | drebs <drebs@leap.se> | 2014-03-17 17:45:49 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2014-03-18 14:57:59 -0300 |
commit | 8981ff7de49401fcc9c3031a386ae0402021a6e6 (patch) | |
tree | 0cd45d2ea99bd01695e7ff9bd521b1dd8ef3ec03 /src | |
parent | 7edfdaef3934aa77089c44b45b215e0d16128da7 (diff) |
Signal the UI in case the soledad token is invalid when syncing (#5191).
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/mail/decorators.py | 1 | ||||
-rw-r--r-- | src/leap/mail/imap/fetch.py | 13 |
2 files changed, 11 insertions, 3 deletions
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): """ |