diff src/browser/sat_browser/contact_list.py @ 696:c2f22ca12e23

browser and server side: remove unibox
author souliane <souliane@mailoo.org>
date Mon, 20 Apr 2015 08:51:25 +0200
parents 1d60fa4d25a4
children b395d1309936
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_list.py	Sun Apr 19 13:10:41 2015 +0200
+++ b/src/browser/sat_browser/contact_list.py	Mon Apr 20 08:51:25 2015 +0200
@@ -184,112 +184,6 @@
             ideal_height -= tab_panel.getTabBar().getOffsetHeight()
         self.scroll_panel.setHeight("%s%s" % (ideal_height, "px"))
 
-    # def updateContact(self, jid_s, attributes, groups):
-    #     """Add a contact to the panel if it doesn't exist, update it else
-
-    #     @param jid_s: jid userhost as unicode
-    #     @param attributes: cf SàT Bridge API's newContact
-    #     @param groups: list of groups"""
-    #     _current_groups = self.getContactGroups(jid_s)
-    #     _new_groups = set(groups)
-    #     _key = "@%s: "
-
-    #     for group in _current_groups.difference(_new_groups):
-    #         # We remove the contact from the groups where he isn't anymore
-    #         self.groups[group].remove(jid_s)
-    #         if not self.groups[group]:
-    #             # The group is now empty, we must remove it
-    #             del self.groups[group]
-    #             self._group_panel.remove(group)
-    #             if self.host.uni_box:
-    #                 self.host.uni_box.removeKey(_key % group)
-
-    #     for group in _new_groups.difference(_current_groups):
-    #         # We add the contact to the groups he joined
-    #         if group not in self.groups.keys():
-    #             self.groups[group] = set()
-    #             self._group_panel.add(group)
-    #             if self.host.uni_box:
-    #                 self.host.uni_box.addKey(_key % group)
-    #         self.groups[group].add(jid_s)
-
-    #     # We add the contact to contact list, it will check if contact already exists
-    #     self._contacts_panel.add(jid_s)
-    #     self.updateVisibility([jid_s], self.getContactGroups(jid_s))
-
-    # def removeContact(self, jid):
-    #     """Remove contacts from groups where he is and contact list"""
-    #     self.updateContact(jid, {}, [])  # we remove contact from every group
-    #     self._contacts_panel.remove(jid)
-
-    # def setConnected(self, jid_s, resource, availability, priority, statuses):
-    #     """Set connection status
-    #     @param jid_s (unicode): JID userhost as unicode
-    #     """
-    #     if availability == 'unavailable':
-    #         if jid_s in self.connected:
-    #             if resource in self.connected[jid_s]:
-    #                 del self.connected[jid_s][resource]
-    #             if not self.connected[jid_s]:
-    #                 del self.connected[jid_s]
-    #     else:
-    #         if jid_s not in self.connected:
-    #             self.connected[jid_s] = {}
-    #         self.connected[jid_s][resource] = (availability, priority, statuses)
-
-    #     # check if the contact is connected with another resource, use the one with highest priority
-    #     if jid_s in self.connected:
-    #         max_resource = max_priority = None
-    #         for tmp_resource in self.connected[jid_s]:
-    #             if max_priority is None or self.connected[jid_s][tmp_resource][1] >= max_priority:
-    #                 max_resource = tmp_resource
-    #                 max_priority = self.connected[jid_s][tmp_resource][1]
-    #         if availability == "unavailable":  # do not check the priority here, because 'unavailable' has a dummy one
-    #             priority = max_priority
-    #             availability = self.connected[jid_s][max_resource][0]
-    #     if jid_s not in self.connected or priority >= max_priority:
-    #         # case 1: jid not in self.connected means all resources are disconnected, update with 'unavailable'
-    #         # case 2: update (or confirm) with the values of the resource which takes precedence
-    #         self._contacts_panel.setState(jid_s, "availability", availability)
-
-    #     self.updateVisibility([jid_s], self.getContactGroups(jid_s))
-
-    def setContactMessageWaiting(self, jid, waiting):
-        """Show a visual indicator that contact has send a message
-
-        @param jid: jid of the contact
-        @param waiting: True if message are waiting"""
-        raise Exception("Should not be there")
-        # self._contacts_panel.setState(jid, "messageWaiting", waiting)
-
-    # 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 if not filter_muc else list(set(contacts).intersection(set(self.getContacts())))
-
-    # def getContactGroups(self, contact_jid_s):
-    #     """Get groups where contact is
-    #    @param group: string of single group, or list of string
-    #    @param contact_jid_s: jid to test, as unicode
-    #     """
-    #     result = set()
-    #     for group in self.groups:
-    #         if self.isContactInGroup(group, contact_jid_s):
-    #             result.add(group)
-    #     return result
-
-    # def isContactInGroup(self, group, contact_jid):
-    #     """Test if the contact_jid is in the group
-    #     @param group: string of single group, or list of string
-    #     @param contact_jid: jid to test
-    #     @return: True if contact_jid is in on of the groups"""
-    #     if group in self.groups and contact_jid in self.groups[group]:
-    #         return True
-    #     return False
-
     def isContactInRoster(self, contact_jid):
         """Test if the contact is in our roster list"""
         for contact_box in self._contacts_panel:
@@ -297,9 +191,6 @@
                 return True
         return False
 
-    # def getContacts(self):
-    #     return self._contacts_panel.getContacts()
-
     def getGroups(self):
         return self.groups.keys()