diff src/plugins/plugin_xep_0085.py @ 1337:f29beedb33b0 frontends_multi_profiles

merged souliane changes
author Goffi <goffi@goffi.org>
date Mon, 23 Feb 2015 18:08:22 +0100
parents 2c6c93438f74 22fce2e51c70
children 8aa32bcc3a9c
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0085.py	Mon Feb 23 18:04:25 2015 +0100
+++ b/src/plugins/plugin_xep_0085.py	Mon Feb 23 18:08:22 2015 +0100
@@ -126,16 +126,16 @@
             self.map[profile][to_jid]._onEvent('gone')
         del self.map[profile]
 
-    def updateEntityData(self, entity_jid, value, profile):
+    def updateCache(self, entity_jid, value, profile):
         """Update the entity data of the given profile for one or all contacts.
+        Reset the chat state(s) display if the notification has been disabled.
 
-        Reset the chat state(s) display if the notification has been disabled.
         @param entity_jid: contact's JID, or C.ENTITY_ALL to update all contacts.
         @param value: True, False or DELETE_VALUE to delete the entity data
         @param profile: current profile
         """
         if value == DELETE_VALUE:
-            self.host.memory.delEntityData(entity_jid, ENTITY_KEY, profile)
+            self.host.memory.delEntityDatum(entity_jid, ENTITY_KEY, profile)
         else:
             self.host.memory.updateEntityData(entity_jid, ENTITY_KEY, value, profile_key=profile)
         if not value or value == DELETE_VALUE:
@@ -151,7 +151,7 @@
         @param type_: parameter type
         """
         if (category, name) == (PARAM_KEY, PARAM_NAME):
-            self.updateEntityData(C.ENTITY_ALL, True if bool("true") else DELETE_VALUE, profile=profile)
+            self.updateCache(C.ENTITY_ALL, True if bool("true") else DELETE_VALUE, profile=profile)
             return False
         return True
 
@@ -173,11 +173,11 @@
                 try:
                     domish.generateElementsNamed(message.elements(), name="active").next()
                     # contact enabled Chat State Notifications
-                    self.updateEntityData(from_jid, True, profile=profile)
+                    self.updateCache(from_jid, True, profile=profile)
                 except StopIteration:
                     if message.getAttribute('type') == 'chat':
                         # contact didn't enable Chat State Notifications
-                        self.updateEntityData(from_jid, False, profile=profile)
+                        self.updateCache(from_jid, False, profile=profile)
                         return True
             except StopIteration:
                 pass
@@ -260,7 +260,7 @@
         except (exceptions.UnknownEntityError, KeyError):
             if forceEntityData:
                 # enable it for the first time
-                self.updateEntityData(to_jid, True, profile=profile)
+                self.updateCache(to_jid, True, profile=profile)
                 return True
         # wait for the first message before sending states
         return False