plugin XEP-0085: renamed category and parameter

This commit is contained in:
souliane 2013-09-07 19:50:12 +02:00
commit 9378880e62
3 changed files with 8 additions and 6 deletions

View file

@ -229,7 +229,7 @@ class QuickApp(object):
self.setStatusOnline(False)
def connectionError(self, error_type, profile):
"""called when something goest wrong with the connection"""
"""called when something goes wrong with the connection"""
if not self.check_profile(profile):
return
debug(_("Connection Error"))

View file

@ -490,7 +490,7 @@ class Params(object):
def returnXML(prof_xml):
return_xml = prof_xml.toxml()
prof_xml.unlink()
return '\n'.join([line for line in return_xml.split('\n')])
return '\n'.join((line for line in return_xml.split('\n') if line))
return self.__constructProfileXml(security_limit, profile).addCallback(returnXML)

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