cpw.maiku.media_refactor: 18dbb06c: Remove the list of participants from Pur...

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


-----------------------------------------------------------------
Revision: 18dbb06c5d2babc88ef56466aaed03e08a1f397d
Ancestor: 5b820936ee9f2e2c1dfa0d12eac1a3781c0853e4
Author: maiku at pidgin.im
Date: 2009-10-26T20:17:35
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/18dbb06c5d2babc88ef56466aaed03e08a1f397d

Modified files:
        libpurple/media/media.c

ChangeLog: 

Remove the list of participants from PurpleMedia and use the Fs2 backend's.

-------------- next part --------------
============================================================
--- libpurple/media/media.c	f0921ad635849c9a38df4f2cf63d93a2793e1484
+++ libpurple/media/media.c	5cbf76fdd1d09c2a781fb9166db6d6ede1d41b35
@@ -118,7 +118,6 @@ struct _PurpleMediaPrivate
 	gpointer prpl_data;
 
 	GHashTable *sessions;	/* PurpleMediaSession table */
-	GHashTable *participants; /* FsParticipant table */
 
 	GList *streams;		/* PurpleMediaStream table */
 
@@ -370,12 +369,6 @@ purple_media_dispose(GObject *media)
 		}
 	}
 
-	if (priv->participants) {
-		GList *participants = g_hash_table_get_values(priv->participants);
-		for (; participants; participants = g_list_delete_link(participants, participants))
-			g_object_unref(participants->data);
-	}
-
 	if (priv->gst_bus_handler_id != 0) {
 		GstElement *pipeline = purple_media_manager_get_pipeline(
 				priv->manager);
@@ -726,14 +719,6 @@ purple_media_get_session(PurpleMedia *me
 			g_hash_table_lookup(media->priv->sessions, sess_id) : NULL;
 }
 
-static FsParticipant*
-purple_media_get_participant(PurpleMedia *media, const gchar *name)
-{
-	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
-	return (FsParticipant*) (media->priv->participants) ?
-			g_hash_table_lookup(media->priv->participants, name) : NULL;
-}
-
 static PurpleMediaStream*
 purple_media_get_stream(PurpleMedia *media, const gchar *session, const gchar *participant)
 {
@@ -796,40 +781,6 @@ purple_media_remove_session(PurpleMedia 
 	return g_hash_table_remove(media->priv->sessions, session->id);
 }
 
-static FsParticipant *
-purple_media_add_participant(PurpleMedia *media, const gchar *name)
-{
-	FsParticipant *participant;
-	GError *err = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
-
-	participant = purple_media_get_participant(media, name);
-
-	if (participant)
-		return participant;
-
-	participant = fs_conference_new_participant(media->priv->conference,
-						    (gchar*)name, &err);
-
-	if (err) {
-		purple_debug_error("media", "Error creating participant: %s\n",
-				   err->message);
-		g_error_free(err);
-		return NULL;
-	}
-
-	if (!media->priv->participants) {
-		purple_debug_info("media", "Creating hash table for participants\n");
-		media->priv->participants = g_hash_table_new_full(g_str_hash,
-				g_str_equal, g_free, NULL);
-	}
-
-	g_hash_table_insert(media->priv->participants, g_strdup(name), participant);
-
-	return participant;
-}
-
 static PurpleMediaStream *
 purple_media_insert_stream(PurpleMediaSession *session, const gchar *name, FsStream *stream)
 {
@@ -1475,15 +1426,8 @@ purple_media_add_stream(PurpleMedia *med
 		}
 	}
 
-	if (!(participant = purple_media_add_participant(media, who))) {
-		purple_media_remove_session(media, session);
-		g_free(session);
-		return FALSE;
-	} else {
-		g_signal_emit(media, purple_media_signals[STATE_CHANGED],
-				0, PURPLE_MEDIA_STATE_NEW,
-				NULL, who);
-	}
+	participant = purple_media_backend_fs2_get_participant(
+			PURPLE_MEDIA_BACKEND_FS2(media->priv->backend), who);
 
 	stream = purple_media_get_stream(media, sess_id, who);
 
@@ -1544,8 +1488,6 @@ purple_media_add_stream(PurpleMedia *med
 					g_value_array_free(relay_info);
 				} else {
 					purple_debug_error("media", "Error relay info");
-					g_object_unref(participant);
-					g_hash_table_remove(media->priv->participants, who);
 					purple_media_remove_session(media, session);
 					g_free(session);
 					return FALSE;
@@ -1571,8 +1513,6 @@ purple_media_add_stream(PurpleMedia *med
 					err->message : "NULL");
 			if (err)
 				g_error_free(err);
-			g_object_unref(participant);
-			g_hash_table_remove(media->priv->participants, who);
 			purple_media_remove_session(media, session);
 			g_free(session);
 			return FALSE;


More information about the Commits mailing list