primitivus: display chat states (with symbols) for MUC participants

This commit is contained in:
souliane 2014-03-17 13:24:55 +01:00
commit 67d15eb488

View file

@ -496,6 +496,31 @@ class QuickApp(object):
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: