Mercurial > libervia-backend
diff frontends/src/primitivus/chat.py @ 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 | 1f3513cfb246 |
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):