changeset 26067:b0e6a64cbf2e

Use the new ready signal instead of accept to send a session-accept.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sun, 04 Jan 2009 11:12:47 +0000
parents 607d82dce00e
children d881fc5d907f
files libpurple/media.c libpurple/protocols/jabber/jingle/rtp.c
diffstat 2 files changed, 15 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Sun Jan 04 09:56:54 2009 +0000
+++ b/libpurple/media.c	Sun Jan 04 11:12:47 2009 +0000
@@ -757,12 +757,12 @@
 						gboolean ready;
 						g_object_get(session->session, "codecs-ready", &ready, NULL);
 						if (session->codecs_ready == FALSE && ready == TRUE) {
+							session->codecs_ready = ready;
 							g_signal_emit(session->media,
 									purple_media_signals[CODECS_READY],
 									0, session->id);
 							purple_media_emit_ready(media, session, NULL);
 						}
-						session->codecs_ready = ready;
 
 						g_list_free(sessions);
 						break;
@@ -878,7 +878,6 @@
 	for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
 		PurpleMediaSession *session = sessions->data;
 		session->accepted = TRUE;
-		purple_media_emit_ready(media, session, NULL);
 	}
 }
 
--- a/libpurple/protocols/jabber/jingle/rtp.c	Sun Jan 04 09:56:54 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Sun Jan 04 11:12:47 2009 +0000
@@ -264,13 +264,6 @@
 }
 
 static void
-jingle_rtp_accept_cb(PurpleMedia *media, JingleSession *session)
-{
-	jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO));
-	jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT));
-}
-
-static void
 jingle_rtp_reject_cb(PurpleMedia *media, JingleSession *session)
 {
 	jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
@@ -320,16 +313,22 @@
 {
 	purple_debug_info("rtp", "ready-new: session: %s name: %s\n", sid, name);
 
-	if (sid == NULL && name == NULL && jingle_session_is_initiator(session) == TRUE) {
-		GList *contents = jingle_session_get_contents(session);
+	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));
+			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 (JINGLE_IS_ICEUDP(transport))
-				jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO));
+			for (; contents; contents = g_list_next(contents)) {
+				JingleContent *content = (JingleContent *)contents->data;
+				JingleTransport *transport = jingle_content_get_transport(content);
+				if (JINGLE_IS_ICEUDP(transport))
+					jabber_iq_send(jingle_session_to_packet(session,
+							JINGLE_TRANSPORT_INFO));
+			}
+		} else {
+			jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO));
+			jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT));
 		}
 	}
 }
@@ -361,8 +360,6 @@
 	g_hash_table_insert(js->medias, sid, media);
 
 	/* connect callbacks */
-	g_signal_connect(G_OBJECT(media), "accepted",
-				 G_CALLBACK(jingle_rtp_accept_cb), session);
 	g_signal_connect(G_OBJECT(media), "reject",
 				 G_CALLBACK(jingle_rtp_reject_cb), session);
 	g_signal_connect(G_OBJECT(media), "hangup",