summaryrefslogtreecommitdiff
path: root/mail/src
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-19 15:42:29 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-19 15:42:29 -0300
commit213b567752a4cff4edded8a1a9d7a26c1438523d (patch)
treeb4de1951fd106da1c99a4bfc727b5f6210c45076 /mail/src
parent8bff5f1a55f845a77effc23e07de51df4480605f (diff)
Signal unread email
Diffstat (limited to 'mail/src')
-rw-r--r--mail/src/leap/mail/imap/fetch.py3
-rw-r--r--mail/src/leap/mail/imap/server.py2
2 files changed, 5 insertions, 0 deletions
diff --git a/mail/src/leap/mail/imap/fetch.py b/mail/src/leap/mail/imap/fetch.py
index 267af381..12534b3c 100644
--- a/mail/src/leap/mail/imap/fetch.py
+++ b/mail/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/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py
index 51df86eb..4fd55205 100644
--- a/mail/src/leap/mail/imap/server.py
+++ b/mail/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__)