changeset 643:262d9d9ad27a

plugin XEP-0085: renamed category and parameter
author souliane <souliane@mailoo.org>
date Sat, 07 Sep 2013 19:50:12 +0200
parents e07a03d52321
children 53de6954e94e
files frontends/src/quick_frontend/quick_app.py src/memory/memory.py src/plugins/plugin_xep_0085.py
diffstat 3 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py	Sun Sep 08 15:00:15 2013 +0200
+++ b/frontends/src/quick_frontend/quick_app.py	Sat Sep 07 19:50:12 2013 +0200
@@ -229,7 +229,7 @@
         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"))
--- a/src/memory/memory.py	Sun Sep 08 15:00:15 2013 +0200
+++ b/src/memory/memory.py	Sat Sep 07 19:50:12 2013 +0200
@@ -490,7 +490,7 @@
         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)
 
--- 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