Mercurial > libervia-backend
diff frontends/src/primitivus/chat.py @ 2007:19b9d3f8a6c7
plugin XEP-0085, quick_frontends, primitivus: chat states are working again
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 17 Jul 2016 16:47:33 +0200 |
parents | 981e2abbb56c |
children | 8a749ec21c50 |
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py Fri Jul 15 22:13:09 2016 +0200 +++ b/frontends/src/primitivus/chat.py Sun Jul 17 16:47:33 2016 +0200 @@ -152,6 +152,10 @@ return self.occupant_data.nick.lower() < other.occupant_data.nick.lower() @property + def markup(self): + return self._generateMarkup() + + @property def parent(self): return self.mess_data.parent @@ -159,6 +163,10 @@ def nick(self): return self.occupant_data.nick + def redraw(self): + self._w.set_text(self.markup) + self.occupant_data.parent.host.redraw() # FIXME: should not be necessary + def selectable(self): return True @@ -181,13 +189,19 @@ # should be more intuitive and themable o = self.occupant_data markup = [] - markup.append(('info_msg', '{}{} '.format( + markup.append(('info_msg', u'{}{} '.format( o.role[0].upper(), o.affiliation[0].upper(), ))) markup.append(o.nick) + if o.state is not None: + markup.append(u' {}'.format(C.CHAT_STATE_ICON[o.state])) return markup + # events + def updated(self, attributes): + self.redraw() + class OccupantsWidget(urwid.WidgetWrap): @@ -572,6 +586,11 @@ if self.type == C.CHAT_GROUP: self.host.removeListener('presence', self.presenceListener) + def onChatState(self, from_jid, state, profile): + super(Chat, self).onChatState(from_jid, state, profile) + if self.type == C.CHAT_ONE2ONE: + self.title_dynamic = C.CHAT_STATE_ICON[state] + self.host.redraw() # FIXME: should not be necessary quick_widgets.register(quick_chat.QuickChat, Chat) quick_widgets.register(quick_games.Tarot, game_tarot.TarotGame)