pidgin.vv: 0f413136: Wait to send transport-info until the se...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Thu Feb 5 20:20:33 EST 2009


-----------------------------------------------------------------
Revision: 0f4131363b19bda7e1e7974be6410c5c5247466d
Ancestor: 635944ca0d059842899757348a2747fc248358cf
Author: maiku at soc.pidgin.im
Date: 2009-02-05T23:30:48
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/0f4131363b19bda7e1e7974be6410c5c5247466d

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

ChangeLog: 

Wait to send transport-info until the session-initiate ack is received.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/rtp.c	cc6b750a1770bb6ecfe325373ba1f5ca462f630f
+++ libpurple/protocols/jabber/jingle/rtp.c	be2e379dc44a93ba63bbd1b5b307389a7d1ef9c9
@@ -295,6 +295,25 @@ static void
 }
 
 static void
+jingle_rtp_initiate_ack_cb(JabberStream *js, xmlnode *packet, gpointer data)
+{
+	JingleSession *session = data;
+
+	if (!strcmp(xmlnode_get_attrib(packet, "type"), "error") ||
+			xmlnode_get_child(packet, "error")) {
+		gchar *sid = jingle_session_get_sid(session);
+		purple_media_end(jingle_rtp_get_media(session), NULL, NULL);
+		g_hash_table_remove(jingle_session_get_js(
+				session)->medias, sid);
+		g_free(sid);
+		return;
+	}
+
+	jabber_iq_send(jingle_session_to_packet(session,
+			JINGLE_TRANSPORT_INFO));
+}
+
+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);
@@ -302,16 +321,18 @@ jingle_rtp_ready_cb(PurpleMedia *media, 
 	if (sid == NULL && name == NULL) {
 		if (jingle_session_is_initiator(session) == TRUE) {
 			GList *contents = jingle_session_get_contents(session);
+			JabberIq *iq = jingle_session_to_packet(
+					session, JINGLE_SESSION_INITIATE);
 
-			jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_INITIATE));
-
-			for (; contents; contents = g_list_next(contents)) {
-				JingleContent *content = (JingleContent *)contents->data;
-				JingleTransport *transport = jingle_content_get_transport(content);
+			if (contents->data) {
+				JingleTransport *transport =
+						jingle_content_get_transport(contents->data);
 				if (JINGLE_IS_ICEUDP(transport))
-					jabber_iq_send(jingle_session_to_packet(session,
-							JINGLE_TRANSPORT_INFO));
+					jabber_iq_set_callback(iq,
+							jingle_rtp_initiate_ack_cb, session);
 			}
+
+			jabber_iq_send(iq);
 		} else {
 			jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO));
 			jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT));


More information about the Commits mailing list