Mercurial > libervia-web
changeset 271:d868181d0649
browser_side: update contacts in "group and contact chooser" when the a user connect/disconnect
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 19 Nov 2013 21:21:49 +0100 |
parents | 52e60dd2bc43 |
children | 0cb9869b42b6 |
files | browser_side/contact.py browser_side/dialog.py |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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):