diff options
author | Kali Kaneko <kali@leap.se> | 2013-08-20 17:45:32 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-08-20 17:45:32 +0200 |
commit | 09365062fbd9c7553efcc54a17d318edea148084 (patch) | |
tree | a4b24ee2f4e98038df91e0d99bc3538656938c86 /mail/src/leap | |
parent | 908bf38496f062dbd2da4884cdce0bcfc5e85101 (diff) | |
parent | 10afc88b72f186c64fd2d729b73fce254c693b2d (diff) |
Merge remote-tracking branch 'chiiph/bug/various_fixes' into develop
Diffstat (limited to 'mail/src/leap')
-rw-r--r-- | mail/src/leap/mail/imap/fetch.py | 5 | ||||
-rw-r--r-- | mail/src/leap/mail/imap/server.py | 8 | ||||
-rw-r--r-- | mail/src/leap/mail/imap/service/imap.py | 2 |
3 files changed, 11 insertions, 4 deletions
diff --git a/mail/src/leap/mail/imap/fetch.py b/mail/src/leap/mail/imap/fetch.py index 4eb90b4..3b15c6a 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,)) @@ -178,7 +181,7 @@ class LeapIncomingMail(object): logger.warning("Error while decrypting msg: %r" % (exc,)) decrdata = "" ok = False - leap_events.signal(IMAP_MSG_DECRYPTED, ok) + leap_events.signal(IMAP_MSG_DECRYPTED, "1" if ok else "0") # XXX TODO: defer this properly return self._process_decrypted(doc, decrdata) diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py index 51df86e..7890a76 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__) @@ -162,6 +164,7 @@ class SoledadBackedAccount(WithMsgFields, IndexedDB): TYPE_SUBS_IDX = 'by-type-and-subscribed' TYPE_MBOX_SEEN_IDX = 'by-type-and-mbox-and-seen' TYPE_MBOX_RECT_IDX = 'by-type-and-mbox-and-recent' + TYPE_MBOX_RECT_SEEN_IDX = 'by-type-and-mbox-and-recent-and-seen' KTYPE = WithMsgFields.TYPE_KEY MBOX_VAL = WithMsgFields.TYPE_MBOX_VAL @@ -178,6 +181,7 @@ class SoledadBackedAccount(WithMsgFields, IndexedDB): # messages TYPE_MBOX_SEEN_IDX: [KTYPE, MBOX_VAL, 'bool(seen)'], TYPE_MBOX_RECT_IDX: [KTYPE, MBOX_VAL, 'bool(recent)'], + TYPE_MBOX_RECT_SEEN_IDX: [KTYPE, MBOX_VAL, 'bool(recent)', 'bool(seen)'], } INBOX_NAME = "INBOX" @@ -989,8 +993,8 @@ class MessageCollection(WithMsgFields, IndexedDB): """ return (doc for doc in self._soledad.get_from_index( - SoledadBackedAccount.TYPE_MBOX_RECT_IDX, - self.TYPE_MESSAGE_VAL, self.mbox, '1')) + SoledadBackedAccount.TYPE_MBOX_RECT_SEEN_IDX, + self.TYPE_MESSAGE_VAL, self.mbox, '1', '0')) def get_unseen(self): """ diff --git a/mail/src/leap/mail/imap/service/imap.py b/mail/src/leap/mail/imap/service/imap.py index 380324c..6b2a61d 100644 --- a/mail/src/leap/mail/imap/service/imap.py +++ b/mail/src/leap/mail/imap/service/imap.py @@ -89,7 +89,7 @@ class LeapIMAPServer(imap4.IMAP4Server): def authenticateLogin(self, username, password): # all is allowed so far. use realm instead - leap_events.signal(IMAP_CLIENT_LOGIN, True) + leap_events.signal(IMAP_CLIENT_LOGIN, "1") return imap4.IAccount, self.theAccount, lambda: None |