changeset 26209:df133a5df391

Have purple_media_codecs_ready handle a session wildcard.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 25 Feb 2009 08:18:17 +0000
parents 23816d2e380f
children 20c16e29f364
files libpurple/media.c
diffstat 1 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Wed Feb 25 07:22:08 2009 +0000
+++ b/libpurple/media.c	Wed Feb 25 08:18:17 2009 +0000
@@ -2265,17 +2265,30 @@
 gboolean
 purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id)
 {
-	PurpleMediaSession *session;
 	gboolean ret;
 
 	g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
 
-	session = purple_media_get_session(media, sess_id);
+	if (sess_id != NULL) {
+		PurpleMediaSession *session;
+		session = purple_media_get_session(media, sess_id);
+
+		if (session == NULL)
+			return FALSE;
 
-	if (session == NULL)
-		return FALSE;
-
-	g_object_get(session->session, "codecs-ready", &ret, NULL);
+		g_object_get(session->session, "codecs-ready", &ret, NULL);
+	} else {
+		GList *values = g_hash_table_get_values(media->priv->sessions);
+		for (; values; values = g_list_delete_link(values, values)) {
+			PurpleMediaSession *session = values->data;
+			g_object_get(session->session,
+					"codecs-ready", &ret, NULL);
+			if (ret == FALSE)
+				break;
+		}
+		if (values != NULL)
+			g_list_free(values);
+	}
 	return ret;
 }