# HG changeset patch # User souliane # Date 1385046213 -3600 # Node ID 11718798ab8a6d54c1743a207f546c6c0cd9ec7f # Parent 0cb9869b42b6593021f5e82a938506baec6ac000 browser_side: can identify muc members with symbols diff -r 0cb9869b42b6 -r 11718798ab8a browser_side/panels.py --- a/browser_side/panels.py Thu Nov 21 13:44:26 2013 +0100 +++ b/browser_side/panels.py Thu Nov 21 16:03:33 2013 +0100 @@ -626,13 +626,24 @@ class Occupant(HTML): """Occupant of a MUC room""" - def __init__(self, nick): + def __init__(self, nick, special=""): + HTML.__init__(self) self.nick = nick - HTML.__init__(self, "
%s
" % html_sanitize(nick)) + self.special = special + self._refresh() def __str__(self): return self.nick + def addSpecial(self, special=""): + if special not in self.special: + self.special += special + self._refresh() + + def _refresh(self): + special = "" if len(self.special) == 0 else " %s" % self.special + self.setHTML("
%s%s
" % (html_sanitize(self.nick), special)) + class OccupantsList(AbsolutePanel): """Panel user to show occupants of a room""" @@ -657,6 +668,16 @@ self.occupants_list.clear() AbsolutePanel.clear(self) + def addSpecials(self, occupants=[], html=""): + index = 0 + special = html + for occupant in occupants: + if occupant in self.occupants_list.keys(): + if isinstance(html, list): + special = html[index] + index = (index + 1) % len(html) + self.occupants_list[occupant].addSpecial(special) + class ChatPanel(base_widget.LiberviaWidget):