# HG changeset patch # User souliane # Date 1384892509 -3600 # Node ID d868181d06497f3b5d5621d233f1c8dd717c5cb5 # Parent 52e60dd2bc438c8cfde25e64b7362605843875ba browser_side: update contacts in "group and contact chooser" when the a user connect/disconnect diff -r 52e60dd2bc43 -r d868181d0649 browser_side/contact.py --- a/browser_side/contact.py Sun Nov 17 22:20:12 2013 +0100 +++ b/browser_side/contact.py Tue Nov 19 21:21:49 2013 +0100 @@ -304,6 +304,10 @@ self.connected[jid][resource] = (availability, priority, statuses) self._contact_list.setState(jid, "availability", availability) + # update the connected contacts chooser live + if hasattr(self.host, "room_contacts_chooser") and self.host.room_contacts_chooser is not None: + self.host.room_contacts_chooser.resetContacts() + def setContactMessageWaiting(self, jid, waiting): """Show an visual indicator that contact has send a message @param jid: jid of the contact diff -r 52e60dd2bc43 -r d868181d0649 browser_side/dialog.py --- a/browser_side/dialog.py Sun Nov 17 22:20:12 2013 +0100 +++ b/browser_side/dialog.py Tue Nov 19 21:21:49 2013 +0100 @@ -185,6 +185,9 @@ self.setHTML(title) self.show() + # needed to update the contacts list when someone logged in/out + self.host.room_contacts_chooser = self + def getRoom(self, asSuffix=False): room = self.room_panel.getRoom() if asSuffix: @@ -206,9 +209,10 @@ sender.setStackText(0, self.title_room + ("" if visible else self.getRoom(True))) elif index == 1: sender.setStackText(1, self.title_invite + ("" if visible else self.getContacts(True))) - if visible: - # update the contacts list in case someone recently logged in/out - self.contact_panel.setContacts(self.getContacts()) + + def resetContacts(self): + """Called when someone log in/out to update the list""" + self.contact_panel.setContacts(self.getContacts()) def onOK(self, sender): room_jid = self.getRoom() @@ -220,6 +224,10 @@ def onCancel(self, sender): self.hide() + def hide(self): + self.host.room_contacts_chooser = None + DialogBox.hide(self, autoClosed=True) + class GenericConfirmDialog(DialogBox):