changeset 1246:8b891f9be183

core, plugins: improve a bit some log messages
author souliane <souliane@mailoo.org>
date Sat, 18 Oct 2014 16:28:37 +0200
parents 84d06701f5c4
children c6cf44e6330b
files src/core/xmpp.py src/plugins/plugin_sec_otr.py src/plugins/plugin_xep_0054.py src/plugins/plugin_xep_0060.py src/plugins/plugin_xep_0115.py
diffstat 5 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/xmpp.py	Sun Oct 19 12:31:28 2014 +0200
+++ b/src/core/xmpp.py	Sat Oct 18 16:28:37 2014 +0200
@@ -237,11 +237,14 @@
             # may change in the future
             self.removeItem(item.jid)
             return
-        log.info(_("new contact in roster list: %s") % item.jid.full())
+        log.debug(_("New contact in roster list: %s") % item.jid.full())
         if not item.subscriptionTo:
-            log.warning(_("You are not subscribed to this contact !"))
+            if not item.subscriptionFrom:
+                log.info(_("There's no subscription between you and [%s]!") % item.jid.full())
+            else:
+                log.info(_("You are not subscribed to [%s]!") % item.jid.full())
         if not item.subscriptionFrom:
-            log.warning(_("This contact is not subscribed to you !"))
+            log.info(_("[%s] is not subscribed to you!") % item.jid.full())
         #self.host.memory.addContact(item.jid, item_attr, item.groups, self.parent.profile)
 
         bare_jid = item.jid.userhostJID()
--- a/src/plugins/plugin_sec_otr.py	Sun Oct 19 12:31:28 2014 +0200
+++ b/src/plugins/plugin_sec_otr.py	Sat Oct 18 16:28:37 2014 +0200
@@ -188,7 +188,7 @@
     def getContextForUser(self, other):
         log.debug(u"getContextForUser [%s]" % other)
         if not other.resource:
-            log.warning("getContextForUser called with a bare jid")
+            log.warning("getContextForUser called with a bare jid: %s" % other.full())
         return self.startContext(other)
 
 
--- a/src/plugins/plugin_xep_0054.py	Sun Oct 19 12:31:28 2014 +0200
+++ b/src/plugins/plugin_xep_0054.py	Sat Oct 18 16:28:37 2014 +0200
@@ -143,7 +143,7 @@
         """Parse a <PHOTO> elem and save the picture"""
         for elem in photo_xml.elements():
             if elem.name == 'TYPE':
-                log.info(_('Photo of type [%s] found') % str(elem))
+                log.debug(_('Photo of type [%s] found') % str(elem))
             if elem.name == 'BINVAL':
                 log.debug(_('Decoding binary'))
                 decoded = b64decode(str(elem))
--- a/src/plugins/plugin_xep_0060.py	Sun Oct 19 12:31:28 2014 +0200
+++ b/src/plugins/plugin_xep_0060.py	Sat Oct 18 16:28:37 2014 +0200
@@ -177,7 +177,7 @@
         d_dict = {}
         for publisher, node in data.items():
             if node not in found_nodes:
-                log.info("Skip the items retrieval for [{node}]: node doesn't exist".format(node=node))
+                log.debug("Skip the items retrieval for [{node}]: node doesn't exist".format(node=node))
                 continue  # avoid pubsub "item-not-found" error
             d_dict[publisher] = client.items(service, node, max_items, item_ids, sub_id, client.parent.jid)
         defer.returnValue(d_dict)
@@ -223,7 +223,7 @@
         d_list = []
         for nodeIdentifier in (set(nodeIdentifiers) - set(subscribed_nodes)):
             if nodeIdentifier not in found_nodes:
-                log.info("Skip the subscription to [{node}]: node doesn't exist".format(node=nodeIdentifier))
+                log.debug("Skip the subscription to [{node}]: node doesn't exist".format(node=nodeIdentifier))
                 continue  # avoid sat-pubsub "SubscriptionExists" error
             d_list.append(client.subscribe(service, nodeIdentifier, sub_jid or client.parent.jid.userhostJID(), options=options))
         defer.returnValue(d_list)
--- a/src/plugins/plugin_xep_0115.py	Sun Oct 19 12:31:28 2014 +0200
+++ b/src/plugins/plugin_xep_0115.py	Sat Oct 18 16:28:37 2014 +0200
@@ -140,7 +140,7 @@
             c_hash = c_elem['hash']
             c_node = c_elem['node']
         except KeyError:
-            log.warning(_('Received invalid capabilities tag'))
+            log.warning(_('Received invalid capabilities tag: %s') % c_elem.toXml())
             return
 
         if c_ver in self.host.memory.disco.hashes: