[telepathy-gabble/master] jingle_pick_best_content_type: allow the resource to be "" (bare JID)

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Jan 5 11:00:51 PST 2010


---
 src/util.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/util.c b/src/util.c
index d0f5a02..03c0a35 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1190,6 +1190,8 @@ jingle_pick_best_content_type (GabbleConnection *conn,
         { FALSE, NULL, NULL }
   };
 
+  g_return_val_if_fail (resource != NULL, NULL);
+
   presence = gabble_presence_cache_get (conn->presence_cache, peer);
 
   if (presence == NULL)
@@ -1198,8 +1200,16 @@ jingle_pick_best_content_type (GabbleConnection *conn,
       return NULL;
     }
 
-  return gabble_presence_resource_pick_best_feature (presence, resource,
-      content_types, gabble_capability_set_predicate_has);
+  if (resource[0] == '\0')
+    {
+      return gabble_presence_pick_best_feature (presence, content_types,
+          gabble_capability_set_predicate_has);
+    }
+  else
+    {
+      return gabble_presence_resource_pick_best_feature (presence, resource,
+          content_types, gabble_capability_set_predicate_has);
+    }
 }
 
 GValueArray *
-- 
1.5.6.5




More information about the telepathy-commits mailing list