diff browser_side/contact.py @ 272:0cb9869b42b6

browser_side: bug fix for RoomAndContactsChooser (do not display the MUCs in the list)
author souliane <souliane@mailoo.org>
date Thu, 21 Nov 2013 13:44:26 +0100
parents d868181d0649
children 2d6bd975a72d
line wrap: on
line diff
--- a/browser_side/contact.py	Tue Nov 19 21:21:49 2013 +0100
+++ b/browser_side/contact.py	Thu Nov 21 13:44:26 2013 +0100
@@ -258,7 +258,7 @@
 
     def updateContact(self, jid, attributes, groups):
         """Add a contact to the panel if it doesn't exist, update it else
-        @param jid: jid
+        @param jid: jid userhost as unicode
         @attributes: cf SàT Bridge API's newContact
         @param groups: list of groups"""
         _current_groups = self.getContactGroups(jid)
@@ -291,7 +291,9 @@
         self._contact_list.remove(jid)
 
     def setConnected(self, jid, resource, availability, priority, statuses):
-        """Set connection status"""
+        """Set connection status
+        @param jid: JID userhost as unicode
+        """
         if availability == 'unavailable':
             if self.connected.has_key(jid):
                 if self.connected[jid].has_key(resource):
@@ -314,11 +316,13 @@
         @param waiting: True if message are waiting"""
         self._contact_list.setState(jid, "messageWaiting", waiting)
 
-    def getConnected(self):
-        """return a list of all jid (bare jid) connected"""
+    def getConnected(self, filter_muc=False):
+        """return a list of all jid (bare jid) connected
+        @param filter_muc: if True, remove the groups from the list
+        """
         contacts = self.connected.keys()
         contacts.sort()
-        return contacts
+        return contacts if not filter_muc else list(set(contacts).intersection(set(self.getContacts())))
 
     def getContactGroups(self, contact_jid):
         """Get groups where contact is