[telepathy-gabble/master] Use capability sets for debug output

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Aug 24 12:17:40 PDT 2009


---
 src/connection.c     |   13 ++++++++++---
 src/presence-cache.c |   15 +++++++++++----
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index de46a2f..9a6ff20 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2493,9 +2493,16 @@ gabble_connection_advertise_capabilities (TpSvcConnectionInterfaceCapabilities *
   gabble_capability_set_update (cap_set, add_set);
   gabble_capability_set_exclude (cap_set, remove_set);
 
-  DEBUG ("caps to add: %x", capabilities_parse (add_set));
-  DEBUG ("caps to remove: %x", capabilities_parse (remove_set));
-  DEBUG ("caps after: %x", capabilities_parse (cap_set));
+  if (DEBUGGING)
+    {
+      gchar *add_str = gabble_capability_set_dump (add_set, "  ");
+      gchar *remove_str = gabble_capability_set_dump (remove_set, "  ");
+
+      DEBUG ("caps to add:\n%s", add_str);
+      DEBUG ("caps to remove:\n%s", remove_str);
+      g_free (add_str);
+      g_free (remove_str);
+    }
 
   gabble_capability_set_free (add_set);
   gabble_capability_set_free (remove_set);
diff --git a/src/presence-cache.c b/src/presence-cache.c
index 86e6a48..aba0faa 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -1181,8 +1181,16 @@ _process_caps (GabblePresenceCache *cache,
     {
       GabbleCapabilitySet *new_cap_set = gabble_presence_dup_caps (presence);
 
-      DEBUG ("Emitting caps update: handle %u, old %u, new %u",
-          handle, old_caps, gabble_presence_get_caps_bitfield (presence));
+      if (DEBUGGING)
+        {
+          gchar *old_dump = gabble_capability_set_dump (old_cap_set, "  ");
+          gchar *new_dump = gabble_capability_set_dump (new_cap_set, "  ");
+
+          DEBUG ("Emitting caps update for handle %u, from:\n%sto:\n%s",
+              handle, old_dump, new_dump);
+          g_free (old_dump);
+          g_free (new_dump);
+        }
 
       emit_capabilities_update (cache, handle, old_cap_set, new_cap_set);
 
@@ -1190,8 +1198,7 @@ _process_caps (GabblePresenceCache *cache,
     }
   else
     {
-      DEBUG ("No change in caps %u for handle %u, not updating",
-          gabble_presence_get_caps_bitfield (presence), handle);
+      DEBUG ("No change in caps for handle %u, not updating", handle);
     }
 
   if (old_cap_set != NULL)
-- 
1.5.6.5




More information about the telepathy-commits mailing list