changeset 26321:2c9fb8ac325b

Use stream-info instead of state-changed for hangup and reject.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sat, 21 Mar 2009 00:34:29 +0000
parents 8b4394e84633
children 90c7f3e477b3
files libpurple/protocols/jabber/jingle/rtp.c
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/rtp.c	Sat Mar 21 00:27:22 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Sat Mar 21 00:34:29 2009 +0000
@@ -439,13 +439,22 @@
 		gchar *sid, gchar *name, JingleSession *session)
 {
 	purple_debug_info("jingle-rtp", "state-changed: type %d id: %s name: %s\n", type, sid, name);
+}
 
-	if ((type == PURPLE_MEDIA_STATE_CHANGED_REJECTED ||
-			type == PURPLE_MEDIA_STATE_CHANGED_HANGUP) &&
-			sid == NULL && name == NULL) {
+static void
+jingle_rtp_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
+		gchar *sid, gchar *name, JingleSession *session)
+{
+	purple_debug_info("jingle-rtp", "stream-info: type %d "
+			"id: %s name: %s\n", type, sid, name);
+	if (type == PURPLE_MEDIA_INFO_HANGUP) {
 		jabber_iq_send(jingle_session_terminate_packet(
 				session, "success"));
 		g_object_unref(session);
+	} else if (type == PURPLE_MEDIA_INFO_REJECT) {
+		jabber_iq_send(jingle_session_terminate_packet(
+				session, "decline"));
+		g_object_unref(session);
 	}
 }
 
@@ -512,6 +521,8 @@
 				 G_CALLBACK(jingle_rtp_codecs_changed_cb), session);
 	g_signal_connect(G_OBJECT(media), "state-changed",
 				 G_CALLBACK(jingle_rtp_state_changed_cb), session);
+	g_signal_connect(G_OBJECT(media), "stream-info",
+			G_CALLBACK(jingle_rtp_stream_info_cb), session);
 
 	g_object_unref(session);
 	return media;