[telepathy-gabble/master] Construct outgoing Jingle sessions with resource
Will Thompson
will.thompson at collabora.co.uk
Tue Jun 9 08:16:36 PDT 2009
---
src/media-channel.c | 38 +++++++++++++++++---------------------
1 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/src/media-channel.c b/src/media-channel.c
index 9e6de09..766f6fd 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -253,7 +253,9 @@ _latch_to_session (GabbleMediaChannel *chan)
}
static void
-create_session (GabbleMediaChannel *chan, TpHandle peer)
+create_session (GabbleMediaChannel *chan,
+ TpHandle peer,
+ const gchar *resource)
{
GabbleMediaChannelPrivate *priv = chan->priv;
gboolean local_hold = (priv->hold_state != TP_LOCAL_HOLD_STATE_UNHELD);
@@ -264,7 +266,7 @@ create_session (GabbleMediaChannel *chan, TpHandle peer)
priv->session = g_object_ref (
gabble_jingle_factory_create_session (priv->conn->jingle_factory,
- peer, NULL, local_hold));
+ peer, resource, local_hold));
_latch_to_session (chan);
}
@@ -1571,6 +1573,7 @@ pending_stream_request_free (gpointer data)
static gboolean
_gabble_media_channel_request_contents (GabbleMediaChannel *chan,
+ TpHandle peer,
const GArray *media_types,
GPtrArray **ret,
GError **error)
@@ -1579,18 +1582,11 @@ _gabble_media_channel_request_contents (GabbleMediaChannel *chan,
gboolean want_audio, want_video;
JingleDialect dialect;
guint idx;
- TpHandle peer;
const gchar *peer_resource;
const gchar *transport_ns = NULL;
DEBUG ("called");
- g_object_get (priv->session, "peer", &peer,
- "peer-resource", &peer_resource, NULL);
-
- if (!contact_is_media_capable (chan, peer, NULL, error))
- return FALSE;
-
want_audio = want_video = FALSE;
for (idx = 0; idx < media_types->len; idx++)
@@ -1613,11 +1609,14 @@ _gabble_media_channel_request_contents (GabbleMediaChannel *chan,
}
}
- g_object_get (priv->session, "dialect", &dialect, NULL);
-
/* existing call; the recipient and the mode has already been decided */
- if (dialect != JINGLE_DIALECT_ERROR)
+ if (priv->session != NULL)
{
+ g_object_get (priv->session,
+ "dialect", &dialect,
+ "peer-resource", &peer_resource,
+ NULL);
+
/* is a google call... we have no other option */
if (JINGLE_IS_GOOGLE_DIALECT (dialect))
{
@@ -1673,8 +1672,9 @@ _gabble_media_channel_request_contents (GabbleMediaChannel *chan,
DEBUG ("Picking resource '%s' (transport: %s, dialect: %u)",
peer_resource, transport_ns, dialect);
- g_object_set (priv->session, "dialect", dialect,
- "peer-resource", peer_resource, NULL);
+ create_session (chan, peer, peer_resource);
+
+ g_object_set (priv->session, "dialect", dialect, NULL);
}
/* check it's not a ridiculous number of streams */
@@ -1861,11 +1861,7 @@ media_channel_request_streams (GabbleMediaChannel *self,
goto error;
}
- if (priv->session == NULL)
- {
- create_session (self, contact_handle);
- }
- else
+ if (priv->session != NULL)
{
TpHandle peer;
@@ -1882,8 +1878,8 @@ media_channel_request_streams (GabbleMediaChannel *self,
}
}
- if (!_gabble_media_channel_request_contents (self, types, &contents,
- &error))
+ if (!_gabble_media_channel_request_contents (self, contact_handle, types,
+ &contents, &error))
goto error;
psr = pending_stream_request_new (contents, succeeded_cb, failed_cb,
--
1.5.6.5
More information about the telepathy-commits
mailing list