[telepathy-gabble/master] Remove now-redundant GabbleCapsChannelManager code

Will Thompson will.thompson at collabora.co.uk
Tue Sep 8 04:10:05 PDT 2009


Conflicts: src/presence.c src/presence-cache.c
Merged-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
---
 src/caps-channel-manager.c  |   99 -----------------
 src/caps-channel-manager.h  |   54 ----------
 src/connection.c            |   12 +-
 src/ft-manager.c            |   27 -----
 src/presence-cache.c        |   72 +------------
 src/presence-cache.h        |   15 ---
 src/presence.c              |   54 ----------
 src/presence.h              |    2 -
 src/private-tubes-factory.c |  244 -------------------------------------------
 tests/test-presence.c       |    4 +-
 10 files changed, 10 insertions(+), 573 deletions(-)

diff --git a/src/caps-channel-manager.c b/src/caps-channel-manager.c
index 7ac167a..e2182c2 100644
--- a/src/caps-channel-manager.c
+++ b/src/caps-channel-manager.c
@@ -78,105 +78,6 @@ gabble_caps_channel_manager_get_contact_capabilities (
   /* ... else assume there is not caps for this kind of channels */
 }
 
-void gabble_caps_channel_manager_get_feature_list (
-    GabbleCapsChannelManager *caps_manager,
-    gpointer specific_caps,
-    GSList **features)
-{
-  GabbleCapsChannelManagerIface *iface =
-    GABBLE_CAPS_CHANNEL_MANAGER_GET_INTERFACE (caps_manager);
-  GabbleCapsChannelManagerGetFeatureListFunc method = iface->get_feature_list;
-
-  if (method != NULL)
-    {
-      method (caps_manager, specific_caps, features);
-    }
-  /* ... else nothing to do */
-}
-
-gpointer gabble_caps_channel_manager_parse_capabilities (
-    GabbleCapsChannelManager *caps_manager,
-    GabbleCapabilitySet *cap_set)
-{
-  GabbleCapsChannelManagerIface *iface =
-    GABBLE_CAPS_CHANNEL_MANAGER_GET_INTERFACE (caps_manager);
-  GabbleCapsChannelManagerParseCapsFunc method = iface->parse_caps;
-
-  if (method != NULL)
-    {
-      return method (caps_manager, cap_set);
-    }
-  /* ... else assume there is not caps for this kind of channels */
-  return NULL;
-}
-
-void gabble_caps_channel_manager_free_capabilities (
-    GabbleCapsChannelManager *caps_manager,
-    gpointer specific_caps)
-{
-  GabbleCapsChannelManagerIface *iface =
-    GABBLE_CAPS_CHANNEL_MANAGER_GET_INTERFACE (caps_manager);
-  GabbleCapsChannelManagerFreeCapsFunc method = iface->free_caps;
-
-  if (method != NULL)
-    {
-      method (caps_manager, specific_caps);
-    }
-  /* ... else assume there is no need to free */
-}
-
-void gabble_caps_channel_manager_copy_capabilities (
-    GabbleCapsChannelManager *caps_manager,
-    gpointer *specific_caps_out,
-    gpointer specific_caps_in)
-{
-  GabbleCapsChannelManagerIface *iface =
-    GABBLE_CAPS_CHANNEL_MANAGER_GET_INTERFACE (caps_manager);
-  GabbleCapsChannelManagerCopyCapsFunc method = iface->copy_caps;
-
-  if (method != NULL)
-    {
-      method (caps_manager, specific_caps_out, specific_caps_in);
-    }
-  else
-    *specific_caps_out = NULL;
-}
-
-void gabble_caps_channel_manager_update_capabilities (
-    GabbleCapsChannelManager *caps_manager,
-    gpointer specific_caps_out,
-    gpointer specific_caps_in)
-{
-  GabbleCapsChannelManagerIface *iface =
-    GABBLE_CAPS_CHANNEL_MANAGER_GET_INTERFACE (caps_manager);
-  GabbleCapsChannelManagerUpdateCapsFunc method = iface->update_caps;
-
-  /* cannot be called if not implemented */
-  if (method != NULL)
-    method (caps_manager, specific_caps_out, specific_caps_in);
-  else
-    DEBUG (":'( No caps update function");
-}
-
-gboolean gabble_caps_channel_manager_capabilities_diff (
-    GabbleCapsChannelManager *caps_manager,
-    TpHandle handle,
-    gpointer specific_old_caps,
-    gpointer specific_new_caps)
-{
-  GabbleCapsChannelManagerIface *iface =
-    GABBLE_CAPS_CHANNEL_MANAGER_GET_INTERFACE (caps_manager);
-  GabbleCapsChannelManagerCapsDiffFunc method = iface->caps_diff;
-
-  if (method != NULL)
-    {
-      return method (caps_manager, handle, specific_old_caps,
-          specific_new_caps);
-    }
-  /* ... else, nothing to do */
-  return FALSE;
-}
-
 /**
  * gabble_caps_channel_manager_add_capability:
  * @cap: the Telepathy-level capability to add
diff --git a/src/caps-channel-manager.h b/src/caps-channel-manager.h
index 340cf7e..dd04155 100644
--- a/src/caps-channel-manager.h
+++ b/src/caps-channel-manager.h
@@ -54,7 +54,6 @@ typedef struct _GabbleCapsChannelManagerIface GabbleCapsChannelManagerIface;
 
 /* virtual methods */
 
