changeset 26448:4e1286e76f1f

Create purple_media_stream_info. Add local parameter to stream-info signal.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sun, 29 Mar 2009 23:00:33 +0000
parents 34eb898478b4
children 6943d2a41c6e
files finch/gntmedia.c libpurple/marshallers.list libpurple/media.c libpurple/media.h libpurple/protocols/jabber/google.c libpurple/protocols/jabber/jingle/rtp.c pidgin/gtkmedia.c
diffstat 7 files changed, 48 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntmedia.c	Sat Mar 28 00:58:02 2009 +0000
+++ b/finch/gntmedia.c	Sun Mar 29 23:00:33 2009 +0000
@@ -233,7 +233,7 @@
 
 static void
 finch_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
-		gchar *sid, gchar *name, FinchMedia *gntmedia)
+		gchar *sid, gchar *name, gboolean local, FinchMedia *gntmedia)
 {
 	if (type == PURPLE_MEDIA_INFO_REJECT) {
 		finch_media_emit_message(gntmedia,
--- a/libpurple/marshallers.list	Sat Mar 28 00:58:02 2009 +0000
+++ b/libpurple/marshallers.list	Sun Mar 29 23:00:33 2009 +0000
@@ -3,3 +3,4 @@
 BOOLEAN:OBJECT,POINTER,STRING
 VOID:STRING,STRING
 VOID:ENUM,STRING,STRING
+VOID:ENUM,STRING,STRING,BOOLEAN
--- a/libpurple/media.c	Sat Mar 28 00:58:02 2009 +0000
+++ b/libpurple/media.c	Sun Mar 29 23:00:33 2009 +0000
@@ -288,9 +288,9 @@
 					 G_TYPE_STRING, G_TYPE_STRING);
 	purple_media_signals[STREAM_INFO] = g_signal_new("stream-info", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
-					 purple_smarshal_VOID__ENUM_STRING_STRING,
-					 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_INFO_TYPE,
-					 G_TYPE_STRING, G_TYPE_STRING);
+					 purple_smarshal_VOID__ENUM_STRING_STRING_BOOLEAN,
+					 G_TYPE_NONE, 4, PURPLE_MEDIA_TYPE_INFO_TYPE,
+					 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
 	g_type_class_add_private(klass, sizeof(PurpleMediaPrivate));
 }
 
@@ -1406,7 +1406,7 @@
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
 	g_signal_emit(media, purple_media_signals[STREAM_INFO],
 			0, PURPLE_MEDIA_INFO_HANGUP,
-			NULL, NULL);
+			NULL, NULL, TRUE);
 	purple_media_end(media, NULL, NULL);
 #endif
 }
@@ -1418,7 +1418,7 @@
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
 	g_signal_emit(media, purple_media_signals[STREAM_INFO],
 			0, PURPLE_MEDIA_INFO_REJECT,
-			NULL, NULL);
+			NULL, NULL, TRUE);
 	purple_media_end(media, NULL, NULL);
 #endif
 }
@@ -1438,6 +1438,28 @@
 #endif
 }
 
+void
+purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type,
+		const gchar *session_id, const gchar *participant,
+		gboolean local)
+{
+#ifdef USE_VV
+	GList *streams;
+
+	g_return_if_fail(PURPLE_IS_MEDIA(media));
+
+	streams = purple_media_get_streams(media, session_id, participant);
+
+	for (; streams; streams = g_list_delete_link(streams, streams)) {
+		PurpleMediaStream *stream = streams->data;
+
+		g_signal_emit(media, purple_media_signals[STREAM_INFO],
+				0, type, stream->session->id,
+				stream->participant, local);
+	}
+#endif
+}
+
 #ifdef USE_VV
 static void
 purple_media_new_local_candidate_cb(FsStream *stream,
--- a/libpurple/media.h	Sat Mar 28 00:58:02 2009 +0000
+++ b/libpurple/media.h	Sun Mar 29 23:00:33 2009 +0000
@@ -378,6 +378,19 @@
 		const gchar *participant);
 
 /**
+ * Signals different information about the given stream.
+ *
+ * @param media The media instance to containing the stream to signal.
+ * @param type The type of info being signaled.
+ * @param session_id The id of the session of the stream being signaled.
+ * @param participant The participant of the stream being signaled.
+ * @param local TRUE if the info originated locally, FALSE if on the remote end.
+ */
+void purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type,
+		const gchar *session_id, const gchar *participant,
+		gboolean local);
+
+/**
  * Adds a stream to a session.
  *
  * It only adds a stream to one audio session or video session as
--- a/libpurple/protocols/jabber/google.c	Sat Mar 28 00:58:02 2009 +0000
+++ b/libpurple/protocols/jabber/google.c	Sun Mar 29 23:00:33 2009 +0000
@@ -238,7 +238,8 @@
 
 static void
 google_session_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
-		gchar *sid, gchar *name, GoogleSession *session)
+		gchar *sid, gchar *name, gboolean local,
+		GoogleSession *session)
 {
 	if (type == PURPLE_MEDIA_INFO_HANGUP) {
 		xmlnode *sess;
--- a/libpurple/protocols/jabber/jingle/rtp.c	Sat Mar 28 00:58:02 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Sun Mar 29 23:00:33 2009 +0000
@@ -444,7 +444,8 @@
 
 static void
 jingle_rtp_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
-		gchar *sid, gchar *name, JingleSession *session)
+		gchar *sid, gchar *name, gboolean local,
+		JingleSession *session)
 {
 	purple_debug_info("jingle-rtp", "stream-info: type %d "
 			"id: %s name: %s\n", type, sid, name);
--- a/pidgin/gtkmedia.c	Sat Mar 28 00:58:02 2009 +0000
+++ b/pidgin/gtkmedia.c	Sun Mar 29 23:00:33 2009 +0000
@@ -703,7 +703,8 @@
 
 static void
 pidgin_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
-		gchar *sid, gchar *name, PidginMedia *gtkmedia)
+		gchar *sid, gchar *name, gboolean local,
+		PidginMedia *gtkmedia)
 {
 	if (type == PURPLE_MEDIA_INFO_REJECT) {
 		pidgin_media_emit_message(gtkmedia,