[telepathy-gabble/telepathy-gabble-0.8] Copy FT per channel manager caps in their entirety.

Will Thompson will.thompson at collabora.co.uk
Tue Oct 6 02:58:03 PDT 2009


In 0.8, FT caps are represented by two hash tables, mapping service
names to either NULL, or a Feature struct, depending on whether the caps
are for another user or for yourself.

The copy function assumed that we'd only ever copy other people's caps,
not our own, and so always set the value to NULL in the copy. But for
caching our own caps, and serving up disco responses from the cache, we
do want to copy the tables in their entirity.
---
 src/private-tubes-factory.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/private-tubes-factory.c b/src/private-tubes-factory.c
index 42f9d93..5d2ed1f 100644
--- a/src/private-tubes-factory.c
+++ b/src/private-tubes-factory.c
@@ -731,8 +731,18 @@ copy_caps_helper (gpointer key, gpointer value, gpointer user_data)
 {
   GHashTable *out = user_data;
   gchar *str = key;
+  Feature *feat = value;
+  Feature *copy = NULL;
 
-  g_hash_table_insert (out, g_strdup (str), NULL);
+  if (value != NULL)
+    {
+      copy = g_new0 (Feature, 1);
+      copy->feature_type = feat->feature_type;
+      copy->ns = g_strdup (feat->ns);
+      copy->caps = feat->caps;
+    }
+
+  g_hash_table_insert (out, g_strdup (str), copy);
 }
 
 static void
-- 
1.5.6.5




More information about the telepathy-commits mailing list