diff --git a/src/plugins/plugin_xep_0085.py b/src/plugins/plugin_xep_0085.py index 8017c9d1..e2625a46 100755 --- a/src/plugins/plugin_xep_0085.py +++ b/src/plugins/plugin_xep_0085.py @@ -126,16 +126,16 @@ class XEP_0085(object): 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. + @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 @@ class XEP_0085(object): @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 @@ class XEP_0085(object): 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 @@ class XEP_0085(object): 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