quick_frontends, primitivus: know who are the MUC occupants from the presence informations:

- QuickChat.occupants is now a property using cached information
    - some MUC handlers are no more needed, the presence handler is enough
This commit is contained in:
souliane 2015-03-20 16:25:38 +01:00
commit c6419871ac
2 changed files with 21 additions and 58 deletions

View file

@ -226,19 +226,10 @@ class Chat(PrimitivusWidget, QuickChat):
self.chat_widget.header = urwid.AttrMap(self.subj_wid,'title')
self.host.redraw()
def setPresents(self, nicks):
"""Set the occupants of a group chat.
@param nicks (list[unicode]): sorted list of nicknames
"""
QuickChat.setPresents(self, nicks)
self.present_wid.changeValues(nicks)
self.host.redraw()
def replaceUser(self, param_nick, show_info=True):
def addUser(self, param_nick):
"""Add user if it is not in the group list"""
nick = unicode(param_nick) #FIXME: should be done in DBus bridge
QuickChat.replaceUser(self, nick, show_info)
QuickChat.addUser(self, nick)
presents = self.present_wid.getAllValues()
if nick not in [present.value for present in presents]:
presents.append(nick)
@ -246,10 +237,10 @@ class Chat(PrimitivusWidget, QuickChat):
self.present_wid.changeValues(presents)
self.host.redraw()
def removeUser(self, param_nick, show_info=True):
def removeUser(self, param_nick):
"""Remove a user from the group list"""
nick = unicode(param_nick) #FIXME: should be done in DBus bridge
QuickChat.removeUser(self, nick, show_info)
QuickChat.removeUser(self, nick)
self.present_wid.deleteValue(nick)
self.host.redraw()

View file

@ -148,10 +148,6 @@ class ContactList(PrimitivusWidget, QuickContactList):
self.update()
self._emit('click', entity)
def onPresenceUpdate(self, entity, show, priority, statuses, profile):
super(ContactList, self).onPresenceUpdate(entity, show, priority, statuses, profile)
self.update()
def onNickUpdate(self, entity, new_nick, profile):
self.update()