[telepathy-gabble/master] Remove gabble_capability_set_new_from_flags

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


---
 src/capabilities.c    |   31 ++++++++-----------------------
 src/capabilities.h    |    2 --
 tests/test-presence.c |    6 ++++--
 3 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/src/capabilities.c b/src/capabilities.c
index 9a1b147..211476d 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -239,9 +239,14 @@ gabble_capabilities_init (GabbleConnection *conn)
             gabble_capability_set_add (initial_caps, feat->ns);
         }
 
-      geoloc_caps = gabble_capability_set_new_from_flags (
-          PRESENCE_CAP_GEOLOCATION);
-      olpc_caps = gabble_capability_set_new_from_flags (PRESENCE_CAP_OLPC_1);
+      geoloc_caps = gabble_capability_set_new ();
+      gabble_capability_set_add (geoloc_caps, NS_GEOLOC "+notify");
+
+      olpc_caps = gabble_capability_set_new ();
+      gabble_capability_set_add (olpc_caps, NS_OLPC_BUDDY_PROPS "+notify");
+      gabble_capability_set_add (olpc_caps, NS_OLPC_ACTIVITIES "+notify");
+      gabble_capability_set_add (olpc_caps, NS_OLPC_CURRENT_ACTIVITY "+notify");
+      gabble_capability_set_add (olpc_caps, NS_OLPC_ACTIVITY_PROPS "+notify");
     }
 
   g_assert (feature_handles != NULL);
@@ -362,26 +367,6 @@ gabble_capability_set_new_from_stanza (LmMessageNode *query_result)
   return ret;
 }
 
-/* This function should disappear when GabbleCapabilitySet replaces
- * GabblePresenceCapabilities.
- */
-GabbleCapabilitySet *
-gabble_capability_set_new_from_flags (GabblePresenceCapabilities caps)
-{
-  GabbleCapabilitySet *ret = gabble_capability_set_new ();
-  const Feature *i;
-
-  for (i = self_advertised_features; NULL != i->ns; i++)
-    if ((i->caps & caps) == i->caps)
-      gabble_capability_set_add (ret, i->ns);
-
-  for (i = quirks; NULL != i->ns; i++)
-    if ((i->caps & caps) == i->caps)
-      gabble_capability_set_add (ret, i->ns);
-
-  return ret;
-}
-
 GabbleCapabilitySet *
 gabble_capability_set_copy (const GabbleCapabilitySet *caps)
 {
diff --git a/src/capabilities.h b/src/capabilities.h
index ed94979..8492bdf 100644
--- a/src/capabilities.h
+++ b/src/capabilities.h
@@ -57,8 +57,6 @@ typedef struct _GabbleCapabilitySet GabbleCapabilitySet;
 GabbleCapabilitySet *gabble_capability_set_new (void);
 GabbleCapabilitySet *gabble_capability_set_new_from_stanza (
     LmMessageNode *query_result);
-GabbleCapabilitySet *gabble_capability_set_new_from_flags (
-    GabblePresenceCapabilities caps);
 GabbleCapabilitySet *gabble_capability_set_copy (
     const GabbleCapabilitySet *caps);
 void gabble_capability_set_update (GabbleCapabilitySet *target,
diff --git a/tests/test-presence.c b/tests/test-presence.c
index 9d224ff..4da4577 100644
--- a/tests/test-presence.c
+++ b/tests/test-presence.c
@@ -120,7 +120,8 @@ int main (int argc, char **argv)
   /* give voice cap to second resource, but make priority negative */
   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);
+  cap_set = gabble_capability_set_new ();
+  gabble_capability_set_add (cap_set, NS_GOOGLE_FEAT_VOICE);
   gabble_presence_set_capabilities (presence, "bar", cap_set, 0);
   gabble_capability_set_free (cap_set);
 
@@ -130,7 +131,8 @@ int main (int argc, char **argv)
   g_assert (NULL == resource);
 
   /* give voice cap to first resource */
-  cap_set = gabble_capability_set_new_from_flags (PRESENCE_CAP_GOOGLE_VOICE);
+  cap_set = gabble_capability_set_new ();
+  gabble_capability_set_add (cap_set, NS_GOOGLE_FEAT_VOICE);
   gabble_presence_set_capabilities (presence, "foo", cap_set, 0);
   gabble_capability_set_free (cap_set);
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list