soc.2008.vv: cf532e43: Stop additional media sessions within a ...

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


-----------------------------------------------------------------
Revision: cf532e43f57d6be724178e89e68c332876020e46
Ancestor: d52eb77bab3a6ac86490556203955b1b400159c9
Author: maiku at soc.pidgin.im
Date: 2008-08-15T04:07:00
Branch: im.pidgin.soc.2008.vv
URL: http://d.pidgin.im/viewmtn/revision/info/cf532e43f57d6be724178e89e68c332876020e46

Modified files:
        finch/gntmedia.c libpurple/marshallers.list
        libpurple/mediamanager.c libpurple/protocols/jabber/jingle.c
        pidgin/gtkconv.c

ChangeLog: 

Stop additional media sessions within a single conversation for grouped contacts.

-------------- next part --------------
============================================================
--- finch/gntmedia.c	f810100beffc4da865820d6b17d4f3c0ffd2e8fb
+++ finch/gntmedia.c	d713a7b780dfa0c2e3456c9817c748aa0b8275cb
@@ -413,7 +413,7 @@ gntmedia_message_cb(FinchMedia *gntmedia
 	}
 }
 
-static void
+static gboolean
 finch_new_media(PurpleMediaManager *manager, PurpleMedia *media, gpointer null)
 {
 	GntWidget *gntmedia;
@@ -427,6 +427,7 @@ finch_new_media(PurpleMediaManager *mana
 	g_signal_connect(G_OBJECT(gntmedia), "message", G_CALLBACK(gntmedia_message_cb), conv);
 	FINCH_MEDIA(gntmedia)->priv->conv = conv;
 	finch_conversation_set_info_widget(conv, gntmedia);
+	return TRUE;
 }
 
 static PurpleCmdRet
============================================================
--- libpurple/marshallers.list	d1f9f33832013c4030d1df1d2b977be2cb81d358
+++ libpurple/marshallers.list	ba136efaa6bc72e65bd763daf96b47d91f60dacb
@@ -1,2 +1,3 @@ VOID:POINTER,POINTER,OBJECT
 VOID:BOXED,BOXED
 VOID:POINTER,POINTER,OBJECT
+BOOLEAN:OBJECT
============================================================
--- libpurple/mediamanager.c	c4814e6a4688301661ec232593243f5d728d1b9b
+++ libpurple/mediamanager.c	aeaf18686f1e4d8236d0512cf2b76f2898b53066
@@ -27,6 +27,7 @@
 #include "internal.h"
 
 #include "connection.h"
+#include "marshallers.h"
 #include "mediamanager.h"
 #include "media.h"
 
@@ -100,8 +101,8 @@ purple_media_manager_class_init (PurpleM
 		G_TYPE_FROM_CLASS (klass),
 		G_SIGNAL_RUN_LAST,
 		0, NULL, NULL,
-		g_cclosure_marshal_VOID__OBJECT,
-		G_TYPE_NONE, 1, PURPLE_TYPE_MEDIA);
+		purple_smarshal_BOOLEAN__OBJECT,
+		G_TYPE_BOOLEAN, 1, PURPLE_TYPE_MEDIA);
 	g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate));
 }
 
@@ -137,6 +138,7 @@ purple_media_manager_create_media(Purple
 	PurpleMedia *media;
 	FsConference *conference = FS_CONFERENCE(gst_element_factory_make(conference_type, NULL));
 	GstStateChangeReturn ret;
+	gboolean signal_ret;
 
 	media = PURPLE_MEDIA(g_object_new(purple_media_get_type(),
 			     "screenname", remote_user,
@@ -154,8 +156,15 @@ purple_media_manager_create_media(Purple
 		return NULL;
 	}
 
+	g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0,
+			media, &signal_ret);
+
+	if (signal_ret == FALSE) {
+		g_object_unref(media);
+		return NULL;
+	}
+
 	manager->priv->medias = g_list_append(manager->priv->medias, media);
-	g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0, media);
 	return media;
 }
 
============================================================
--- libpurple/protocols/jabber/jingle.c	e0ca3a761ac99b1e499175f72a1cf57158dfa373
+++ libpurple/protocols/jabber/jingle.c	f6b3635b7aa719517a22ec766cfb53753c25cf0d
@@ -936,8 +936,11 @@ jabber_jingle_session_initiate_media_int
 	media = purple_media_manager_create_media(purple_media_manager_get(), 
 						  session->js->gc, "fsrtpconference", remote_jid);
 
+	jabber_jingle_session_set_remote_jid(session, remote_jid);
+	jabber_jingle_session_set_initiator(session, initiator);
+
 	if (!media) {
-		purple_debug_error("jingle", "Couldn't create fsrtpconference\n");
+		purple_debug_error("jingle", "Couldn't create media session\n");
 		return FALSE;
 	}
 
@@ -959,13 +962,10 @@ jabber_jingle_session_initiate_media_int
 
 		if (!result) {
 			purple_debug_error("jingle", "Couldn't create stream\n");
-			purple_media_reject(media);
 			return FALSE;
 		}
 	}
 
-	jabber_jingle_session_set_remote_jid(session, remote_jid);
-	jabber_jingle_session_set_initiator(session, initiator);
 	jabber_jingle_session_set_media(session, media);
 
 	/* connect callbacks */
@@ -1284,8 +1284,7 @@ jabber_jingle_session_handle_session_ini
 
 	if (!jabber_jingle_session_initiate_media_internal(session, initiator, initiator)) {
 		purple_debug_error("jingle", "Couldn't start media session with %s\n", initiator);
-		jabber_jingle_session_destroy(session);
-		/* we should create an error iq here */
+		jabber_jingle_session_send_session_reject(session);
 		return;
 	}
 
============================================================
--- pidgin/gtkconv.c	aa9aa44038e92cd130bae3b41be6c00346454504
+++ pidgin/gtkconv.c	807134f4b8cedccc82bdaf57e1031a81517eacac
@@ -7739,7 +7739,7 @@ pidgin_conv_gtkmedia_destroyed(GtkWidget
 	gray_stuff_out(gtkconv);
 }
 
-static void
+static gboolean
 pidgin_conv_new_media_cb(PurpleMediaManager *manager, PurpleMedia *media, gpointer nul)
 {
 	GtkWidget *gtkmedia;
@@ -7750,9 +7750,12 @@ pidgin_conv_new_media_cb(PurpleMediaMana
 				       purple_connection_get_account(purple_media_get_connection(media)),
 				       purple_media_get_screenname(media));
 	gtkconv = PIDGIN_CONVERSATION(conv);
-	if (gtkconv->gtkmedia)
-		gtk_widget_destroy(gtkconv->gtkmedia);
 
+	if (gtkconv->gtkmedia) {
+		purple_debug_info("gtkconv", "Media session exists for this conversation.\n");
+		return FALSE;
+	}
+
 	gtkmedia = pidgin_media_new(media);
 	gtk_box_pack_start(GTK_BOX(gtkconv->topvbox), gtkmedia, FALSE, FALSE, 0);
 	gtk_widget_show(gtkmedia);
@@ -7766,6 +7769,7 @@ pidgin_conv_new_media_cb(PurpleMediaMana
 			pidgin_media_get_display_widget(gtkmedia), FALSE, TRUE);
 
 	gray_stuff_out(gtkconv);
+	return TRUE;
 }
 
 #endif


More information about the Commits mailing list