pidgin.vv: 8c41751f: Move sending session-accept out of the r...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Mar 20 04:35:47 EDT 2009


-----------------------------------------------------------------
Revision: 8c41751fba489cf5b791b4e06387cbd988d0cfe2
Ancestor: 9a71011ad35e41fa85cf6eefed7d5ad818ec2b1f
Author: maiku at soc.pidgin.im
Date: 2009-03-20T00:24:06
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/8c41751fba489cf5b791b4e06387cbd988d0cfe2

Modified files:
        libpurple/protocols/jabber/jingle/rtp.c

ChangeLog: 

Move sending session-accept out of the ready-new signal.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/rtp.c	ae79c119162f552b36b1871b0085b712783e5623
+++ libpurple/protocols/jabber/jingle/rtp.c	9516406594b252b294321ffee8f9d2382bd84d5d
@@ -336,12 +336,14 @@ static void jingle_rtp_send_initiate(Jin
 }
 
 static void jingle_rtp_send_initiate(JingleSession *session);
+static void jingle_rtp_send_accept(JingleSession *session);
 
 static void
 jingle_rtp_accepted_cb(PurpleMedia *media, gchar *sid, gchar *name,
 		JingleSession *session)
 {
 	purple_debug_info("jingle-rtp", "jingle_rtp_accepted_cb\n");
+	jingle_rtp_send_accept(session);
 }
 
 static void
@@ -376,6 +378,7 @@ jingle_rtp_candidates_prepared_cb(Purple
 	jingle_content_accept_transport(content);
 
 	jingle_rtp_send_initiate(session);
+	jingle_rtp_send_accept(session);
 }
 
 static void
@@ -385,6 +388,7 @@ jingle_rtp_codecs_changed_cb(PurpleMedia
 	purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: "
 			"session_id: %s jingle_session: %p\n", sid, session);
 	jingle_rtp_send_initiate(session);
+	jingle_rtp_send_accept(session);
 }
 
 static void
@@ -434,20 +438,6 @@ static void
 }
 
 static void
-jingle_rtp_ready_cb(PurpleMedia *media, gchar *sid, gchar *name, JingleSession *session)
-{
-	purple_debug_info("rtp", "ready-new: session: %s name: %s\n", sid, name);
-
-	if (sid == NULL && name == NULL) {
-		if (jingle_session_is_initiator(session) == FALSE) {
-			jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT));
-			g_signal_connect(G_OBJECT(media), "new-candidate",
-					 G_CALLBACK(jingle_rtp_new_candidate_cb), session);
-		}
-	}
-}
-
-static void
 jingle_rtp_state_changed_cb(PurpleMedia *media, PurpleMediaStateChangedType type,
 		gchar *sid, gchar *name, JingleSession *session)
 {
@@ -481,6 +471,23 @@ jingle_rtp_send_initiate(JingleSession *
 	}
 }
 
+static void
+jingle_rtp_send_accept(JingleSession *session)
+{
+	PurpleMedia *media = jingle_rtp_get_media(session);
+
+	if (jingle_session_is_initiator(session) == FALSE &&
+			purple_media_codecs_ready(media, NULL) &&
+			purple_media_accepted(media, NULL, NULL) &&
+			purple_media_candidates_prepared(media, NULL, NULL)) {
+		jabber_iq_send(jingle_session_to_packet(session,
+				JINGLE_SESSION_ACCEPT));
+		g_signal_connect(G_OBJECT(media), "new-candidate",
+				G_CALLBACK(jingle_rtp_new_candidate_cb),
+				session);
+	}
+}
+
 static PurpleMedia *
 jingle_rtp_create_media(JingleContent *content)
 {
@@ -507,8 +514,6 @@ jingle_rtp_create_media(JingleContent *c
 				 G_CALLBACK(jingle_rtp_candidates_prepared_cb), session);
 	g_signal_connect(G_OBJECT(media), "codecs-changed",
 				 G_CALLBACK(jingle_rtp_codecs_changed_cb), session);
-	g_signal_connect(G_OBJECT(media), "ready-new",
-				 G_CALLBACK(jingle_rtp_ready_cb), session);
 	g_signal_connect(G_OBJECT(media), "state-changed",
 				 G_CALLBACK(jingle_rtp_state_changed_cb), session);
 


More information about the Commits mailing list