comparison 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
comparison
equal deleted inserted replaced
1392:c7082457d03f 1393:50d5d6325f62
71 time_format = "%c" if self.timestamp < self.parent.day_change else "%H:%M" # if the message was sent before today, we print the full date 71 time_format = "%c" if self.timestamp < self.parent.day_change else "%H:%M" # if the message was sent before today, we print the full date
72 render_txt.append(('date', "[%s]" % time.strftime(time_format, self.timestamp).decode('utf-8'))) 72 render_txt.append(('date', "[%s]" % time.strftime(time_format, self.timestamp).decode('utf-8')))
73 if self.parent.show_short_nick: 73 if self.parent.show_short_nick:
74 render_txt.append(('my_nick' if self.my_mess else 'other_nick', "**" if self.my_mess else "*")) 74 render_txt.append(('my_nick' if self.my_mess else 'other_nick', "**" if self.my_mess else "*"))
75 else: 75 else:
76 render_txt.append(('my_nick' if self.my_mess else 'other_nick', "[%s] " % self.nick)) 76 render_txt.append(('my_nick' if self.my_mess else 'other_nick', "[%s] " % (self.nick or '')))
77 render_txt.append(self.message) 77 render_txt.append(self.message)
78 txt_widget = urwid.Text(render_txt, align=self.align) 78 txt_widget = urwid.Text(render_txt, align=self.align)
79 if self.is_info: 79 if self.is_info:
80 return urwid.AttrMap(txt_widget, 'info_msg') 80 return urwid.AttrMap(txt_widget, 'info_msg')
81 return txt_widget 81 return txt_widget
186 self.occupants_list.changeValues(values) 186 self.occupants_list.changeValues(values)
187 else: # add, remove or update only one occupant 187 else: # add, remove or update only one occupant
188 nick = entity.resource 188 nick = entity.resource
189 show = contact_list.getCache(entity, C.PRESENCE_SHOW) 189 show = contact_list.getCache(entity, C.PRESENCE_SHOW)
190 if show == C.PRESENCE_UNAVAILABLE or show is None: 190 if show == C.PRESENCE_UNAVAILABLE or show is None:
191 self.occupants_list.deleteValue(nick) 191 try:
192 self.occupants_list.deleteValue(nick)
193 except ValueError:
194 pass
192 else: 195 else:
193 values = self.occupants_list.getAllValues() 196 values = self.occupants_list.getAllValues()
194 markup = self._buildOccupantMarkup(entity) 197 markup = self._buildOccupantMarkup(entity)
195 if not values: # room has just been created 198 if not values: # room has just been created
196 values = [markup] 199 values = [markup]