Mercurial > libervia-web
diff libervia.py @ 407:6a6551de4414
browser_side: display chat states (with symbols) for MUC participants
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 16 Mar 2014 21:03:50 +0100 |
parents | f539f6f8ee9c |
children | ee8ebfe23e16 |
line wrap: on
line diff
--- a/libervia.py Sun Mar 16 20:55:50 2014 +0100 +++ b/libervia.py Sun Mar 16 21:03:50 2014 +0100 @@ -779,24 +779,24 @@ def _chatStateReceivedCb(self, from_jid_s, state): """Callback when a new chat state is received. - @param from_jid_s: JID from the contact who sent his state - @param state: new state + @param from_jid_s: JID of the contact who sent his state, or '@ALL@' + @param state: new state (string) """ - _from = JID(from_jid_s).bare if from_jid_s != "@ALL@" else from_jid_s + if from_jid_s == '@ALL@': + target = '@ALL@' + nick = Const.ALL_OCCUPANTS + else: + from_jid = JID(from_jid_s) + target = from_jid.bare + nick = from_jid.resource + for lib_wid in self.libervia_widgets: if isinstance(lib_wid, panels.ChatPanel): - win_from = lib_wid.target.bare - good_win = win_from == _from or _from == "@ALL@" - if (good_win and lib_wid.type == 'one2one'): - if state: - lib_wid.setTitle(win_from + " (" + state + ")") - else: - lib_wid.setTitle(win_from) - # start to send "composing" state from now - lib_wid.state_machine.started = True - elif (lib_wid.type == 'group'): - # TODO: chat state notification for groupchat - pass + if target == '@ALL' or target == lib_wid.target.bare: + if lib_wid.type == 'one2one': + lib_wid.setState(state) + elif lib_wid.type == 'group': + lib_wid.setState(state, nick=nick) def _askConfirmation(self, confirmation_id, confirmation_type, data): answer_data = {}