From bbab478d267a412f300430e2cd70f31df27b8d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Mon, 19 Aug 2013 15:42:29 -0300 Subject: Signal unread email --- src/leap/mail/imap/fetch.py | 3 +++ src/leap/mail/imap/server.py | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src/leap') diff --git a/src/leap/mail/imap/fetch.py b/src/leap/mail/imap/fetch.py index 267af38..12534b3 100644 --- a/src/leap/mail/imap/fetch.py +++ b/src/leap/mail/imap/fetch.py @@ -36,6 +36,7 @@ from leap.common.events.events_pb2 import IMAP_MSG_PROCESSING 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 logger = logging.getLogger(__name__) @@ -134,6 +135,8 @@ class LeapIncomingMail(object): log.msg("there are %s mails" % (num_mails,)) leap_events.signal( IMAP_FETCHED_INCOMING, str(num_mails), str(fetched_ts)) + leap_events.signal( + IMAP_UNREAD_MAIL, str(self._inbox.getUnseenCount())) return doclist except ssl.SSLError as exc: logger.warning('SSL Error while syncing soledad: %r' % (exc,)) diff --git a/src/leap/mail/imap/server.py b/src/leap/mail/imap/server.py index 51df86e..4fd5520 100644 --- a/src/leap/mail/imap/server.py +++ b/src/leap/mail/imap/server.py @@ -38,6 +38,8 @@ from twisted.python import log from leap.common.check import leap_assert, leap_assert_type from leap.soledad import Soledad from leap.soledad.sqlcipher import SQLCipherDatabase +from leap.common.events import signal +from leap.common.events import events_pb2 as proto logger = logging.getLogger(__name__) -- cgit v1.2.3