cpw.maiku.media_refactor: 089fd476: Move odd direction changing functionalit...

maiku at pidgin.im maiku at pidgin.im
Tue Oct 27 20:27:27 EDT 2009


-----------------------------------------------------------------
Revision: 089fd476793edafc58e0e23a0c1a8b8ffec965eb
Ancestor: 88f466299fba0e44f90683f5e90576e1192fb393
Author: maiku at pidgin.im
Date: 2009-10-27T18:34:46
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/089fd476793edafc58e0e23a0c1a8b8ffec965eb

Modified files:
        libpurple/media/backend-fs2.c libpurple/media/media.c

ChangeLog: 

Move odd direction changing functionality to the Fs2 media backend.

-------------- next part --------------
============================================================
--- libpurple/media/backend-fs2.c	c9f5d0e95ff8375132008940f63acd4ddfd50bd4
+++ libpurple/media/backend-fs2.c	7c9a8736070842b5d1e1b70c6dc559a5146190ff
@@ -1416,6 +1416,7 @@ purple_media_backend_fs2_add_stream(Purp
 	PurpleMediaBackendFs2 *backend = PURPLE_MEDIA_BACKEND_FS2(self);
 	PurpleMediaBackendFs2Private *priv =
 			PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(backend);
+	PurpleMediaBackendFs2Stream *stream;
 
 	if (priv->conference == NULL && !_init_conference(backend)) {
 		purple_debug_error("backend-fs2",
@@ -1438,8 +1439,19 @@ purple_media_backend_fs2_add_stream(Purp
 		return FALSE;
 	}
 
-	if (_get_stream(backend, sess_id, who) == NULL &&
-			!_create_stream(backend, sess_id, who, type,
+	stream = _get_stream(backend, sess_id, who);
+
+	if (stream != NULL) {
+		FsStreamDirection type_direction =
+				_session_type_to_fs_stream_direction(type);
+
+		if (_session_type_to_fs_stream_direction(
+				stream->session->type) != type_direction) {
+			/* change direction */
+			g_object_set(stream->stream, "direction",
+					type_direction, NULL);
+		}
+	} else if (!_create_stream(backend, sess_id, who, type,
 			initiator, transmitter, num_params, params)) {
 		purple_debug_error("backend-fs2",
 				"Error creating the stream.\n");
============================================================
--- libpurple/media/media.c	f23d12b79180024af8760ada413c8fb15189bcca
+++ libpurple/media/media.c	dd3315cecca4db02ba77485f1e354d5434148b69
@@ -1230,9 +1230,7 @@ purple_media_add_stream(PurpleMedia *med
 	participant = purple_media_backend_fs2_get_participant(
 			PURPLE_MEDIA_BACKEND_FS2(media->priv->backend), who);
 
-	stream = purple_media_get_stream(media, sess_id, who);
-
-	if (!stream) {
+	if (purple_media_get_stream(media, sess_id, who) == NULL) {
 		FsStream *fsstream = NULL;
 
 		fsstream = purple_media_backend_fs2_get_stream(
@@ -1249,13 +1247,6 @@ purple_media_add_stream(PurpleMedia *med
 		g_signal_emit(media, purple_media_signals[STATE_CHANGED],
 				0, PURPLE_MEDIA_STATE_NEW,
 				session->id, who);
-	} else {
-		if (purple_media_to_fs_stream_direction(stream->session->type)
-				!= type_direction) {
-			/* change direction */
-			g_object_set(stream->stream, "direction",
-					type_direction, NULL);
-		}
 	}
 
 	return TRUE;


More information about the Commits mailing list