diff frontends/src/quick_frontend/quick_app.py @ 1658:683b76c1145d

quick_frontend, primitivus: display the number of alerts for each contact and not only a symbol (*)
author souliane <souliane@mailoo.org>
date Tue, 24 Nov 2015 13:31:28 +0100
parents ad2ad28b8923
children d17772b0fe22
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py	Tue Nov 24 10:39:22 2015 +0100
+++ b/frontends/src/quick_frontend/quick_app.py	Tue Nov 24 13:31:28 2015 +0100
@@ -296,7 +296,7 @@
     @property
     def alerts_count(self):
         """Count the over whole alerts for all contact lists"""
-        return sum([len(clist._alerts) for clist in self.contact_lists.values()])
+        return sum([sum(clist._alerts.values()) for clist in self.contact_lists.values()])
 
     def registerSignal(self, function_name, handler=None, iface="core", with_profile=True):
         """Register a handler for a signal
@@ -510,13 +510,14 @@
         chat_widget.newMessage(from_jid, target, msg, type_, extra, profile)
 
         # ContactList alert
-        visible = False
-        for widget in self.visible_widgets:
-            if isinstance(widget, quick_chat.QuickChat) and widget.manageMessage(from_jid, type_):
-                visible = True
-                break
-        if not visible:
-            contact_list.setAlert(from_jid.bare if type_ == C.MESS_TYPE_GROUPCHAT else from_jid)
+        if not from_me:
+            visible = False
+            for widget in self.visible_widgets:
+                if isinstance(widget, quick_chat.QuickChat) and widget.manageMessage(from_jid, type_):
+                    visible = True
+                    break
+            if not visible:
+                contact_list.addAlert(from_jid.bare if type_ == C.MESS_TYPE_GROUPCHAT else from_jid)
 
     def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key=C.PROF_KEY_NONE):
         if callback is None: