Mercurial > libervia-backend
diff src/plugins/plugin_xep_0085.py @ 643:262d9d9ad27a
plugin XEP-0085: renamed category and parameter
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 07 Sep 2013 19:50:12 +0200 |
parents | 7ea6d5a86e58 |
children | 5c5cf5bca240 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0085.py Sun Sep 08 15:00:15 2013 +0200 +++ b/src/plugins/plugin_xep_0085.py Sat Sep 07 19:50:12 2013 +0200 @@ -33,8 +33,9 @@ NS_CHAT_STATES = "http://jabber.org/protocol/chatstates" CHAT_STATES = ["active", "inactive", "gone", "composing", "paused"] MESSAGE_TYPES = ["chat", "groupchat"] -PARAM_KEY = "Chat State Notifications" -PARAM_NAME = "Enabled" +PARAM_KEY = "Notifications" +PARAM_NAME = "Enable chat state notifications" +ENTITY_KEY = PARAM_KEY + "_" + PARAM_NAME PLUGIN_INFO = { "name": "Chat State Notifications Protocol Plugin", @@ -116,7 +117,7 @@ if the notification has been disabled. Parameter "entity_jid" could be @ALL@ to update all entities. """ - self.host.memory.updateEntityData(entity_jid, PARAM_KEY, value, profile) + self.host.memory.updateEntityData(entity_jid, ENTITY_KEY, value, profile) if not value or value == "@NONE@": # disable chat state for this or these contact(s) self.host.bridge.chatStateReceived(unicode(entity_jid), "", profile) @@ -177,7 +178,7 @@ to_jid = JID(message.getAttribute("to")) try: contact_enabled = self.host.memory.getEntityData( - to_jid, [PARAM_KEY], profile)[PARAM_KEY] + to_jid, [ENTITY_KEY], profile)[ENTITY_KEY] except (exceptions.UnknownEntityError, KeyError): # enable it for the first time self.updateEntityData(to_jid, True, profile) @@ -236,6 +237,7 @@ try: self.map[profile][to_jid]._onEvent("composing") except: + # it just means that no first message has been sent already return