changeset 26392:17929a84c1fb

Change purple_media_candidates_prepared to use wildcards.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Thu, 19 Mar 2009 22:57:53 +0000
parents b7b0513604e6
children 0083c73e004b
files libpurple/media.c libpurple/media.h
diffstat 2 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Thu Mar 19 22:08:21 2009 +0000
+++ b/libpurple/media.c	Thu Mar 19 22:57:53 2009 +0000
@@ -2239,28 +2239,26 @@
 }
 
 gboolean
-purple_media_candidates_prepared(PurpleMedia *media, const gchar *name)
+purple_media_candidates_prepared(PurpleMedia *media,
+		const gchar *session_id, const gchar *participant)
 {
-	GList *sessions;
+	GList *streams;
+	gboolean prepared = TRUE;
 
 	g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
 
-	sessions = purple_media_get_session_names(media);
-
-	for (; sessions; sessions = sessions->next) {
-		const gchar *session = sessions->data;
-		GList *local = purple_media_get_active_local_candidates(
-				media, session, name);
-		GList *remote = purple_media_get_active_remote_candidates(
-				media, session, name);
-		gboolean result = (local == NULL || remote == NULL);
-		purple_media_candidate_list_free(local);
-		purple_media_candidate_list_free(remote);
-		if (!result)
-			return FALSE;
+	streams = purple_media_get_streams(media, session_id, participant);
+
+	for (; streams; streams = g_list_delete_link(streams, streams)) {
+		PurpleMediaStream *stream = streams->data;
+		if (stream->candidates_prepared == FALSE) {
+			g_list_free(streams);
+			prepared = FALSE;
+			break;
+		}
 	}
 
-	return TRUE;
+	return prepared;
 }
 
 gboolean
--- a/libpurple/media.h	Thu Mar 19 22:08:21 2009 +0000
+++ b/libpurple/media.h	Thu Mar 19 22:57:53 2009 +0000
@@ -607,14 +607,16 @@
 					const gchar *name, GList *codecs);
 
 /**
- * Returns whether or not the candidates for a remote user are prepared
+ * Returns whether or not the candidates for set of streams are prepared
  *
  * @param media The media object to find the remote user in.
- * @param name The remote user to check for.
+ * @param session_id The session id of the session to check.
+ * @param participant The remote user to check for.
  *
- * @return @c TRUE All streams for the remote user have candidates prepared, @c FALSE otherwise.
+ * @return @c TRUE All streams for the given session_id/participant combination have candidates prepared, @c FALSE otherwise.
  */
-gboolean purple_media_candidates_prepared(PurpleMedia *media, const gchar *name);
+gboolean purple_media_candidates_prepared(PurpleMedia *media,
+		const gchar *session_id, const gchar *participant);
 
 /**
  * Sets the send codec for the a session.