comparison 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
comparison
equal deleted inserted replaced
406:63f8469b4ad3 407:6a6551de4414
777 if lib_wid.isJidAccepted(entity_jid_s) or (self.whoami and entity_jid_s == self.whoami.bare): 777 if lib_wid.isJidAccepted(entity_jid_s) or (self.whoami and entity_jid_s == self.whoami.bare):
778 lib_wid.updateValue('avatar', entity_jid_s, avatar) 778 lib_wid.updateValue('avatar', entity_jid_s, avatar)
779 779
780 def _chatStateReceivedCb(self, from_jid_s, state): 780 def _chatStateReceivedCb(self, from_jid_s, state):
781 """Callback when a new chat state is received. 781 """Callback when a new chat state is received.
782 @param from_jid_s: JID from the contact who sent his state 782 @param from_jid_s: JID of the contact who sent his state, or '@ALL@'
783 @param state: new state 783 @param state: new state (string)
784 """ 784 """
785 _from = JID(from_jid_s).bare if from_jid_s != "@ALL@" else from_jid_s 785 if from_jid_s == '@ALL@':
786 target = '@ALL@'
787 nick = Const.ALL_OCCUPANTS
788 else:
789 from_jid = JID(from_jid_s)
790 target = from_jid.bare
791 nick = from_jid.resource
792
786 for lib_wid in self.libervia_widgets: 793 for lib_wid in self.libervia_widgets:
787 if isinstance(lib_wid, panels.ChatPanel): 794 if isinstance(lib_wid, panels.ChatPanel):
788 win_from = lib_wid.target.bare 795 if target == '@ALL' or target == lib_wid.target.bare:
789 good_win = win_from == _from or _from == "@ALL@" 796 if lib_wid.type == 'one2one':
790 if (good_win and lib_wid.type == 'one2one'): 797 lib_wid.setState(state)
791 if state: 798 elif lib_wid.type == 'group':
792 lib_wid.setTitle(win_from + " (" + state + ")") 799 lib_wid.setState(state, nick=nick)
793 else:
794 lib_wid.setTitle(win_from)
795 # start to send "composing" state from now
796 lib_wid.state_machine.started = True
797 elif (lib_wid.type == 'group'):
798 # TODO: chat state notification for groupchat
799 pass
800 800
801 def _askConfirmation(self, confirmation_id, confirmation_type, data): 801 def _askConfirmation(self, confirmation_id, confirmation_type, data):
802 answer_data = {} 802 answer_data = {}
803 803
804 def confirm_cb(result): 804 def confirm_cb(result):