diff src/plugins/plugin_xep_0085.py @ 1330:22fce2e51c70 frontends_multi_profiles

plugin XEP-0085: fixes the calls to memory.deleteEntityDatum and self.updateCache (was self.updateEntityData, has been renamed to avoid confusion with the memory method)
author souliane <souliane@mailoo.org>
date Sun, 22 Feb 2015 11:43:11 +0100
parents be3a301540c0
children f29beedb33b0
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0085.py	Sun Feb 22 15:11:29 2015 +0100
+++ b/src/plugins/plugin_xep_0085.py	Sun Feb 22 11:43:11 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_key=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_key=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_key=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_key=profile)
+                self.updateCache(to_jid, True, profile=profile)
                 return True
         # wait for the first message before sending states
         return False