soc.2008.vv: 3ac0903e: Prevent multiple voice and video session...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Aug 15 01:51:12 EDT 2008


-----------------------------------------------------------------
Revision: 3ac0903e858ae91b4f0278f24d38cdf9c1fb1ce9
Ancestor: 6b52db8e945d389c0bbba362698db94561030c30
Author: maiku at soc.pidgin.im
Date: 2008-08-14T23:14:56
Branch: im.pidgin.soc.2008.vv
URL: http://d.pidgin.im/viewmtn/revision/info/3ac0903e858ae91b4f0278f24d38cdf9c1fb1ce9

Modified files:
        libpurple/protocols/jabber/jingle.c pidgin/gtkconv.c

ChangeLog: 

Prevent multiple voice and video sessions within the same conversation.
Properly update the menu when starting or stopping a media session.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle.c	fa78ec592ad290ad45bbca3ba0f3a41aa6abd4e0
+++ libpurple/protocols/jabber/jingle.c	f4ea6492356baf0a141a711acd5c03c443357ffb
@@ -1414,6 +1414,13 @@ jabber_jingle_session_parse(JabberStream
 			purple_debug_error("jingle", "Jingle session with "
 					"id={%s} already exists\n", sid);
 			/* send iq error */
+		} else if ((session = jabber_jingle_session_find_by_jid(js,
+				xmlnode_get_attrib(packet, "from")))) {
+			purple_debug_fatal("jingle", "Jingle session with "
+					"jid={%s} already exists\n",
+					xmlnode_get_attrib(packet, "from"));
+			/* send jingle redirect packet */
+			return;
 		} else {
 			session = jabber_jingle_session_create_by_id(js, sid);
 			jabber_jingle_session_handle_session_initiate(session, jingle);
============================================================
--- pidgin/gtkconv.c	5cf4dacd65b4268f45f7d10df59b98f8c823c323
+++ pidgin/gtkconv.c	aa9aa44038e92cd130bae3b41be6c00346454504
@@ -6381,7 +6381,8 @@ gray_stuff_out(PidginConversation *gtkco
 		/* check if account support voice calls, and if the current buddy
 			supports it */
 		if (account != NULL && purple_conversation_get_type(conv)
-					== PURPLE_CONV_TYPE_IM) {
+					== PURPLE_CONV_TYPE_IM
+					&& gtkconv->gtkmedia == NULL) {
 			gboolean audio = purple_prpl_can_do_media(account,
 					purple_conversation_get_name(conv),
 					PURPLE_MEDIA_AUDIO);
@@ -7732,6 +7733,13 @@ static void
 }
 
 static void
+pidgin_conv_gtkmedia_destroyed(GtkWidget *widget, PidginConversation *gtkconv)
+{
+	gtk_widget_destroyed(widget, &(gtkconv->gtkmedia));
+	gray_stuff_out(gtkconv);
+}
+
+static void
 pidgin_conv_new_media_cb(PurpleMediaManager *manager, PurpleMedia *media, gpointer nul)
 {
 	GtkWidget *gtkmedia;
@@ -7751,10 +7759,13 @@ pidgin_conv_new_media_cb(PurpleMediaMana
 	g_signal_connect(G_OBJECT(gtkmedia), "message", G_CALLBACK(pidgin_gtkmedia_message_cb), conv);
 
 	gtkconv->gtkmedia = gtkmedia;
-	g_signal_connect(G_OBJECT(gtkmedia), "destroy", G_CALLBACK(gtk_widget_destroyed), &(gtkconv->gtkmedia));
+	g_signal_connect(G_OBJECT(gtkmedia), "destroy", G_CALLBACK(
+			pidgin_conv_gtkmedia_destroyed), gtkconv);
 
 	gtk_paned_pack2(GTK_PANED(gtkconv->middle_hpaned),
 			pidgin_media_get_display_widget(gtkmedia), FALSE, TRUE);
+
+	gray_stuff_out(gtkconv);
 }
 
 #endif


More information about the Commits mailing list