[telepathy-gabble/master] gabble_presence_set_capabilities: stop taking old bitfield as argument

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


---
 src/connection.c      |   10 ++++------
 src/presence-cache.c  |   16 ++++++----------
 src/presence.c        |   24 ++++++++++++++++++------
 src/presence.h        |    1 -
 tests/test-presence.c |    6 ++----
 5 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 15b20ba..de46a2f 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2060,7 +2060,6 @@ connection_auth_cb (LmConnection *lmconn,
   GabbleConnectionPrivate *priv = conn->priv;
   GError *error = NULL;
   const gchar *jid;
-  GabblePresenceCapabilities caps;
   const GabbleCapabilitySet *cap_set;
 
   if (base->status != TP_CONNECTION_STATUS_CONNECTING)
@@ -2124,9 +2123,8 @@ connection_auth_cb (LmConnection *lmconn,
 
   /* set initial capabilities */
   cap_set = gabble_capabilities_get_initial_caps ();
-  caps = capabilities_parse (cap_set);
   gabble_presence_set_capabilities (conn->self_presence, priv->resource,
-      cap_set, caps, priv->caps_serial++);
+      cap_set, priv->caps_serial++);
 
   if (!gabble_disco_request_with_timeout (conn->disco, GABBLE_DISCO_TYPE_INFO,
                                           priv->stream_server, NULL,
@@ -2506,7 +2504,7 @@ gabble_connection_advertise_capabilities (TpSvcConnectionInterfaceCapabilities *
     {
       DEBUG ("before != after, changing");
       gabble_presence_set_capabilities (pres, priv->resource, cap_set,
-          capabilities_parse (cap_set), priv->caps_serial++);
+          priv->caps_serial++);
     }
 
   ret = g_ptr_array_new ();
@@ -2603,7 +2601,7 @@ gabble_connection_set_self_capabilities (
     }
 
   gabble_presence_set_capabilities (pres, priv->resource, new_caps,
-      gabble_presence_get_caps_bitfield (pres), priv->caps_serial++);
+      priv->caps_serial++);
 
   if (_gabble_connection_signal_own_presence (self, &error))
     {
@@ -3287,7 +3285,7 @@ gabble_connection_ensure_capabilities (GabbleConnection *self,
   cap_set = gabble_presence_dup_caps (self->self_presence);
   gabble_capability_set_update (cap_set, ensured);
   gabble_presence_set_capabilities (self->self_presence, priv->resource,
-      cap_set, capabilities_parse (cap_set), priv->caps_serial++);
+      cap_set, priv->caps_serial++);
   gabble_capability_set_free (cap_set);
 
   if (!_gabble_connection_signal_own_presence (self, &error))
diff --git a/src/presence-cache.c b/src/presence-cache.c
index d83b30e..52593a8 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -252,7 +252,6 @@ capability_info_recvd (GabblePresenceCache *cache,
     const gchar *node,
     TpHandle handle,
     GabbleCapabilitySet *cap_set,
-    GabblePresenceCapabilities caps,
     guint trust_inc)
 {
   CapabilityInfo *info = capability_info_get (cache, node);
@@ -855,7 +854,6 @@ static void
 set_caps_for (DiscoWaiter *waiter,
     GabblePresenceCache *cache,
     GabbleCapabilitySet *cap_set,
-    GabblePresenceCapabilities caps,
     TpHandle responder_handle,
     const gchar *responder_jid)
 {
@@ -874,7 +872,7 @@ set_caps_for (DiscoWaiter *waiter,
       waiter->handle, responder_handle, responder_jid);
 
   gabble_presence_set_capabilities (presence, waiter->resource, cap_set,
-      caps, waiter->serial);
+      waiter->serial);
 
   new_cap_set = gabble_presence_dup_caps (presence);
 
@@ -906,7 +904,6 @@ _caps_disco_cb (GabbleDisco *disco,
   GabblePresenceCachePrivate *priv;
   TpHandleRepoIface *contact_repo;
   GabbleCapabilitySet *cap_set;
-  GabblePresenceCapabilities caps = 0;
   guint trust;
   TpHandle handle = 0;
   gboolean bad_hash = FALSE;
@@ -952,7 +949,6 @@ _caps_disco_cb (GabbleDisco *disco,
     }
 
   cap_set = gabble_capability_set_new_from_stanza (query_result);
-  caps = capabilities_parse (cap_set);
 
   /* Only 'sha-1' is mandatory to implement by XEP-0115. If the remote contact
    * uses another hash algorithm, don't check the hash and fallback to the old
@@ -967,7 +963,7 @@ _caps_disco_cb (GabbleDisco *disco,
 
       if (g_str_equal (waiter_self->ver, computed_hash))
         {
-          trust = capability_info_recvd (cache, node, handle, cap_set, caps,
+          trust = capability_info_recvd (cache, node, handle, cap_set,
               CAPABILITY_BUNDLE_ENOUGH_TRUST);
         }
       else
@@ -983,7 +979,7 @@ _caps_disco_cb (GabbleDisco *disco,
     }
   else
     {
-      trust = capability_info_recvd (cache, node, handle, cap_set, caps, 1);
+      trust = capability_info_recvd (cache, node, handle, cap_set, 1);
     }
 
   if (trust >= CAPABILITY_BUNDLE_ENOUGH_TRUST)
@@ -993,7 +989,7 @@ _caps_disco_cb (GabbleDisco *disco,
         {
           DiscoWaiter *waiter = (DiscoWaiter *) i->data;
 
-          set_caps_for (waiter, cache, cap_set, caps, handle, jid);
+          set_caps_for (waiter, cache, cap_set, handle, jid);
           emit_capabilities_discovered (cache, waiter->handle);
         }
 
@@ -1012,7 +1008,7 @@ _caps_disco_cb (GabbleDisco *disco,
        *       for the jid that answered the query.
        */
       if (!bad_hash)
-        set_caps_for (waiter_self, cache, cap_set, caps, handle, jid);
+        set_caps_for (waiter_self, cache, cap_set, handle, jid);
 
       waiters = g_slist_remove (waiters, waiter_self);
 
@@ -1088,7 +1084,7 @@ _process_caps_uri (GabblePresenceCache *cache,
       if (presence)
         {
           gabble_presence_set_capabilities (presence, resource, info->cap_set,
-              capabilities_parse (info->cap_set), serial);
+              serial);
         }
       else
         {
diff --git a/src/presence.c b/src/presence.c
index 914da10..8e9c607 100644
--- a/src/presence.c
+++ b/src/presence.c
@@ -223,7 +223,6 @@ void
 gabble_presence_set_capabilities (GabblePresence *presence,
                                   const gchar *resource,
                                   const GabbleCapabilitySet *cap_set,
-                                  GabblePresenceCapabilities caps,
                                   guint serial)
 {
   GabblePresencePrivate *priv = GABBLE_PRESENCE_PRIV (presence);
@@ -245,13 +244,26 @@ gabble_presence_set_capabilities (GabblePresence *presence,
 
   if (resource == NULL)
     {
-      DEBUG ("adding caps %u to bare jid", caps);
+      if (DEBUGGING)
+        {
+          gchar *tmp = gabble_capability_set_dump (cap_set, "  ");
+
+          DEBUG ("Setting capabilities for bare JID:\n%s", tmp);
+          g_free (tmp);
+        }
+
       gabble_capability_set_update (priv->cap_set, cap_set);
       return;
     }
 
-  DEBUG ("about to add caps %u to resource %s with serial %u", caps, resource,
-    serial);
+  if (DEBUGGING)
+    {
+      gchar *tmp = gabble_capability_set_dump (cap_set, "  ");
+
+      DEBUG ("about to add caps to resource %s with serial %u:\n%s", resource,
+          serial, tmp);
+      g_free (tmp);
+    }
 
   for (i = priv->resources; NULL != i; i = i->next)
     {
@@ -271,7 +283,7 @@ gabble_presence_set_capabilities (GabblePresence *presence,
 
           if (serial >= tmp->caps_serial)
             {
-              DEBUG ("adding caps %u to resource %s", caps, resource);
+              DEBUG ("adding caps to resource %s", resource);
 
               gabble_capability_set_update (tmp->cap_set, cap_set);
             }
@@ -284,7 +296,7 @@ gabble_presence_set_capabilities (GabblePresence *presence,
     {
       gchar *tmp = gabble_capability_set_dump (priv->cap_set, "  ");
 
-      DEBUG ("Capabilities are now:\n%s", tmp);
+      DEBUG ("Aggregate capabilities are now:\n%s", tmp);
       g_free (tmp);
     }
 }
diff --git a/src/presence.h b/src/presence.h
index 76faf51..6a7a537 100644
--- a/src/presence.h
+++ b/src/presence.h
@@ -81,7 +81,6 @@ gboolean gabble_presence_update (GabblePresence *presence,
 void gabble_presence_set_capabilities (GabblePresence *presence,
     const gchar *resource,
     const GabbleCapabilitySet *cap_set,
-    GabblePresenceCapabilities caps,
     guint serial);
 
 GabblePresenceCapabilities gabble_presence_get_caps_bitfield (
diff --git a/tests/test-presence.c b/tests/test-presence.c
index 9950a5f..9d224ff 100644
--- a/tests/test-presence.c
+++ b/tests/test-presence.c
@@ -121,8 +121,7 @@ int main (int argc, char **argv)
   g_assert (FALSE == gabble_presence_update (presence, "bar",
     GABBLE_PRESENCE_AVAILABLE, "dingoes", -1));
   cap_set = gabble_capability_set_new_from_flags (PRESENCE_CAP_GOOGLE_VOICE);
-  gabble_presence_set_capabilities (presence, "bar", cap_set,
-      PRESENCE_CAP_GOOGLE_VOICE, 0);
+  gabble_presence_set_capabilities (presence, "bar", cap_set, 0);
   gabble_capability_set_free (cap_set);
 
   /* no resource with non-negative priority has the Google voice cap */
@@ -132,8 +131,7 @@ int main (int argc, char **argv)
 
   /* give voice cap to first resource */
   cap_set = gabble_capability_set_new_from_flags (PRESENCE_CAP_GOOGLE_VOICE);
-  gabble_presence_set_capabilities (presence, "foo", cap_set,
-      PRESENCE_CAP_GOOGLE_VOICE, 0);
+  gabble_presence_set_capabilities (presence, "foo", cap_set, 0);
   gabble_capability_set_free (cap_set);
 
   /* resource has voice cap */
-- 
1.5.6.5




More information about the telepathy-commits mailing list