diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2012-02-23 12:59:29 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2012-02-23 12:59:29 +0000 |
commit | a6ef0c0b9d2747baaaa049a6c441da7b94d65265 (patch) | |
tree | dc1c172133345ac634b117d55496ce9c5369c8d9 /src | |
parent | da9f352766edf270c907421ea610549593c46325 (diff) |
JingleSession: make _new() take a dialect.
Everywhere that creates a new session knows the dialect it wants to use,
so let's pass it right into the constructor.
Diffstat (limited to 'src')
-rw-r--r-- | src/call-member.c | 8 | ||||
-rw-r--r-- | src/gtalk-file-collection.c | 6 | ||||
-rw-r--r-- | src/jingle-factory.c | 10 | ||||
-rw-r--r-- | src/jingle-factory.h | 1 | ||||
-rw-r--r-- | src/jingle-session.c | 2 | ||||
-rw-r--r-- | src/jingle-session.h | 1 | ||||
-rw-r--r-- | src/media-channel.c | 9 |
7 files changed, 18 insertions, 19 deletions
diff --git a/src/call-member.c b/src/call-member.c index 9dd06dd75..c5522d16a 100644 --- a/src/call-member.c +++ b/src/call-member.c @@ -514,11 +514,10 @@ gabble_call_member_open_session (GabbleCallMember *self, jf = gabble_jingle_mint_get_factory (conn->jingle_mint); g_return_val_if_fail (jf != NULL, FALSE); - session = gabble_jingle_factory_create_session (jf, jid, FALSE); + session = gabble_jingle_factory_create_session (jf, jid, JINGLE_DIALECT_V032, + FALSE); DEBUG ("Created a jingle session: %p", session); - g_object_set (session, "dialect", JINGLE_DIALECT_V032, NULL); - priv->transport_ns = g_strdup (NS_JINGLE_TRANSPORT_ICEUDP); gabble_call_member_set_session (self, session); @@ -561,11 +560,10 @@ gabble_call_member_start_session (GabbleCallMember *self, gabble_call_member_get_connection (self)->jingle_mint); g_return_val_if_fail (jf != NULL, FALSE); - session = gabble_jingle_factory_create_session (jf, jid, FALSE); + session = gabble_jingle_factory_create_session (jf, jid, dialect, FALSE); g_free (jid); gabble_call_member_set_session (self, session); - g_object_set (session, "dialect", dialect, NULL); priv->transport_ns = g_strdup (transport); diff --git a/src/gtalk-file-collection.c b/src/gtalk-file-collection.c index 902c742e8..9490ca542 100644 --- a/src/gtalk-file-collection.c +++ b/src/gtalk-file-collection.c @@ -1412,7 +1412,7 @@ gtalk_file_collection_new (GabbleFileTransferChannel *channel, self->priv->requested = TRUE; session = gabble_jingle_factory_create_session (jingle_factory, - jid, FALSE); + jid, JINGLE_DIALECT_GTALK4, FALSE); if (session == NULL) { @@ -1420,10 +1420,6 @@ gtalk_file_collection_new (GabbleFileTransferChannel *channel, return NULL; } - g_object_set (session, - "dialect", JINGLE_DIALECT_GTALK4, - NULL); - content = gabble_jingle_session_add_content (session, JINGLE_MEDIA_TYPE_NONE, JINGLE_CONTENT_SENDERS_BOTH, "share", NS_GOOGLE_SESSION_SHARE, NS_GOOGLE_TRANSPORT_P2P); diff --git a/src/jingle-factory.c b/src/jingle-factory.c index 2ec9d9377..0e9f6f73f 100644 --- a/src/jingle-factory.c +++ b/src/jingle-factory.c @@ -83,6 +83,7 @@ static gboolean jingle_cb ( static GabbleJingleSession *create_session (GabbleJingleFactory *fac, const gchar *sid, const gchar *jid, + JingleDialect dialect, gboolean local_hold); static gboolean session_query_cap_cb ( @@ -361,8 +362,7 @@ ensure_session (GabbleJingleFactory *self, { if (action == JINGLE_ACTION_SESSION_INITIATE) { - sess = create_session (self, sid, from, FALSE); - g_object_set (sess, "dialect", dialect, NULL); + sess = create_session (self, sid, from, dialect, FALSE); *new_session = TRUE; } else @@ -466,6 +466,7 @@ static GabbleJingleSession * create_session (GabbleJingleFactory *fac, const gchar *sid, const gchar *jid, + JingleDialect dialect, gboolean local_hold) { GabbleJingleFactoryPrivate *priv = fac->priv; @@ -507,7 +508,7 @@ create_session (GabbleJingleFactory *fac, sess = gabble_jingle_session_new ( fac, priv->porter, - sid_, local_initiator, contact, local_hold); + sid_, local_initiator, contact, dialect, local_hold); g_signal_connect (sess, "terminated", (GCallback) session_terminated_cb, fac); @@ -528,9 +529,10 @@ create_session (GabbleJingleFactory *fac, GabbleJingleSession * gabble_jingle_factory_create_session (GabbleJingleFactory *fac, const gchar *jid, + JingleDialect dialect, gboolean local_hold) { - GabbleJingleSession *session = create_session (fac, NULL, jid, local_hold); + GabbleJingleSession *session = create_session (fac, NULL, jid, dialect, local_hold); g_signal_emit (fac, signals[NEW_SESSION], 0, session, TRUE); return session; diff --git a/src/jingle-factory.h b/src/jingle-factory.h index cb150c1b8..d254dbf20 100644 --- a/src/jingle-factory.h +++ b/src/jingle-factory.h @@ -78,6 +78,7 @@ GType gabble_jingle_factory_lookup_transport (GabbleJingleFactory *self, GabbleJingleSession *gabble_jingle_factory_create_session ( GabbleJingleFactory *fac, const gchar *jid, + JingleDialect dialect, gboolean local_hold); GabbleJingleInfo *gabble_jingle_factory_get_jingle_info ( diff --git a/src/jingle-session.c b/src/jingle-session.c index dc66b43c4..2e169346f 100644 --- a/src/jingle-session.c +++ b/src/jingle-session.c @@ -392,6 +392,7 @@ gabble_jingle_session_new ( const gchar *session_id, gboolean local_initiator, WockyContact *peer, + JingleDialect dialect, gboolean local_hold) { return g_object_new (GABBLE_TYPE_JINGLE_SESSION, @@ -400,6 +401,7 @@ gabble_jingle_session_new ( "porter", porter, "local-initiator", local_initiator, "peer-contact", peer, + "dialect", dialect, "local-hold", local_hold, NULL); } diff --git a/src/jingle-session.h b/src/jingle-session.h index 92a244d71..95bc23af1 100644 --- a/src/jingle-session.h +++ b/src/jingle-session.h @@ -73,6 +73,7 @@ GabbleJingleSession *gabble_jingle_session_new ( const gchar *session_id, gboolean local_initiator, WockyContact *peer, + JingleDialect dialect, gboolean local_hold); const gchar * gabble_jingle_session_detect (WockyStanza *stanza, diff --git a/src/media-channel.c b/src/media-channel.c index c53adccef..0721b2908 100644 --- a/src/media-channel.c +++ b/src/media-channel.c @@ -302,7 +302,8 @@ _latch_to_session (GabbleMediaChannel *chan) static void create_session (GabbleMediaChannel *chan, - const gchar *jid) + const gchar *jid, + JingleDialect dialect) { GabbleMediaChannelPrivate *priv = chan->priv; gboolean local_hold = (priv->hold_state != TP_LOCAL_HOLD_STATE_UNHELD); @@ -315,7 +316,7 @@ create_session (GabbleMediaChannel *chan, jf = gabble_jingle_mint_get_factory (priv->conn->jingle_mint); g_return_if_fail (jf != NULL); priv->session = g_object_ref ( - gabble_jingle_factory_create_session (jf, jid, local_hold)); + gabble_jingle_factory_create_session (jf, jid, dialect, local_hold)); _latch_to_session (chan); } @@ -1709,11 +1710,9 @@ _gabble_media_channel_request_contents (GabbleMediaChannel *chan, jid = gabble_peer_to_jid (priv->conn, peer, peer_resource); priv->peer = peer; - create_session (chan, jid); + create_session (chan, jid, dialect); g_free (jid); - g_object_set (priv->session, "dialect", dialect, NULL); - /* Change nat-traversal if we need to */ if (!tp_strdiff (transport_ns, NS_JINGLE_TRANSPORT_ICEUDP)) { |