pidgin.vv: 68eefccd: Remove PurpleMedias from JabberStream's ...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Sun Jan 4 07:16:59 EST 2009


-----------------------------------------------------------------
Revision: 68eefccdd54cbc4a678a47e24ef2f1dab773ad3a
Ancestor: 662a26f90f96617a44372127da76ab735a91ae0f
Author: maiku at soc.pidgin.im
Date: 2009-01-04T12:13:12
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/68eefccdd54cbc4a678a47e24ef2f1dab773ad3a

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

ChangeLog: 

Remove PurpleMedias from JabberStream's list when a media session ends.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/rtp.c	5c105f894bed86563627b3cb799c5d924453c3ce
+++ libpurple/protocols/jabber/jingle/rtp.c	4ceb35b7c5b2c7d0d590527ec3531e17fbebda34
@@ -264,16 +264,12 @@ static void
 }
 
 static void
-jingle_rtp_reject_cb(PurpleMedia *media, JingleSession *session)
-{
-	jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
-	g_object_unref(session);
-}
-
-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);
 }
 
@@ -361,7 +357,7 @@ jingle_rtp_create_media(JingleContent *c
 
 	/* connect callbacks */
 	g_signal_connect(G_OBJECT(media), "reject",
-				 G_CALLBACK(jingle_rtp_reject_cb), session);
+				 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",
@@ -602,7 +598,16 @@ jingle_rtp_handle_action_internal(Jingle
 		}
 		case JINGLE_SESSION_TERMINATE: {
 			JingleSession *session = jingle_content_get_session(content);
-			purple_media_got_hangup(jingle_rtp_get_media(session));
+			PurpleMedia *media = jingle_rtp_get_media(session);
+
+			if (media != NULL) {
+				gchar *sid = jingle_session_get_sid(session);
+				purple_media_got_hangup(media);
+				g_hash_table_remove(jingle_session_get_js(
+						session)->medias, sid);
+				g_free(sid);
+			}
+
 			g_object_unref(session);
 			break;
 		}


More information about the Commits mailing list