changeset 26070:50309309bc4d

Use the state-changed signal.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Mon, 05 Jan 2009 09:48:39 +0000
parents 7d2e06b29f88
children 8dba34f5f21a
files libpurple/protocols/jabber/jingle/rtp.c
diffstat 1 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/rtp.c	Mon Jan 05 06:34:30 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Mon Jan 05 09:48:39 2009 +0000
@@ -264,16 +264,6 @@
 }
 
 static void
-jingle_rtp_hangup_cb(PurpleMedia *media, JingleSession *session)
-{
-	gchar *sid = jingle_session_get_sid(session);
-	jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
-	g_hash_table_remove(jingle_session_get_js(session)->medias, sid);
-	g_free(sid);
-	g_object_unref(session);
-}
-
-static void
 jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, FsCandidate *candidate, JingleSession *session)
 {
 	purple_debug_info("jingle-rtp", "jingle_rtp_new_candidate_cb\n");
@@ -334,6 +324,16 @@
 		gchar *sid, gchar *name, JingleSession *session)
 {
 	purple_debug_info("jingle-rtp", "state-changed: type %d id: %s name: %s\n", type, sid, name);
+
+	if (sid == NULL && name == NULL &&
+			jingle_session_is_initiator(session) == TRUE) {
+		gchar *sid = jingle_session_get_sid(session);
+		jabber_iq_send(jingle_session_to_packet(session,
+				JINGLE_SESSION_TERMINATE));
+		g_hash_table_remove(jingle_session_get_js(session)->medias, sid);
+		g_free(sid);
+		g_object_unref(session);
+	}
 }
 
 static PurpleMedia *
@@ -363,10 +363,6 @@
 	g_hash_table_insert(js->medias, sid, media);
 
 	/* connect callbacks */
-	g_signal_connect(G_OBJECT(media), "reject",
-				 G_CALLBACK(jingle_rtp_hangup_cb), session);
-	g_signal_connect(G_OBJECT(media), "hangup",
-				 G_CALLBACK(jingle_rtp_hangup_cb), session);
 	g_signal_connect(G_OBJECT(media), "new-candidate",
 				 G_CALLBACK(jingle_rtp_new_candidate_cb), session);
 	g_signal_connect(G_OBJECT(media), "candidates-prepared",