# HG changeset patch # User souliane # Date 1426100773 -3600 # Node ID d3e9848b9574c13588bb8f316025481b5c1b98e5 # Parent 8ea8fa13c3518c9d61d450ceed33a367e8e2bd55 quick_frontend, primitivus (chat): pass a sorted list to Chat.setPresents diff -r 8ea8fa13c351 -r d3e9848b9574 frontends/src/primitivus/chat.py --- a/frontends/src/primitivus/chat.py Wed Mar 11 12:43:48 2015 +0100 +++ b/frontends/src/primitivus/chat.py Wed Mar 11 20:06:13 2015 +0100 @@ -226,12 +226,11 @@ self.chat_widget.header = urwid.AttrMap(self.subj_wid,'title') self.host.redraw() - def setPresents(self, param_nicks): - """Set the users presents in the contact list for a group chat - @param nicks: list of nicknames + def setPresents(self, nicks): + """Set the occupants of a group chat. + + @param nicks (list[unicode]): sorted list of nicknames """ - nicks = [unicode(nick) for nick in param_nicks] #FIXME: should be done in DBus bridge - nicks.sort() QuickChat.setPresents(self, nicks) self.present_wid.changeValues(nicks) self.host.redraw() diff -r 8ea8fa13c351 -r d3e9848b9574 frontends/src/quick_frontend/quick_app.py --- a/frontends/src/quick_frontend/quick_app.py Wed Mar 11 12:43:48 2015 +0100 +++ b/frontends/src/quick_frontend/quick_app.py Wed Mar 11 20:06:13 2015 +0100 @@ -524,8 +524,11 @@ room_jid = jid.JID(room_jid_s) chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) chat_widget.setUserNick(user_nick) - chat_widget.id = room_jid # FIXME: to be removed - chat_widget.setPresents(list(set([user_nick] + room_nicks))) + chat_widget.id = room_jid # FIXME: to be removed + room_nicks = [unicode(nick) for nick in room_nicks] # FIXME: should be done in DBus bridge / is that still needed?! + nicks = list(set([user_nick] + room_nicks)) + nicks.sort() + chat_widget.setPresents(nicks) self.contact_lists[profile].setSpecial(room_jid, C.CONTACT_SPECIAL_GROUP) def roomLeftHandler(self, room_jid_s, profile): diff -r 8ea8fa13c351 -r d3e9848b9574 frontends/src/quick_frontend/quick_chat.py --- a/frontends/src/quick_frontend/quick_chat.py Wed Mar 11 12:43:48 2015 +0100 +++ b/frontends/src/quick_frontend/quick_chat.py Wed Mar 11 20:06:13 2015 +0100 @@ -93,13 +93,14 @@ return False def setPresents(self, nicks): - """Set the users presents in the contact list for a group chat - @param nicks: list of nicknames + """Set the occupants of a group chat. + + @param nicks (list[unicode]): sorted list of nicknames """ - log.debug (_("Adding users %s to room") % nicks) + log.debug(_("Adding users %s to room") % nicks) if self.type != C.CHAT_GROUP: - log.error (_("[INTERNAL] trying to set presents nicks for a non group chat window")) - raise Exception("INTERNAL ERROR") #TODO: raise proper Exception here + log.error(_("[INTERNAL] trying to set presents nicks for a non group chat window")) + raise Exception("INTERNAL ERROR") # TODO: raise proper Exception here self.occupants.update(nicks) def replaceUser(self, nick, show_info=True):