diff frontends/src/quick_frontend/quick_contact_list.py @ 510:886754295efe

quick frontend, primitivus, wix: MUC private messages management /!\ not fully finished, backend part is not done yet /!\ - as resources are discarded to manage chat windows lists, a pretty dirty hack is done to work around this: full jid is escaped using a prefix (it becomes invalid and resource is preserved). - new quick_utils module, with helper methods. escapePrivate and unescapePrivate implementations - MUC private messages are not managed in Wix yet
author Goffi <goffi@goffi.org>
date Thu, 11 Oct 2012 00:48:35 +0200
parents 65ecbb473cbb
children a7f53e778d8e
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_contact_list.py	Fri Sep 28 00:48:52 2012 +0200
+++ b/frontends/src/quick_frontend/quick_contact_list.py	Thu Oct 11 00:48:35 2012 +0200
@@ -28,6 +28,7 @@
     def __init__(self):
         debug(_("Contact List init"))
         self._cache = {}
+        self.specials={}
 
     def update_jid(self, jid):
         """Update the jid in the list when something changed"""
@@ -51,31 +52,34 @@
     
     def clearContacts(self, jid):
         """Clear all the contact list"""
-        raise NotImplementedError
+        self.specials.clear()
     
-    def _replace(self, jid, groups=None, attributes=None):
+    def replace(self, jid, groups=None, attributes=None):
+        """add a contact to the list if doesn't exist, else update it"""
         if attributes and 'name' in attributes:
             self.setCache(jid, 'name', attributes['name'])
-        self.replace(jid, groups, attributes)
-    
-    def replace(self, jid, groups, attributes):
-        """add a contact to the list if doesn't exist, else update it"""
-        raise NotImplementedError
     
     def remove(self, jid):
         """remove a contact from the list"""
-        raise NotImplementedError
+        try:
+            del self.specials[jid.short]
+        except KeyError:
+            pass
 
     def add(self, jid, param_groups=None):
         """add a contact to the list"""
         raise NotImplementedError
 
+    def getSpecial(self, jid):
+        """Return special type of jid, or None if it's not special"""
+        return self.specials.get(jid.short)
+
     def setSpecial(self, jid, _type):
         """Set entity as a special
         @param jid: jid of the entity
         @param _type: special type (e.g.: "MUC")
         """
-        raise NotImplementedError
+        self.specials[jid.short] = _type
 
     def updatePresence(self, jid, show, priority, statuses):
         """Update entity's presence status