[Telepathy-commits] [telepathy-gabble/master] refactor jingle candidate sending so they're sent for non-initial contents too

Senko Rasic senko.rasic at collabora.co.uk
Tue Dec 2 04:34:07 PST 2008


---
 src/jingle-content.c |   17 +++++++++--------
 src/jingle-session.c |   10 ++++++++++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/jingle-content.c b/src/jingle-content.c
index df756db..6faf173 100644
--- a/src/jingle-content.c
+++ b/src/jingle-content.c
@@ -540,14 +540,13 @@ gabble_jingle_content_parse_add (GabbleJingleContent *c,
   g_signal_connect (trans, "new-candidates",
       (GCallback) new_transport_candidates_cb, c);
 
-  /* FIXME: I think candidates can't be specified in content addition/session
-   * init, so disabling this:
+  /* Depending on transport, there may be initial candidates specified here */
   gabble_jingle_transport_iface_parse_candidates (trans, trans_node, error);
   if (*error)
     {
       g_object_unref (trans);
       return;
-    } */
+    }
 
   g_assert (priv->transport == NULL);
   priv->transport = trans;
@@ -795,6 +794,10 @@ _maybe_ready (GabbleJingleContent *self)
       if (state >= JS_STATE_PENDING_INITIATE_SENT)
         {
           send_content_add_or_accept (self);
+
+          /* if neccessary, transmit the candidates */
+          gabble_jingle_transport_iface_retransmit_candidates (priv->transport,
+              FALSE);
         }
       else
         {
@@ -804,13 +807,11 @@ _maybe_ready (GabbleJingleContent *self)
           return;
         }
     }
-
-  /* if we have pending local candidates, now's the time
-   * to transmit them */
-  gabble_jingle_transport_iface_retransmit_candidates (priv->transport, FALSE);
 }
 
-/* Used when we detect gtalk3 after we've transmitted some candidates */
+/* Used when session-initiate is sent (so all initial contents transmit their
+ * candidates), and when we detect gtalk3 after we've transmitted some
+ * candidates. */
 void
 gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self)
 {
diff --git a/src/jingle-session.c b/src/jingle-session.c
index fb8269e..efee07b 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -1241,6 +1241,13 @@ _check_content_ready (GabbleJingleSession *sess,
 }
 
 static void
+_transmit_candidates (GabbleJingleSession *sess,
+    GabbleJingleContent *c, gpointer user_data)
+{
+  gabble_jingle_content_retransmit_candidates (c);
+}
+
+static void
 _fill_content (GabbleJingleSession *sess,
     GabbleJingleContent *c, gpointer user_data)
 {
@@ -1398,6 +1405,9 @@ try_session_initiate_or_accept (GabbleJingleSession *sess)
   _map_initial_contents (sess, _fill_content, sess_node);
   gabble_jingle_session_send (sess, msg, handler, NULL);
   set_state (sess, new_state);
+
+  /* now all initial contents can transmit their candidates */
+  _map_initial_contents (sess, _transmit_candidates, NULL);
 }
 
 static void
-- 
1.5.6.5




More information about the Telepathy-commits mailing list