changeset 26110:cab1ed5a0402

merge of '12e8711526f49bf6cecd4f430dec8f661857221f' and 'f33aa51d677e3a775ee19c0d45b1935229f3f279'
author Marcus Lundblad <ml@update.uu.se>
date Wed, 11 Feb 2009 22:11:18 +0000
parents 8f1ce165de35 (current diff) 9cda61a15698 (diff)
children 260a606e2570
files
diffstat 3 files changed, 35 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Wed Feb 11 22:11:08 2009 +0000
+++ b/libpurple/media.c	Wed Feb 11 22:11:18 2009 +0000
@@ -1214,6 +1214,9 @@
 						break;
 					}
 				}
+
+				if (!PURPLE_IS_MEDIA(media))
+					break;
 			}
 
 			if (gst_structure_has_name(msg->structure, "farsight-error")) {
--- a/libpurple/protocols/jabber/jingle/rtp.c	Wed Feb 11 22:11:08 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Wed Feb 11 22:11:18 2009 +0000
@@ -295,6 +295,26 @@
 }
 
 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);
+		g_object_unref(session);
+		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 +322,18 @@
 	if (sid == NULL && name == NULL) {
 		if (jingle_session_is_initiator(session) == TRUE) {
 			GList *contents = jingle_session_get_contents(session);
-
-			jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_INITIATE));
+			JabberIq *iq = 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));
--- a/pidgin/gtkmedia.c	Wed Feb 11 22:11:08 2009 +0000
+++ b/pidgin/gtkmedia.c	Wed Feb 11 22:11:18 2009 +0000
@@ -787,9 +787,9 @@
 		gchar *message = g_strdup_printf("%s wishes to start a "
 				"media session with you\n", alias);
 		purple_request_accept_cancel(gtkmedia, "Media invitation",
-				message, NULL, 1, (void*)pc, screenname,
-				NULL, media, purple_media_accept,
-				purple_media_reject);
+				message, NULL, PURPLE_DEFAULT_ACTION_NONE,
+				(void*)pc, screenname, NULL, media,
+				purple_media_accept, purple_media_reject);
 		g_free(message);
 	} else
 		gtk_widget_show(GTK_WIDGET(gtkmedia));