Mercurial > libervia-backend
changeset 1383:59c48796759e
quick_frontend, primitivus (chat): merge setOccupantStates and setContactStates
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 23 Mar 2015 09:34:23 +0100 |
parents | b01efa1c0f5e |
children | 73f8582c7c99 |
files | frontends/src/primitivus/chat.py frontends/src/quick_frontend/quick_chat.py |
diffstat | 2 files changed, 20 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py Sun Mar 22 14:20:19 2015 +0100 +++ b/frontends/src/primitivus/chat.py Mon Mar 23 09:34:23 2015 +0100 @@ -149,28 +149,22 @@ menu.addMenu(_("Action"), _("Send file"), self.onSendFileRequest) return menu - def setOccupantStates(self, occupant_jid, states): - """Set a MUC occupant's states. - - @param occupant_jid (jid.JID): occupant to update - @param states (dict{unicode: unicode}): new states - """ - options = self.occupants_list.getAllValues() - for index in xrange(0, len(options)): - nick = options[index].value - if nick == occupant_jid.resource: - options[index] = (nick, "%s %s" % (u''.join(states.values()), nick)) - self.occupants_list.changeValues(options) - break - self.host.redraw() - def setContactStates(self, contact_jid, states): - """Set a one2one contact's states. + """Set a contact (one2one or MUC occupant) states. @param contact_jid (jid.JID): contact @param states (dict{unicode: unicode}): new states """ - self.title_dynamic = ' '.join([u'({})'.format(state) for state in states.values()]) + if self.type == C.CHAT_GROUP: + options = self.occupants_list.getAllValues() + for index in xrange(0, len(options)): + nick = options[index].value + if nick == contact_jid.resource: + options[index] = (nick, "%s %s" % (u''.join(states.values()), nick)) + self.occupants_list.changeValues(options) + break + else: + self.title_dynamic = ' '.join([u'({})'.format(state) for state in states.values()]) self.host.redraw() def _occupantsClicked(self, list_wid, clicked_wid):
--- a/frontends/src/quick_frontend/quick_chat.py Sun Mar 22 14:20:19 2015 +0100 +++ b/frontends/src/quick_frontend/quick_chat.py Mon Mar 23 09:34:23 2015 +0100 @@ -224,10 +224,15 @@ value = clist.getCache(entity, key) if value: states[key] = value - if self.type == C.CHAT_GROUP: - self.setOccupantStates(entity, states) - else: - self.setContactStates(entity, states) + self.setContactStates(entity, states) + + def setContactStates(self, contact_jid, states): + """Set a contact (one2one or MUC occupant) states. + + @param contact_jid (jid.JID): contact + @param states (dict{unicode: unicode}): new states + """ + raise NotImplementedError def addGamePanel(self, widget): """Insert a game panel to this Chat dialog.