changeset 26140:ac56e5707a72

Added purple_media_end and removed the purple_media_got_hangup.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 27 Jan 2009 07:48:03 +0000
parents 128a3175668e
children 1ff5304f6e9d
files libpurple/media.c libpurple/media.h libpurple/protocols/jabber/google.c libpurple/protocols/jabber/jingle/rtp.c
diffstat 4 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Sat Jan 24 12:01:34 2009 +0000
+++ b/libpurple/media.c	Tue Jan 27 07:48:03 2009 +0000
@@ -1238,9 +1238,7 @@
 	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);
+	purple_media_end(media, NULL, NULL);
 }
 
 void
@@ -1249,17 +1247,17 @@
 	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);
+	purple_media_end(media, NULL, NULL);
 }
 
 void
-purple_media_got_hangup(PurpleMedia *media)
+purple_media_end(PurpleMedia *media,
+		const gchar *session_id, const gchar *participant)
 {
-	g_signal_emit(media, purple_media_signals[STATE_CHANGED],
-			0, PURPLE_MEDIA_STATE_CHANGED_END,
-			NULL, NULL);
+	if (session_id == NULL && participant == NULL)
+		g_signal_emit(media, purple_media_signals[STATE_CHANGED],
+				0, PURPLE_MEDIA_STATE_CHANGED_END,
+				NULL, NULL);
 }
 
 GList*
--- a/libpurple/media.h	Sat Jan 24 12:01:34 2009 +0000
+++ b/libpurple/media.h	Tue Jan 27 07:48:03 2009 +0000
@@ -401,11 +401,14 @@
 void purple_media_hangup(PurpleMedia *media);
 
 /**
- * Set the media session to the got_hangup state.
+ * Ends all streams that match the given parameters
  *
- * @param media The media object to set the state on.
+ * @param media The media object with which to end streams.
+ * @param session_id The session to end streams on.
+ * @param participant The participant to end streams with.
  */
-void purple_media_got_hangup(PurpleMedia *media);
+void purple_media_end(PurpleMedia *media, const gchar *session_id,
+		const gchar *participant);
 
 /**
  * Enumerates a list of devices.
--- a/libpurple/protocols/jabber/google.c	Sat Jan 24 12:01:34 2009 +0000
+++ b/libpurple/protocols/jabber/google.c	Tue Jan 27 07:48:03 2009 +0000
@@ -446,13 +446,13 @@
 static void
 google_session_handle_reject(JabberStream *js, GoogleSession *session, xmlnode *packet, xmlnode *sess)
 {
-	purple_media_got_hangup(session->media);
+	purple_media_end(session->media, NULL, NULL);
 }
 
 static void
 google_session_handle_terminate(JabberStream *js, GoogleSession *session, xmlnode *packet, xmlnode *sess)
 {
-	purple_media_got_hangup(session->media);
+	purple_media_end(session->media, NULL, NULL);
 }
 
 static void
--- a/libpurple/protocols/jabber/jingle/rtp.c	Sat Jan 24 12:01:34 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Tue Jan 27 07:48:03 2009 +0000
@@ -594,7 +594,7 @@
 
 			if (media != NULL) {
 				gchar *sid = jingle_session_get_sid(session);
-				purple_media_got_hangup(media);
+				purple_media_end(media, NULL, NULL);
 				g_hash_table_remove(jingle_session_get_js(
 						session)->medias, sid);
 				g_free(sid);