diff frontends/src/primitivus/contact_list.py @ 2016:f09562b0704d

quick_frontend, primitivus: better notifications handling
author Goffi <goffi@goffi.org>
date Sun, 24 Jul 2016 17:56:14 +0200
parents 20fb71b656e3
children 7aa58b7a47e2
line wrap: on
line diff
--- a/frontends/src/primitivus/contact_list.py	Sun Jul 24 17:47:09 2016 +0200
+++ b/frontends/src/primitivus/contact_list.py	Sun Jul 24 17:56:14 2016 +0200
@@ -143,7 +143,7 @@
         self._emit('click', entity)
 
     def onNotification(self, entity, notif, profile):
-        notifs = self.host.getNotifs(C.ENTITY_ALL, profile=self.profile)
+        notifs = list(self.host.getNotifs(C.ENTITY_ALL, profile=self.profile))
         if notifs:
             self.title_dynamic = u"({})".format(len(notifs))
         else:
@@ -197,11 +197,10 @@
         else:
             entity_attr = 'default'
 
-        notifs = self.host.getNotifs(entity.bare, profile=self.profile)
+        notifs = list(self.host.getNotifs(entity, exact_jid=special, profile=self.profile))
         if notifs:
-            entity_attr = 'cl_notifs'
-            header = u'({}) '.format(len(notifs))
-            if self.host.getNotifs(entity.bare, C.NOTIFY_MENTION, profile=self.profile):
+            header = [('cl_notifs', u'({})'.format(len(notifs))), u' ']
+            if list(self.host.getNotifs(entity.bare, C.NOTIFY_MENTION, profile=self.profile)):
                 header = ('cl_mention', header)
         else:
             header = u''