Mercurial > libervia-backend
diff frontends/src/quick_frontend/quick_app.py @ 907:cd02f5ef30df
primitivus: display chat states (with symbols) for MUC participants
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 17 Mar 2014 13:24:55 +0100 |
parents | 1cbae66fa725 |
children | a9401694d2dc |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py Sun Mar 16 21:25:49 2014 +0100 +++ b/frontends/src/quick_frontend/quick_app.py Mon Mar 17 13:24:55 2014 +0100 @@ -496,6 +496,31 @@ if room_jid in self.chat_wins: self.chat_wins[room_jid].getGame("Quiz").quizGameTimerRestarted(time_left) + def chatStateReceived(self, from_jid_s, state, profile): + """Callback when a new chat state is received. + @param from_jid_s: JID of the contact who sent his state, or '@ALL@' + @param state: new state (string) + @profile: current profile + """ + if not self.check_profile(profile): + return + + 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 bare in self.chat_wins.keys(): + if target == '@ALL' or target == bare: + chat_win = self.chat_wins[bare] + if chat_win.type == 'one2one': + chat_win.updateChatState(state) + elif chat_win.type == 'group': + chat_win.updateChatState(state, nick=nick) + def _subscribe_cb(self, answer, data): entity, profile = data if answer: