[telepathy-gabble/master] GabbleJingleSession: allow resource to be "" to indicate use of a bare JID

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Jan 5 10:58:09 PST 2010


Calling XEP-0100-compliant SIP gateways will require this to work.
---
 src/jingle-session.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/jingle-session.c b/src/jingle-session.c
index 918db0b..5dde4cf 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -360,8 +360,9 @@ gabble_jingle_session_constructed (GObject *object)
    * should be two variants: one taking handle + resource, and another taking a
    * full JID; the other fields could be filled in here.
    */
-  priv->peer_jid = g_strdup_printf ("%s/%s",
-      tp_handle_inspect (contact_repo, self->peer), priv->peer_resource);
+  priv->peer_jid = g_strdup_printf ("%s%s%s",
+      tp_handle_inspect (contact_repo, self->peer),
+      priv->peer_resource[0] == '\0' ? "" : "/", priv->peer_resource);
 
   if (priv->local_initiator)
     priv->initiator = gabble_connection_get_full_jid (priv->conn);
@@ -426,7 +427,8 @@ gabble_jingle_session_class_init (GabbleJingleSessionClass *cls)
   g_object_class_install_property (object_class, PROP_PEER, param_spec);
 
   param_spec = g_param_spec_string ("peer-resource", "Session peer's resource",
-      "The resource of the contact with whom this session communicates.",
+      "The resource of the contact with whom this session communicates, "
+      "or an empty string if communicating with a bare JID",
       NULL,
       G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (object_class, PROP_PEER_RESOURCE,
@@ -631,6 +633,7 @@ lookup_content (GabbleJingleSession *sess,
           priv->conn->presence_cache, sess->peer);
 
       if (creator == NULL && presence != NULL &&
+          priv->peer_resource[0] != '\0' &&
           gabble_presence_resource_has_caps (presence, priv->peer_resource,
               gabble_capability_set_predicate_has,
               QUIRK_OMITS_CONTENT_CREATORS))
-- 
1.5.6.5




More information about the telepathy-commits mailing list