changeset 29596:ecdf669adac9

Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream, session, participant, and conference.
author maiku@pidgin.im
date Wed, 28 Oct 2009 00:12:19 +0000
parents 918d4043cc33
children 86c23178a4fc
files libpurple/media/media.c
diffstat 1 files changed, 52 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media/media.c	Tue Oct 27 23:44:34 2009 +0000
+++ b/libpurple/media/media.c	Wed Oct 28 00:12:19 2009 +0000
@@ -731,19 +731,70 @@
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
 
 	if (type == PURPLE_MEDIA_INFO_ACCEPT) {
-		GList *streams;
+		GList *streams, *sessions = NULL, *participants = NULL;
 
 		g_return_if_fail(PURPLE_IS_MEDIA(media));
 
 		streams = purple_media_get_streams(media,
 				session_id, participant);
 
+		/* Emit stream acceptance */
 		for (; streams; streams =
 				g_list_delete_link(streams, streams)) {
 			PurpleMediaStream *stream = streams->data;
 
 			stream->accepted = TRUE;
+
+			g_signal_emit(media,
+					purple_media_signals[STREAM_INFO],
+					0, type, stream->session->id,
+					stream->participant, local);
+
+			if (g_list_find(sessions, stream->session) == NULL)
+				sessions = g_list_prepend(sessions,
+						stream->session);
+
+			if (g_list_find_custom(participants,
+					stream->participant,
+					(GCompareFunc)strcmp) == NULL)
+				participants = g_list_prepend(participants,
+						g_strdup(stream->participant));
 		}
+
+		/* Emit session acceptance */
+		for (; sessions; sessions =
+				g_list_delete_link(sessions, sessions)) {
+			PurpleMediaSession *session = sessions->data;
+
+			if (purple_media_accepted(media, session->id, NULL))
+				g_signal_emit(media, purple_media_signals[
+						STREAM_INFO], 0,
+						PURPLE_MEDIA_INFO_ACCEPT,
+						session->id, NULL, local);
+		}
+
+		/* Emit participant acceptance */
+		for (; participants; participants = g_list_delete_link(
+				participants, participants)) {
+			gchar *participant = participants->data;
+
+			if (purple_media_accepted(media, NULL, participant))
+				g_signal_emit(media, purple_media_signals[
+						STREAM_INFO], 0,
+						PURPLE_MEDIA_INFO_ACCEPT,
+						NULL, participant, local);
+
+			g_free(participant);
+		}
+
+		/* Emit conference acceptance */
+		if (purple_media_accepted(media, NULL, NULL))
+			g_signal_emit(media,
+					purple_media_signals[STREAM_INFO],
+					0, PURPLE_MEDIA_INFO_ACCEPT,
+					NULL, NULL, local);
+
+		return;
 	}
 
 	g_signal_emit(media, purple_media_signals[STREAM_INFO],