Mercurial > libervia-backend
diff frontends/src/quick_frontend/quick_app.py @ 1388:a025242bebe7
quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 24 Mar 2015 17:31:08 +0100 |
parents | 1f3513cfb246 |
children | 1276e6a0716b |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py Tue Mar 24 10:46:42 2015 +0100 +++ b/frontends/src/quick_frontend/quick_app.py Tue Mar 24 17:31:08 2015 +0100 @@ -534,6 +534,7 @@ chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) chat_widget.setUserNick(unicode(user_nick)) self.contact_lists[profile].setSpecial(room_jid, C.CONTACT_SPECIAL_GROUP) + chat_widget.update() def roomLeftHandler(self, room_jid_s, profile): """Called when a MUC room is left""" @@ -579,16 +580,20 @@ @param state (unicode): new state @param profile (unicode): current profile """ + log.debug(_(u"Received new chat state {} from {} [{}]").format(state, from_jid_s, profile)) from_jid = jid.JID(from_jid_s) if from_jid_s != C.ENTITY_ALL else C.ENTITY_ALL + contact_list = self.contact_lists[profile] for widget in self.widgets.getWidgets(quick_chat.QuickChat): if profile != widget.profile: continue to_display = C.USER_CHAT_STATES[state] if (state and widget.type == C.CHAT_GROUP) else state if widget.type == C.CHAT_GROUP and from_jid_s == C.ENTITY_ALL: for occupant in [jid.newResource(widget.target, nick) for nick in widget.occupants]: - widget.updateEntityState(occupant, 'chat_state', to_display) + contact_list.setCache(occupant, 'chat_state', to_display) + widget.update(occupant) elif from_jid.bare == widget.target.bare: # roster contact or MUC occupant - widget.updateEntityState(from_jid, 'chat_state', to_display) + contact_list.setCache(from_jid, 'chat_state', to_display) + widget.update(from_jid) def personalEventHandler(self, sender, event_type, data): """Called when a PEP event is received.