changeset 26111:8b16e5fcaa32

Added reject and hangup states to the state-changed signal.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 13 Jan 2009 05:32:34 +0000
parents 3fd5bda55d76
children 027ce238eb40
files libpurple/media.c libpurple/media.h libpurple/protocols/jabber/jingle/rtp.c
diffstat 3 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Tue Jan 13 03:02:42 2009 +0000
+++ b/libpurple/media.c	Tue Jan 13 05:32:34 2009 +0000
@@ -1313,6 +1313,9 @@
 purple_media_hangup(PurpleMedia *media)
 {
 	g_signal_emit(media, purple_media_signals[STATE_CHANGED],
+			0, PURPLE_MEDIA_STATE_CHANGED_HANGUP,
+			NULL, NULL);
+	g_signal_emit(media, purple_media_signals[STATE_CHANGED],
 			0, PURPLE_MEDIA_STATE_CHANGED_END,
 			NULL, NULL);
 	g_signal_emit(media, purple_media_signals[HANGUP], 0);
@@ -1322,6 +1325,9 @@
 purple_media_reject(PurpleMedia *media)
 {
 	g_signal_emit(media, purple_media_signals[STATE_CHANGED],
+			0, PURPLE_MEDIA_STATE_CHANGED_REJECTED,
+			NULL, NULL);
+	g_signal_emit(media, purple_media_signals[STATE_CHANGED],
 			0, PURPLE_MEDIA_STATE_CHANGED_END,
 			NULL, NULL);
 	g_signal_emit(media, purple_media_signals[REJECT], 0);
@@ -1336,15 +1342,9 @@
 void
 purple_media_got_hangup(PurpleMedia *media)
 {
-/*
- * There's no way to tell who hung up with the new structure.
- * I'm commenting this out until this is resolved.
- */
-#if 0
 	g_signal_emit(media, purple_media_signals[STATE_CHANGED],
 			0, PURPLE_MEDIA_STATE_CHANGED_END,
 			NULL, NULL);
-#endif
 	g_signal_emit(media, purple_media_signals[GOT_HANGUP], 0);
 }
 
--- a/libpurple/media.h	Tue Jan 13 03:02:42 2009 +0000
+++ b/libpurple/media.h	Tue Jan 13 05:32:34 2009 +0000
@@ -80,6 +80,8 @@
 typedef enum {
 	PURPLE_MEDIA_STATE_CHANGED_NEW = 0,
 	PURPLE_MEDIA_STATE_CHANGED_CONNECTED,
+	PURPLE_MEDIA_STATE_CHANGED_REJECTED,	/** Local user rejected the stream. */
+	PURPLE_MEDIA_STATE_CHANGED_HANGUP,	/** Local user hung up the stream */
 	PURPLE_MEDIA_STATE_CHANGED_END,
 } PurpleMediaStateChangedType;
 
--- a/libpurple/protocols/jabber/jingle/rtp.c	Tue Jan 13 03:02:42 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Tue Jan 13 05:32:34 2009 +0000
@@ -320,7 +320,8 @@
 {
 	purple_debug_info("jingle-rtp", "state-changed: type %d id: %s name: %s\n", type, sid, name);
 
-	if (type == PURPLE_MEDIA_STATE_CHANGED_END &&
+	if ((type == PURPLE_MEDIA_STATE_CHANGED_REJECTED ||
+			type == PURPLE_MEDIA_STATE_CHANGED_HANGUP) &&
 			sid == NULL && name == NULL) {
 		gchar *sid = jingle_session_get_sid(session);
 		jabber_iq_send(jingle_session_to_packet(session,