summaryrefslogtreecommitdiff
path: root/mail/src/leap
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2014-03-17 17:45:49 -0300
committerdrebs <drebs@leap.se>2014-03-18 14:57:59 -0300
commit7bc1c5803650e464ef0b02eee75bbbfbe33d8287 (patch)
tree86c4e82c0ffd315f6b01cda25bb36c9cbc3414b9 /mail/src/leap
parentae78916544e8520e1e1c70356a539625ab2b6955 (diff)
Signal the UI in case the soledad token is invalid when syncing (#5191).
Diffstat (limited to 'mail/src/leap')
-rw-r--r--mail/src/leap/mail/decorators.py1
-rw-r--r--mail/src/leap/mail/imap/fetch.py13
2 files changed, 11 insertions, 3 deletions
diff --git a/mail/src/leap/mail/decorators.py b/mail/src/leap/mail/decorators.py
index ae115f8f..5105de92 100644
--- a/mail/src/leap/mail/decorators.py
+++ b/mail/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/mail/src/leap/mail/imap/fetch.py b/mail/src/leap/mail/imap/fetch.py
index 6e12b3fa..5f951c3f 100644
--- a/mail/src/leap/mail/imap/fetch.py
+++ b/mail/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):
"""