Mercurial > pidgin
changeset 23872:1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Fri, 15 Aug 2008 04:07:00 +0000 |
parents | b5ba1ab6ebdc |
children | 89d873e217c1 |
files | finch/gntmedia.c libpurple/marshallers.list libpurple/mediamanager.c libpurple/protocols/jabber/jingle.c pidgin/gtkconv.c |
diffstat | 5 files changed, 27 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/gntmedia.c Thu Aug 14 23:23:41 2008 +0000 +++ b/finch/gntmedia.c Fri Aug 15 04:07:00 2008 +0000 @@ -413,7 +413,7 @@ } } -static void +static gboolean finch_new_media(PurpleMediaManager *manager, PurpleMedia *media, gpointer null) { GntWidget *gntmedia; @@ -427,6 +427,7 @@ 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
--- a/libpurple/marshallers.list Thu Aug 14 23:23:41 2008 +0000 +++ b/libpurple/marshallers.list Fri Aug 15 04:07:00 2008 +0000 @@ -1,2 +1,3 @@ VOID:BOXED,BOXED VOID:POINTER,POINTER,OBJECT +BOOLEAN:OBJECT
--- a/libpurple/mediamanager.c Thu Aug 14 23:23:41 2008 +0000 +++ b/libpurple/mediamanager.c Fri Aug 15 04:07:00 2008 +0000 @@ -27,6 +27,7 @@ #include "internal.h" #include "connection.h" +#include "marshallers.h" #include "mediamanager.h" #include "media.h" @@ -100,8 +101,8 @@ 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 @@ 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 @@ 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; }
--- a/libpurple/protocols/jabber/jingle.c Thu Aug 14 23:23:41 2008 +0000 +++ b/libpurple/protocols/jabber/jingle.c Fri Aug 15 04:07:00 2008 +0000 @@ -936,8 +936,11 @@ 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 @@ 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 @@ 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; }
--- a/pidgin/gtkconv.c Thu Aug 14 23:23:41 2008 +0000 +++ b/pidgin/gtkconv.c Fri Aug 15 04:07:00 2008 +0000 @@ -7739,7 +7739,7 @@ gray_stuff_out(gtkconv); } -static void +static gboolean pidgin_conv_new_media_cb(PurpleMediaManager *manager, PurpleMedia *media, gpointer nul) { GtkWidget *gtkmedia; @@ -7750,8 +7750,11 @@ 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); @@ -7766,6 +7769,7 @@ pidgin_media_get_display_widget(gtkmedia), FALSE, TRUE); gray_stuff_out(gtkconv); + return TRUE; } #endif