plugin XEP-0085: renamed category and parameter

This commit is contained in:
souliane 2013-09-07 19:50:12 +02:00
commit 9378880e62

View file

@ -33,8 +33,9 @@ NS_XMPP_CLIENT = "jabber:client"
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 @@ class XEP_0085(object):
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 @@ class XEP_0085(object):
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 @@ class XEP_0085(object):
try:
self.map[profile][to_jid]._onEvent("composing")
except:
# it just means that no first message has been sent already
return