-/* May be moved to TpChannelManager later */
 typedef void (*GabbleCapsChannelManagerGetContactCapsFunc) (
     GabbleCapsChannelManager *manager,
     TpHandle handle,
@@ -66,58 +65,12 @@ typedef void (*GabbleCapsChannelManagerAddCapFunc) (
     GHashTable *cap,
     GabbleCapabilitySet *cap_set);
 
-/* Specific to Gabble */
-typedef void (*GabbleCapsChannelManagerGetFeatureListFunc) (
-    GabbleCapsChannelManager *manager, gpointer specific_caps,
-    GSList **features);
-
-typedef gpointer (*GabbleCapsChannelManagerParseCapsFunc) (
-    GabbleCapsChannelManager *manager, GabbleCapabilitySet *cap_set);
-
-typedef void (*GabbleCapsChannelManagerFreeCapsFunc) (
-    GabbleCapsChannelManager *manager, gpointer specific_caps);
-
-typedef void (*GabbleCapsChannelManagerCopyCapsFunc) (
-    GabbleCapsChannelManager *manager, gpointer *specific_caps_out,
-    gpointer specific_caps_in);
-
-typedef void (*GabbleCapsChannelManagerUpdateCapsFunc) (
-    GabbleCapsChannelManager *manager, gpointer specific_caps_out,
-    gpointer specific_caps_in);
-
-typedef gboolean (*GabbleCapsChannelManagerCapsDiffFunc) (
-    GabbleCapsChannelManager *manager, TpHandle handle,
-    gpointer specific_old_caps, gpointer specific_new_caps);
-
-
 void gabble_caps_channel_manager_get_contact_capabilities (
     GabbleCapsChannelManager *caps_manager,
     TpHandle handle,
     const GabbleCapabilitySet *caps,
     GPtrArray *arr);
 
-void gabble_caps_channel_manager_get_feature_list (
-    GabbleCapsChannelManager *manager, gpointer specific_caps,
-    GSList **features);
-
-gpointer gabble_caps_channel_manager_parse_capabilities (
-    GabbleCapsChannelManager *manager,
-    GabbleCapabilitySet *cap_set);
-
-void gabble_caps_channel_manager_free_capabilities (GabbleCapsChannelManager *manager,
-    gpointer specific_caps);
-
-void gabble_caps_channel_manager_copy_capabilities (GabbleCapsChannelManager *manager,
-    gpointer *specific_caps_out, gpointer specific_caps_in);
-
-void gabble_caps_channel_manager_update_capabilities (
-    GabbleCapsChannelManager *manager, gpointer specific_caps_out,
-    gpointer specific_caps_in);
-
-gboolean gabble_caps_channel_manager_capabilities_diff (
-    GabbleCapsChannelManager *manager, TpHandle handle,
-    gpointer specific_old_caps, gpointer specific_new_caps);
-
 void gabble_caps_channel_manager_add_capability (
     GabbleCapsChannelManager *caps_manager,
     GHashTable *cap,
@@ -129,13 +82,6 @@ struct _GabbleCapsChannelManagerIface {
     GabbleCapsChannelManagerGetContactCapsFunc get_contact_caps;
     GabbleCapsChannelManagerAddCapFunc add_cap;
 
-    GabbleCapsChannelManagerGetFeatureListFunc get_feature_list;
-    GabbleCapsChannelManagerParseCapsFunc parse_caps;
-    GabbleCapsChannelManagerFreeCapsFunc free_caps;
-    GabbleCapsChannelManagerCopyCapsFunc copy_caps;
-    GabbleCapsChannelManagerUpdateCapsFunc update_caps;
-    GabbleCapsChannelManagerCapsDiffFunc caps_diff;
-
     GCallback _future[8];
     gpointer priv;
 };
diff --git a/src/connection.c b/src/connection.c
index bf83118..4d3c576 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2122,7 +2122,7 @@ connection_auth_cb (LmConnection *lmconn,
   caps = capabilities_get_initial_caps ();
   cap_set = gabble_capability_set_new_from_flags (caps);
   gabble_presence_set_capabilities (conn->self_presence, priv->resource,
-      cap_set, caps, NULL, priv->caps_serial++);
+      cap_set, caps, priv->caps_serial++);
   gabble_capability_set_free (cap_set);
 
   if (!gabble_disco_request_with_timeout (conn->disco, GABBLE_DISCO_TYPE_INFO,
@@ -2499,7 +2499,7 @@ gabble_connection_advertise_capabilities (TpSvcConnectionInterfaceCapabilities *
     {
       DEBUG ("before != after, changing");
       cap_set = gabble_capability_set_new_from_flags (caps);
-      gabble_presence_set_capabilities (pres, priv->resource, cap_set, caps, NULL,
+      gabble_presence_set_capabilities (pres, priv->resource, cap_set, caps,
           priv->caps_serial++);
       gabble_capability_set_free (cap_set);
       DEBUG ("set caps: %x", pres->caps);
@@ -2594,8 +2594,8 @@ gabble_connection_set_self_capabilities (
         }
     }
 
-  gabble_presence_set_capabilities (pres, priv->resource, new_caps,
-      pres->caps, NULL, priv->caps_serial++);
+  gabble_presence_set_capabilities (pres, priv->resource, new_caps, pres->caps,
+      priv->caps_serial++);
 
   if (_gabble_connection_signal_own_presence (self, &error))
     {
@@ -3277,8 +3277,8 @@ gabble_connection_ensure_capabilities (GabbleConnection *self,
       GError *error = NULL;
 
       cap_set = gabble_capability_set_new_from_flags (caps);
-      gabble_presence_set_capabilities (self->self_presence,
-          priv->resource, cap_set, new_caps, NULL, priv->caps_serial++);
+      gabble_presence_set_capabilities (self->self_presence, priv->resource,
+          cap_set, new_caps, priv->caps_serial++);
       gabble_capability_set_free (cap_set);
 
       if (!_gabble_connection_signal_own_presence (self, &error))
diff --git a/src/ft-manager.c b/src/ft-manager.c
index 13abe9c..87338a3 100644
--- a/src/ft-manager.c
+++ b/src/ft-manager.c
@@ -656,30 +656,6 @@ gabble_ft_manager_get_contact_caps (GabbleCapsChannelManager *manager,
     add_file_transfer_channel_class (arr, handle);
 }
 
-static gpointer
-gabble_ft_manager_parse_caps (GabbleCapsChannelManager *manager,
-    GabbleCapabilitySet *cap_set)
-{
-  return GINT_TO_POINTER (gabble_capability_set_has (cap_set, NS_FILE_TRANSFER));
-}
-
-static void
-gabble_ft_manager_copy_caps (GabbleCapsChannelManager *manager,
-                             gpointer *specific_caps_out,
-                             gpointer specific_caps_in)
-{
-  *specific_caps_out = specific_caps_in;
-}
-
-static gboolean
-gabble_ft_manager_caps_diff (GabbleCapsChannelManager *manager,
-                             TpHandle handle,
-                             gpointer specific_old_caps,
-                             gpointer specific_new_caps)
-{
-  return specific_old_caps != specific_new_caps;
-}
-
 static void
 caps_channel_manager_iface_init (gpointer g_iface,
                                  gpointer iface_data)
@@ -687,7 +663,4 @@ caps_channel_manager_iface_init (gpointer g_iface,
   GabbleCapsChannelManagerIface *iface = g_iface;
 
   iface->get_contact_caps = gabble_ft_manager_get_contact_caps;
-  iface->parse_caps = gabble_ft_manager_parse_caps;
-  iface->copy_caps = gabble_ft_manager_copy_caps;
-  iface->caps_diff = gabble_ft_manager_caps_diff;
 }
diff --git a/src/presence-cache.c b/src/presence-cache.c
index 94dbb30..ad131f8 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -747,74 +747,6 @@ _parse_cap_bundles (
   return uris;
 }
 
-static void
-free_caps_helper (gpointer key, gpointer value, gpointer user_data)
-{
-  GabbleCapsChannelManager *manager = GABBLE_CAPS_CHANNEL_MANAGER (key);
-  gabble_caps_channel_manager_free_capabilities (manager, value);
-}
-
-void
-gabble_presence_cache_free_cache_entry (
-    GHashTable *per_channel_manager_caps)
-{
-  if (per_channel_manager_caps == NULL)
-    return;
-
-  g_hash_table_foreach (per_channel_manager_caps, free_caps_helper,
-      NULL);
-  g_hash_table_destroy (per_channel_manager_caps);
-}
-
-static void
-copy_caps_helper (gpointer key, gpointer value, gpointer user_data)
-{
-  GHashTable *table_out = user_data;
-  GabbleCapsChannelManager *manager = GABBLE_CAPS_CHANNEL_MANAGER (key);
-  gpointer out;
-  gabble_caps_channel_manager_copy_capabilities (manager, &out, value);
-  g_hash_table_insert (table_out, key, out);
-}
-
-void
-gabble_presence_cache_copy_cache_entry (
-    GHashTable **out, GHashTable *in)
-{
-  *out = g_hash_table_new (NULL, NULL);
-  if (in != NULL)
-    g_hash_table_foreach (in, copy_caps_helper,
-        *out);
-}
-
-static void
-update_caps_helper (gpointer key, gpointer value, gpointer user_data)
-{
-  GHashTable *table_out = user_data;
-  GabbleCapsChannelManager *manager = GABBLE_CAPS_CHANNEL_MANAGER (key);
-  gpointer out;
-
-  out = g_hash_table_lookup (table_out, key);
-  if (out == NULL)
-    {
-      gabble_caps_channel_manager_copy_capabilities (manager, &out, value);
-      g_hash_table_insert (table_out, key, out);
-    }
-  else
-    {
-      gabble_caps_channel_manager_update_capabilities (manager, out, value);
-    }
-}
-
-void
-gabble_presence_cache_update_cache_entry (
-    GHashTable *out, GHashTable *in)
-{
-  g_return_if_fail (out != NULL);
-
-  if (in != NULL)
-    g_hash_table_foreach (in, update_caps_helper, out);
-}
-
 static void _caps_disco_cb (GabbleDisco *disco,
     GabbleDiscoRequest *request,
     const gchar *jid,
@@ -942,7 +874,7 @@ set_caps_for (DiscoWaiter *waiter,
       waiter->handle, responder_handle, responder_jid, caps, save_caps);
 
   gabble_presence_set_capabilities (presence, waiter->resource, cap_set,
-      caps, NULL, waiter->serial);
+      caps, waiter->serial);
 
   DEBUG ("caps for %d now %d", waiter->handle, presence->caps);
 
@@ -1151,7 +1083,7 @@ _process_caps_uri (GabblePresenceCache *cache,
       if (presence)
         {
           gabble_presence_set_capabilities (presence, resource, info->cap_set,
-              info->caps, NULL, serial);
+              info->caps, serial);
           DEBUG ("caps for %d (%s) now %d", handle, from, presence->caps);
         }
       else
diff --git a/src/presence-cache.h b/src/presence-cache.h
index 0c832d3..1a9fd82 100644
--- a/src/presence-cache.h
+++ b/src/presence-cache.h
@@ -85,21 +85,6 @@ void gabble_presence_cache_add_bundle_caps (GabblePresenceCache *cache,
 void gabble_presence_cache_really_remove (GabblePresenceCache *cache,
     TpHandle handle);
 
-/* loop on CapabilityInfo::per_channel_manager_caps and call
- * gabble_caps_channel_manager_free_capabilities */
-void gabble_presence_cache_free_cache_entry (
-    GHashTable *per_channel_manager_caps);
-
-/* loop on CapabilityInfo::per_channel_manager_caps and call
- * gabble_caps_channel_manager_copy_capabilities */
-void gabble_presence_cache_copy_cache_entry (GHashTable **out,
-    GHashTable *in);
-
-/* loop on CapabilityInfo::per_channel_manager_caps and call
- * gabble_caps_channel_manager_update_capabilities */
-void gabble_presence_cache_update_cache_entry (GHashTable *out,
-    GHashTable *in);
-
 void gabble_presence_cache_contacts_added_to_olpc_view (
     GabblePresenceCache *cache, TpHandleSet *handles);
 
diff --git a/src/presence.c b/src/presence.c
index ace8bd0..4ce88c5 100644
--- a/src/presence.c
+++ b/src/presence.c
@@ -43,7 +43,6 @@ struct _Resource {
     gchar *name;
     GabbleCapabilitySet *cap_set;
     GabblePresenceCapabilities caps;
-    GHashTable *per_channel_manager_caps;
     guint caps_serial;
     GabblePresenceId status;
     gchar *status_message;
@@ -67,7 +66,6 @@ _resource_new (gchar *name)
   new->name = name;
   new->cap_set = gabble_capability_set_new ();
   new->caps = PRESENCE_CAP_NONE;
-  new->per_channel_manager_caps = NULL;
   new->status = GABBLE_PRESENCE_OFFLINE;
   new->status_message = NULL;
   new->priority = 0;
@@ -84,13 +82,6 @@ _resource_free (Resource *resource)
   g_free (resource->status_message);
   gabble_capability_set_free (resource->cap_set);
 
-  if (resource->per_channel_manager_caps != NULL)
-    {
-      gabble_presence_cache_free_cache_entry
-        (resource->per_channel_manager_caps);
-      resource->per_channel_manager_caps = NULL;
-    }
-
   g_slice_free (Resource, resource);
 }
 
@@ -104,13 +95,6 @@ gabble_presence_finalize (GObject *object)
   for (i = priv->resources; NULL != i; i = i->next)
     _resource_free (i->data);
 
-  if (presence->per_channel_manager_caps != NULL)
-    {
-      gabble_presence_cache_free_cache_entry
-        (presence->per_channel_manager_caps);
-      presence->per_channel_manager_caps = NULL;
-    }
-
   g_slist_free (priv->resources);
   gabble_capability_set_free (priv->cap_set);
 
@@ -232,7 +216,6 @@ gabble_presence_set_capabilities (GabblePresence *presence,
                                   const gchar *resource,
                                   GabbleCapabilitySet *cap_set,
                                   GabblePresenceCapabilities caps,
-                                  GHashTable *per_channel_manager_caps,
                                   guint serial)
 {
   GabblePresencePrivate *priv = GABBLE_PRESENCE_PRIV (presence);
@@ -253,21 +236,11 @@ gabble_presence_set_capabilities (GabblePresence *presence,
   presence->caps = 0;
   gabble_capability_set_clear (priv->cap_set);
 
-  if (presence->per_channel_manager_caps != NULL)
-    {
-      gabble_presence_cache_free_cache_entry
-        (presence->per_channel_manager_caps);
-      presence->per_channel_manager_caps = NULL;
-    }
-  presence->per_channel_manager_caps = g_hash_table_new (NULL, NULL);
-
   if (resource == NULL)
     {
       DEBUG ("adding caps %u to bare jid", caps);
       presence->caps = caps;
       gabble_capability_set_update (priv->cap_set, cap_set);
-      gabble_presence_cache_update_cache_entry (
-          presence->per_channel_manager_caps, per_channel_manager_caps);
       return;
     }
 
@@ -298,26 +271,11 @@ gabble_presence_set_capabilities (GabblePresence *presence,
               DEBUG ("resource %s caps now %u", resource, tmp->caps);
 
               gabble_capability_set_update (tmp->cap_set, cap_set);
-
-              if (tmp->per_channel_manager_caps != NULL)
-                {
-                  gabble_presence_cache_free_cache_entry
-                      (tmp->per_channel_manager_caps);
-                  tmp->per_channel_manager_caps = NULL;
-                }
-              if (per_channel_manager_caps != NULL)
-                gabble_presence_cache_copy_cache_entry
-                    (&tmp->per_channel_manager_caps, per_channel_manager_caps);
             }
         }
 
       presence->caps |= tmp->caps;
       gabble_capability_set_update (priv->cap_set, tmp->cap_set);
-
-      if (tmp->per_channel_manager_caps != NULL)
-        gabble_presence_cache_update_cache_entry
-            (presence->per_channel_manager_caps,
-             tmp->per_channel_manager_caps);
     }
 
   DEBUG ("total caps now %u", presence->caps);
@@ -435,13 +393,6 @@ gabble_presence_update (GabblePresence *presence,
           res = NULL;
 
           /* recalculate aggregate capability mask */
-          if (presence->per_channel_manager_caps != NULL)
-            {
-              gabble_presence_cache_free_cache_entry
-                (presence->per_channel_manager_caps);
-              presence->per_channel_manager_caps = NULL;
-            }
-          presence->per_channel_manager_caps = g_hash_table_new (NULL, NULL);
           presence->caps = 0;
           gabble_capability_set_clear (priv->cap_set);
 
@@ -451,11 +402,6 @@ gabble_presence_update (GabblePresence *presence,
 
               presence->caps |= r->caps;
               gabble_capability_set_update (priv->cap_set, r->cap_set);
-
-              if (r->per_channel_manager_caps != NULL)
-                gabble_presence_cache_update_cache_entry
-                    (presence->per_channel_manager_caps,
-                     r->per_channel_manager_caps);
             }
         }
     }
diff --git a/src/presence.h b/src/presence.h
index 6eee7ee..e3d89ea 100644
--- a/src/presence.h
+++ b/src/presence.h
@@ -57,7 +57,6 @@ typedef struct _GabblePresencePrivate GabblePresencePrivate;
 struct _GabblePresence {
     GObject parent;
     GabblePresenceCapabilities caps;
-    GHashTable *per_channel_manager_caps;
     GabblePresenceId status;
     gchar *status_message;
     gchar *nickname;
@@ -84,7 +83,6 @@ void gabble_presence_set_capabilities (GabblePresence *presence,
     const gchar *resource,
     GabbleCapabilitySet *cap_set,
     GabblePresenceCapabilities caps,
-    GHashTable *per_channel_manager_caps,
     guint serial);
 
 GabbleCapabilitySet *gabble_presence_get_caps (GabblePresence *presence);
diff --git a/src/private-tubes-factory.c b/src/private-tubes-factory.c
index c4e87bd..209cc0f 100644
--- a/src/private-tubes-factory.c
+++ b/src/private-tubes-factory.c
@@ -91,37 +91,6 @@ struct _GabblePrivateTubesFactoryPrivate
 
 #define GABBLE_PRIVATE_TUBES_FACTORY_GET_PRIVATE(obj) ((obj)->priv)
 
-typedef struct _TubesCapabilities TubesCapabilities;
-struct _TubesCapabilities
-{
-  /* Stores the list of tubes supported by a contact. We use a hash table. The
-   * key is the service name and the value is NULL.
-   *
-   * It can also be used to store the list of tubes that Gabble advertises to
-   * support when Gabble replies to XEP-0115 Entity Capabilities requests. In
-   * this case, a Feature structure is associated with each tube type in order
-   * to be returned by gabble_private_tubes_factory_get_feature_list().
-   *
-   * So the value of the hash table is either NULL (if the variable is related
-   * to a contact handle), or a Feature structure (if the variable is related
-   * to the self_handle).
-   */
-
-  /* gchar *Service -> NULL
-   *  or
-   * gchar *Service -> Feature *feature
-   */
-  GHashTable *stream_tube_caps;
-
-  /* gchar *ServiceName -> NULL
-   *  or
-   * gchar *ServiceName -> Feature *feature
-   */
-  GHashTable *dbus_tube_caps;
-
-  gboolean tubes_supported;
-};
-
 static const gchar * const tubes_channel_fixed_properties[] = {
     TP_IFACE_CHANNEL ".ChannelType",
     TP_IFACE_CHANNEL ".TargetHandleType",
@@ -584,213 +553,6 @@ gabble_private_tubes_factory_get_contact_caps (
 }
 
 static void
-gabble_private_tubes_factory_get_feature_list (
-    GabbleCapsChannelManager *manager,
-    gpointer specific_caps,
-    GSList **features)
-{
-  TubesCapabilities *caps = specific_caps;
-  GHashTableIter iter;
-  gpointer service;
-  gpointer feat;
-
-  g_hash_table_iter_init (&iter, caps->stream_tube_caps);
-  while (g_hash_table_iter_next (&iter, &service,
-        &feat))
-    {
-      *features = g_slist_append (*features, feat);
-    }
-
-  g_hash_table_iter_init (&iter, caps->dbus_tube_caps);
-  while (g_hash_table_iter_next (&iter, &service,
-        &feat))
-    {
-      *features = g_slist_append (*features, feat);
-    }
-}
-
-static void
-gabble_private_tubes_factory_free_feat (gpointer data)
-{
-  Feature *feat = (Feature *) data;
-
-  if (feat == NULL)
-    return;
-
-  if (feat->ns != NULL)
-    g_free (feat->ns);
-
-  g_free (feat);
-}
-
-static void
-examine_node (const gchar *var,
-    TubesCapabilities *caps)
-{
-  gchar *service;
-
-  if (!g_str_has_prefix (var, NS_TUBES))
-    return;
-
-  /* tubes generic cap or service specific */
-  caps->tubes_supported = TRUE;
-
-  if (g_str_has_prefix (var, NS_TUBES "/"))
-    {
-      /* http://telepathy.freedesktop.org/xmpp/tubes/$type#$service */
-      var += strlen (NS_TUBES "/");
-      if (g_str_has_prefix (var, "stream#"))
-        {
-          var += strlen ("stream#");
-          service = g_strdup (var);
-          g_hash_table_insert (caps->stream_tube_caps, service, NULL);
-        }
-      else if (g_str_has_prefix (var, "dbus#"))
-        {
-          var += strlen ("dbus#");
-          service = g_strdup (var);
-          g_hash_table_insert (caps->dbus_tube_caps, service, NULL);
-        }
-    }
-}
-
-static gpointer
-gabble_private_tubes_factory_parse_caps (
-    GabbleCapsChannelManager *manager,
-    GabbleCapabilitySet *cap_set)
-{
-  TubesCapabilities *caps = g_new0 (TubesCapabilities, 1);
-
-  caps->stream_tube_caps = g_hash_table_new_full (g_str_hash, g_str_equal,
-      g_free, gabble_private_tubes_factory_free_feat);
-  caps->dbus_tube_caps = g_hash_table_new_full (g_str_hash, g_str_equal,
-      g_free, gabble_private_tubes_factory_free_feat);
-
-  g_ptr_array_foreach (cap_set, (GFunc) examine_node, caps);
-
-  return caps;
-}
-
-static void
-gabble_private_tubes_factory_free_caps (
-    GabbleCapsChannelManager *manager,
-    gpointer data)
-{
- TubesCapabilities *caps = data;
- g_hash_table_destroy (caps->stream_tube_caps);
- g_hash_table_destroy (caps->dbus_tube_caps);
- g_free (caps);
-}
-
-static void
-copy_caps_helper (gpointer key, gpointer value, gpointer user_data)
-{
-  GHashTable *out = user_data;
-  gchar *str = key;
-
-  g_hash_table_insert (out, g_strdup (str), NULL);
-}
-
-static void
-gabble_private_tubes_factory_copy_caps (
-    GabbleCapsChannelManager *manager,
-    gpointer *specific_caps_out,
-    gpointer specific_caps_in)
-{
-  TubesCapabilities *caps_in = specific_caps_in;
-  TubesCapabilities *caps_out = g_new0 (TubesCapabilities, 1);
-
-  caps_out->stream_tube_caps = g_hash_table_new_full (g_str_hash, g_str_equal,
-      g_free, gabble_private_tubes_factory_free_feat);
-  g_hash_table_foreach (caps_in->stream_tube_caps, copy_caps_helper,
-      caps_out->stream_tube_caps);
-
-  caps_out->dbus_tube_caps = g_hash_table_new_full (g_str_hash, g_str_equal,
-      g_free, gabble_private_tubes_factory_free_feat);
-  g_hash_table_foreach (caps_in->dbus_tube_caps, copy_caps_helper,
-      caps_out->dbus_tube_caps);
-
-  caps_out->tubes_supported = caps_in->tubes_supported;
-
-  *specific_caps_out = caps_out;
-}
-
-static void
-gabble_private_tubes_factory_update_caps (
-    GabbleCapsChannelManager *manager,
-    gpointer specific_caps_out,
-    gpointer specific_caps_in)
-{
-  TubesCapabilities *caps_out = (TubesCapabilities *) specific_caps_out;
-  TubesCapabilities *caps_in = (TubesCapabilities *) specific_caps_in;
-
-  if (caps_in == NULL)
-    return;
-
-  tp_g_hash_table_update (caps_out->stream_tube_caps,
-      caps_in->stream_tube_caps, (GBoxedCopyFunc) g_strdup, NULL);
-  tp_g_hash_table_update (caps_out->dbus_tube_caps,
-      caps_in->dbus_tube_caps, (GBoxedCopyFunc) g_strdup, NULL);
-}
-
-static gboolean
-hash_table_is_subset (GHashTable *superset,
-                      GHashTable *subset)
-{
-  GHashTableIter iter;
-  gpointer look_for;
-
-  g_hash_table_iter_init (&iter, subset);
-  while (g_hash_table_iter_next (&iter, &look_for, NULL))
-    {
-      if (!g_hash_table_lookup_extended (superset, look_for, NULL, NULL))
-        /* One of subset's key is not in superset */
-        return FALSE;
-    }
-
-  return TRUE;
-}
-
-static gboolean
-gabble_private_tubes_factory_caps_diff (
-    GabbleCapsChannelManager *manager,
-    TpHandle handle,
-    gpointer specific_old_caps,
-    gpointer specific_new_caps)
-{
-  TubesCapabilities *old_caps = specific_old_caps;
-  TubesCapabilities *new_caps = specific_new_caps;
-
-  if (old_caps == new_caps)
-    return FALSE;
-
-  if (old_caps == NULL || new_caps == NULL)
-    return TRUE;
-
-  if (old_caps->tubes_supported != new_caps->tubes_supported)
-    return TRUE;
-
-  if (g_hash_table_size (old_caps->stream_tube_caps) !=
-      g_hash_table_size (new_caps->stream_tube_caps))
-    return TRUE;
-
-  if (g_hash_table_size (old_caps->dbus_tube_caps) !=
-      g_hash_table_size (new_caps->dbus_tube_caps))
-    return TRUE;
-
-  /* Hash tables have the same size */
-  if (!hash_table_is_subset (new_caps->stream_tube_caps,
-        old_caps->stream_tube_caps))
-    return TRUE;
-
-  if (!hash_table_is_subset (new_caps->dbus_tube_caps,
-        old_caps->dbus_tube_caps))
-    return TRUE;
-
-  return FALSE;
-}
-
-static void
 gabble_private_tubes_factory_add_cap (GabbleCapsChannelManager *manager,
     GHashTable *cap,
     GabbleCapabilitySet *cap_set)
@@ -1308,11 +1070,5 @@ caps_channel_manager_iface_init (gpointer g_iface,
   GabbleCapsChannelManagerIface *iface = g_iface;
 
   iface->get_contact_caps = gabble_private_tubes_factory_get_contact_caps;
-  iface->get_feature_list = gabble_private_tubes_factory_get_feature_list;
-  iface->parse_caps = gabble_private_tubes_factory_parse_caps;
-  iface->free_caps = gabble_private_tubes_factory_free_caps;
-  iface->copy_caps = gabble_private_tubes_factory_copy_caps;
-  iface->update_caps = gabble_private_tubes_factory_update_caps;
-  iface->caps_diff = gabble_private_tubes_factory_caps_diff;
   iface->add_cap = gabble_private_tubes_factory_add_cap;
 }
diff --git a/tests/test-presence.c b/tests/test-presence.c
index 0f4bc5e..2fac88d 100644
--- a/tests/test-presence.c
+++ b/tests/test-presence.c
@@ -111,7 +111,7 @@ int main (int argc, char **argv)
     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, NULL, 0);
+      PRESENCE_CAP_GOOGLE_VOICE, 0);
   gabble_capability_set_free (cap_set);
 
   dump = gabble_presence_dump (presence);
@@ -142,7 +142,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, NULL, 0);
+      PRESENCE_CAP_GOOGLE_VOICE, 0);
   gabble_capability_set_free (cap_set);
 
   /* resource has voice cap */
-- 
1.5.6.5




More information about the telepathy-commits mailing list