about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-04-14 18:53:08 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-04-14 18:53:08 +0200
commit616250b2b47fc393b1198c4d784087e8f2cadf74 (patch)
treec25fb2ee2bbdc93de12f53e78e4bcafb6d1c8a82 /src/xmpp
parent48290d3d6187ad31861c7e9d202f545a7d2f7690 (diff)
downloadprofani-tty-616250b2b47fc393b1198c4d784087e8f2cadf74.tar.gz
Review logging in iq.c
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/iq.c66
1 files changed, 39 insertions, 27 deletions
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index 2bcf9bba..0559e10a 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -826,14 +826,14 @@ _caps_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
     }
 
     if (id) {
-        log_info("Capabilities response handler fired for id %s", id);
+        log_debug("Capabilities response handler fired for id %s", id);
     } else {
-        log_info("Capabilities response handler fired");
+        log_debug("Capabilities response handler fired");
     }
 
     const char *from = xmpp_stanza_get_from(stanza);
     if (!from) {
-        log_info("No from attribute");
+        log_info("_caps_response_id_handler(): No from attribute");
         return 0;
     }
 
@@ -846,13 +846,13 @@ _caps_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
     }
 
     if (query == NULL) {
-        log_info("No query element found.");
+        log_info("_caps_response_id_handler(): No query element found.");
         return 0;
     }
 
     const char *node = xmpp_stanza_get_attribute(query, STANZA_ATTR_NODE);
     if (node == NULL) {
-        log_info("No node attribute found");
+        log_info("_caps_response_id_handler(): No node attribute found");
         return 0;
     }
 
@@ -866,12 +866,12 @@ _caps_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
         log_warning("Generated : %s", generated_sha1);
         log_warning("Given     : %s", given_sha1);
     } else {
-        log_info("Valid SHA-1 hash found: %s", given_sha1);
+        log_debug("Valid SHA-1 hash found: %s", given_sha1);
 
         if (caps_cache_contains(given_sha1)) {
-            log_info("Capabilties already cached: %s", given_sha1);
+            log_debug("Capabilties already cached: %s", given_sha1);
         } else {
-            log_info("Capabilities not cached: %s, storing", given_sha1);
+            log_debug("Capabilities not cached: %s, storing", given_sha1);
             EntityCapabilities *capabilities = stanza_create_caps_from_query_element(query);
             caps_add_by_ver(given_sha1, capabilities);
             caps_destroy(capabilities);
@@ -900,14 +900,18 @@ _caps_response_for_jid_id_handler(xmpp_stanza_t *const stanza, void *const userd
     }
 
     if (id) {
-        log_info("Capabilities response handler fired for id %s", id);
+        log_debug("Capabilities response handler fired for id %s", id);
     } else {
-        log_info("Capabilities response handler fired");
+        log_debug("Capabilities response handler fired");
     }
 
     const char *from = xmpp_stanza_get_from(stanza);
     if (!from) {
-        log_info("No from attribute");
+        if (jid) {
+            log_info("_caps_response_for_jid_id_handler(): No from attribute for %s", jid);
+        } else {
+            log_info("_caps_response_for_jid_id_handler(): No from attribute");
+        }
         return 0;
     }
 
@@ -920,17 +924,25 @@ _caps_response_for_jid_id_handler(xmpp_stanza_t *const stanza, void *const userd
     }
 
     if (query == NULL) {
-        log_info("No query element found.");
+        if (jid) {
+            log_info("_caps_response_for_jid_id_handler(): No query element found for %s.", jid);
+        } else {
+            log_info("_caps_response_for_jid_id_handler(): No query element found.");
+        }
         return 0;
     }
 
     const char *node = xmpp_stanza_get_attribute(query, STANZA_ATTR_NODE);
     if (node == NULL) {
-        log_info("No node attribute found");
+        if (jid) {
+            log_info("_caps_response_for_jid_id_handler(): No node attribute found for %s", jid);
+        } else {
+            log_info("_caps_response_for_jid_id_handler(): No node attribute found");
+        }
         return 0;
     }
 
-    log_info("Associating capabilities with: %s", jid);
+    log_debug("Associating capabilities with: %s", jid);
     EntityCapabilities *capabilities = stanza_create_caps_from_query_element(query);
     caps_add_by_jid(jid, capabilities);
 
@@ -951,14 +963,14 @@ _caps_response_legacy_id_handler(xmpp_stanza_t *const stanza, void *const userda
     }
 
     if (id) {
-        log_info("Capabilities response handler fired for id %s", id);
+        log_debug("Capabilities response handler fired for id %s", id);
     } else {
-        log_info("Capabilities response handler fired");
+        log_debug("Capabilities response handler fired");
     }
 
     const char *from = xmpp_stanza_get_from(stanza);
     if (!from) {
-        log_info("No from attribute");
+        log_info("_caps_response_legacy_id_handler(): No from attribute");
         return 0;
     }
 
@@ -971,23 +983,23 @@ _caps_response_legacy_id_handler(xmpp_stanza_t *const stanza, void *const userda
     }
 
     if (query == NULL) {
-        log_info("No query element found.");
+        log_info("_caps_response_legacy_id_handler(): No query element found.");
         return 0;
     }
 
     const char *node = xmpp_stanza_get_attribute(query, STANZA_ATTR_NODE);
     if (node == NULL) {
-        log_info("No node attribute found");
+        log_info("_caps_response_legacy_id_handler(): No node attribute found");
         return 0;
     }
 
     // nodes match
     if (g_strcmp0(expected_node, node) == 0) {
-        log_info("Legacy capabilities, nodes match %s", node);
+        log_debug("Legacy capabilities, nodes match %s", node);
         if (caps_cache_contains(node)) {
-            log_info("Capabilties already cached: %s", node);
+            log_debug("Capabilties already cached: %s", node);
         } else {
-            log_info("Capabilities not cached: %s, storing", node);
+            log_debug("Capabilities not cached: %s, storing", node);
             EntityCapabilities *capabilities = stanza_create_caps_from_query_element(query);
             caps_add_by_ver(node, capabilities);
             caps_destroy(capabilities);
@@ -2082,7 +2094,7 @@ _room_info_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata
 {
     const char *type = xmpp_stanza_get_type(stanza);
     ProfRoomInfoData *cb_data = (ProfRoomInfoData *)userdata;
-    log_info("Received disco#info response for room: %s", cb_data->room);
+    log_debug("Received disco#info response for room: %s", cb_data->room);
 
     // handle error responses
     if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
@@ -2225,9 +2237,9 @@ _disco_info_response_id_handler(xmpp_stanza_t *const stanza, void *const userdat
     const char *type = xmpp_stanza_get_type(stanza);
 
     if (from) {
-        log_info("Received disco#info response from: %s", from);
+        log_debug("Received disco#info response from: %s", from);
     } else {
-        log_info("Received disco#info response");
+        log_debug("Received disco#info response");
     }
 
     // handle error responses
@@ -2302,9 +2314,9 @@ _disco_info_response_id_handler_onconnect(xmpp_stanza_t *const stanza, void *con
     const char *type = xmpp_stanza_get_type(stanza);
 
     if (from) {
-        log_info("Received disco#info response from: %s", from);
+        log_debug("Received disco#info response from: %s", from);
     } else {
-        log_info("Received disco#info response");
+        log_debug("Received disco#info response");
     }
 
     // handle error responses