comparison 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
comparison
equal deleted inserted replaced
906:1cbae66fa725 907:cd02f5ef30df
494 if not self.check_profile(profile): 494 if not self.check_profile(profile):
495 return 495 return
496 if room_jid in self.chat_wins: 496 if room_jid in self.chat_wins:
497 self.chat_wins[room_jid].getGame("Quiz").quizGameTimerRestarted(time_left) 497 self.chat_wins[room_jid].getGame("Quiz").quizGameTimerRestarted(time_left)
498 498
499 def chatStateReceived(self, from_jid_s, state, profile):
500 """Callback when a new chat state is received.
501 @param from_jid_s: JID of the contact who sent his state, or '@ALL@'
502 @param state: new state (string)
503 @profile: current profile
504 """
505 if not self.check_profile(profile):
506 return
507
508 if from_jid_s == '@ALL@':
509 target = '@ALL@'
510 nick = Const.ALL_OCCUPANTS
511 else:
512 from_jid = JID(from_jid_s)
513 target = from_jid.bare
514 nick = from_jid.resource
515
516 for bare in self.chat_wins.keys():
517 if target == '@ALL' or target == bare:
518 chat_win = self.chat_wins[bare]
519 if chat_win.type == 'one2one':
520 chat_win.updateChatState(state)
521 elif chat_win.type == 'group':
522 chat_win.updateChatState(state, nick=nick)
523
499 def _subscribe_cb(self, answer, data): 524 def _subscribe_cb(self, answer, data):
500 entity, profile = data 525 entity, profile = data
501 if answer: 526 if answer:
502 self.bridge.subscription("subscribed", entity.bare, profile_key=profile) 527 self.bridge.subscription("subscribed", entity.bare, profile_key=profile)
503 else: 528 else: