diff options
author | Kali Kaneko <kali@leap.se> | 2013-09-02 00:53:01 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-09-02 00:53:01 +0200 |
commit | 76b23ec92b4b426a3ddebc82561bc28c9b7b2913 (patch) | |
tree | 083e0bc2767e9ccb223ec1c32a056b8c922fa0f2 | |
parent | cd20f7077e95602777b8c6c2281e723b331ce6e4 (diff) |
Send UNREAD event to UI when flag changes.
Closes: #3662
-rw-r--r-- | mail/changes/bug_3662_signal_unread_when_flag_changes | 1 | ||||
-rw-r--r-- | mail/src/leap/mail/imap/server.py | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/mail/changes/bug_3662_signal_unread_when_flag_changes b/mail/changes/bug_3662_signal_unread_when_flag_changes new file mode 100644 index 00000000..216c2a9c --- /dev/null +++ b/mail/changes/bug_3662_signal_unread_when_flag_changes @@ -0,0 +1 @@ + o Signal unread to UI when flag in message change. Closes: #3662 diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py index cfcb3d6d..ae76833b 100644 --- a/mail/src/leap/mail/imap/server.py +++ b/mail/src/leap/mail/imap/server.py @@ -35,6 +35,8 @@ from twisted.python import log #import u1db +from leap.common import events as leap_events +from leap.common.events.events_pb2 import IMAP_UNREAD_MAIL from leap.common.check import leap_assert, leap_assert_type from leap.soledad.client import Soledad @@ -1405,6 +1407,13 @@ class SoledadMailbox(WithMsgFields): result.append((msg_id, msg)) return tuple(result) + def _signal_unread_to_ui(self): + """ + Sends unread event to ui. + """ + leap_events.signal( + IMAP_UNREAD_MAIL, str(self.getUnseenCount())) + def store(self, messages, flags, mode, uid): """ Sets the flags of one or more messages. @@ -1455,6 +1464,7 @@ class SoledadMailbox(WithMsgFields): self._update(msg.setFlags(flags)) result[msg_id] = msg.getFlags() + self._signal_unread_to_ui() return result def close(self): |