cpw.maiku.media_refactor: 43ca0a1a: Store local_candidates in PurpleMedia as...

maiku at pidgin.im maiku at pidgin.im
Mon Oct 26 22:45:49 EDT 2009


-----------------------------------------------------------------
Revision: 43ca0a1a8d5589a97ee239c174da4d587b8350ea
Ancestor: e2d829e3481a8f6356b24ff8d36c23fbe01190a1
Author: maiku at pidgin.im
Date: 2009-10-26T18:32:27
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/43ca0a1a8d5589a97ee239c174da4d587b8350ea

Modified files:
        libpurple/media/media.c

ChangeLog: 

Store local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.

-------------- next part --------------
============================================================
--- libpurple/media/media.c	dea81b92cb1c4d24f4e4f98a70d3744e47452c66
+++ libpurple/media/media.c	e980603481b9634fa85cb0ce0cef951b56369297
@@ -323,7 +323,7 @@ purple_media_stream_free(PurpleMediaStre
 	g_free(stream->participant);
 
 	if (stream->local_candidates)
-		fs_candidate_list_destroy(stream->local_candidates);
+		purple_media_candidate_list_free(stream->local_candidates);
 	if (stream->remote_candidates)
 		fs_candidate_list_destroy(stream->remote_candidates);
 
@@ -565,43 +565,7 @@ purple_media_candidate_to_fs(PurpleMedia
 	return fscandidate;
 }
 
-static PurpleMediaCandidate *
-purple_media_candidate_from_fs(FsCandidate *fscandidate)
-{
-	PurpleMediaCandidate *candidate;
-
-	if (fscandidate == NULL)
-		return NULL;
-
-	candidate = purple_media_candidate_new(fscandidate->foundation,
-		fscandidate->component_id, fscandidate->type,
-		fscandidate->proto, fscandidate->ip, fscandidate->port);
-	g_object_set(candidate,
-			"base-ip", fscandidate->base_ip,
-			"base-port", fscandidate->base_port,
-			"priority", fscandidate->priority,
-			"username", fscandidate->username,
-			"password", fscandidate->password,
-			"ttl", fscandidate->ttl, NULL);
-	return candidate;
-}
-
 static GList *
-purple_media_candidate_list_from_fs(GList *candidates)
-{
-	GList *new_list = NULL;
-
-	for (; candidates; candidates = g_list_next(candidates)) {
-		new_list = g_list_prepend(new_list,
-				purple_media_candidate_from_fs(
-				candidates->data));
-	}
-
-	new_list = g_list_reverse(new_list);
-	return new_list;
-}
-
-static GList *
 purple_media_candidate_list_to_fs(GList *candidates)
 {
 	GList *new_list = NULL;
@@ -884,7 +848,7 @@ purple_media_insert_local_candidate(Purp
 
 static void
 purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name,
-				     FsCandidate *candidate)
+				     PurpleMediaCandidate *candidate)
 {
 	PurpleMediaStream *stream;
 
@@ -1231,7 +1195,7 @@ purple_media_new_local_candidate_cb(Purp
 			purple_media_get_session(media, sess_id);
 
 	purple_media_insert_local_candidate(session, participant,
-			purple_media_candidate_to_fs(candidate));
+			purple_media_candidate_copy(candidate));
 
 	g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE],
 		      0, session->id, participant, candidate);
@@ -1687,7 +1651,7 @@ purple_media_get_local_candidates(Purple
 	PurpleMediaStream *stream;
 	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
 	stream = purple_media_get_stream(media, sess_id, participant);
-	return stream ? purple_media_candidate_list_from_fs(
+	return stream ? purple_media_candidate_list_copy(
 			stream->local_candidates) : NULL;
 #else
 	return NULL;


More information about the Commits mailing list