diff options
author | drebs <drebs@riseup.net> | 2016-09-27 20:44:53 -0300 |
---|---|---|
committer | drebs <drebs@riseup.net> | 2016-09-30 13:10:14 -0300 |
commit | 9c4bf6adf42f0f9553ae11f24ffeb6f7cf39f374 (patch) | |
tree | c03b13ae17c0e6267ba8f3ba47c470aed7ad24d4 /src/leap/bitmask/mail/incoming/service.py | |
parent | 10f35cacf50148c34b11fba719fc8f734f99def1 (diff) |
[refactor] turn mail services into twisted services
Diffstat (limited to 'src/leap/bitmask/mail/incoming/service.py')
-rw-r--r-- | src/leap/bitmask/mail/incoming/service.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/leap/bitmask/mail/incoming/service.py b/src/leap/bitmask/mail/incoming/service.py index 05f9bb5..b4cdfcf 100644 --- a/src/leap/bitmask/mail/incoming/service.py +++ b/src/leap/bitmask/mail/incoming/service.py @@ -29,12 +29,15 @@ from StringIO import StringIO from urlparse import urlparse from twisted.application.service import Service +from twisted.application.service import IService from twisted.logger import Logger from twisted.python.failure import Failure from twisted.internet import defer, reactor from twisted.internet.task import LoopingCall from twisted.internet.task import deferLater +from zope.interface import implements + from leap.common.events import emit_async, catalog from leap.common.check import leap_assert, leap_assert_type from leap.common.mail import get_email_charset @@ -47,7 +50,7 @@ from leap.soledad.common.crypto import ENC_SCHEME_KEY, ENC_JSON_KEY from leap.soledad.common.errors import InvalidAuthTokenError -logger = Logger() +logger = Logger(__name__) MULTIPART_ENCRYPTED = "multipart/encrypted" MULTIPART_SIGNED = "multipart/signed" @@ -79,7 +82,8 @@ class IncomingMail(Service): This loop will sync the soledad db with the remote server and process all the documents found tagged as incoming mail. """ - # TODO implements IService? + + implements(IService) name = "IncomingMail" @@ -227,7 +231,7 @@ class IncomingMail(Service): def _signal_invalid_auth(failure): failure.trap(InvalidAuthTokenError) - logger.info('sync failed: %r' % failure) + logger.warn('sync failed because token has expired: %r' % failure) # if the token is invalid, send an event so the GUI can # disable mail and show an error message. emit_async(catalog.SOLEDAD_INVALID_AUTH_TOKEN, self._userid) |