diff frontends/src/primitivus/chat.py @ 1393:50d5d6325f62

quick_frontend, primitivus: various fixes (MUC and cached signals): - actually call the cached signals, everything was there but the call was not done - display '[]' instead of '[None]' when group message coming from the room (no resource) - catch the exception when trying to delete an occupant who's not in the room - do not cache a "main resource" for MUC entities
author souliane <souliane@mailoo.org>
date Wed, 25 Mar 2015 15:25:51 +0100
parents 337be5318177
children 069ad98b360d
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Wed Mar 25 15:28:02 2015 +0100
+++ b/frontends/src/primitivus/chat.py	Wed Mar 25 15:25:51 2015 +0100
@@ -73,7 +73,7 @@
             if self.parent.show_short_nick:
                 render_txt.append(('my_nick' if self.my_mess else 'other_nick', "**" if self.my_mess else "*"))
             else:
-                render_txt.append(('my_nick' if self.my_mess else 'other_nick', "[%s] " % self.nick))
+                render_txt.append(('my_nick' if self.my_mess else 'other_nick', "[%s] " % (self.nick or '')))
         render_txt.append(self.message)
         txt_widget = urwid.Text(render_txt, align=self.align)
         if self.is_info:
@@ -188,7 +188,10 @@
             nick = entity.resource
             show = contact_list.getCache(entity, C.PRESENCE_SHOW)
             if show == C.PRESENCE_UNAVAILABLE or show is None:
-                self.occupants_list.deleteValue(nick)
+                try:
+                    self.occupants_list.deleteValue(nick)
+                except ValueError:
+                    pass
             else:
                 values = self.occupants_list.getAllValues()
                 markup = self._buildOccupantMarkup(entity)