# HG changeset patch # User maiku@pidgin.im # Date 1255989799 0 # Node ID 2c4a3703324b8f2a5a0eda47e24ac18eacea65aa # Parent e0519a0c9f4661182818494ec53f1c0d1c960a75 Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals. diff -r e0519a0c9f46 -r 2c4a3703324b libpurple/media.c --- a/libpurple/media.c Mon Oct 19 20:49:25 2009 +0000 +++ b/libpurple/media.c Mon Oct 19 22:03:19 2009 +0000 @@ -103,6 +103,8 @@ gboolean initiator; gboolean accepted; gboolean candidates_prepared; + gboolean held; + gboolean paused; GList *active_local_candidates; GList *active_remote_candidates; @@ -2330,11 +2332,46 @@ for (; streams; streams = g_list_delete_link(streams, streams)) { PurpleMediaStream *stream = streams->data; if (stream->session->type & PURPLE_MEDIA_SEND_VIDEO) { + stream->paused = active; + + if (!stream->held) + g_object_set(stream->stream, "direction", + purple_media_to_fs_stream_direction( + stream->session->type & ((active) ? + ~PURPLE_MEDIA_SEND_VIDEO : + PURPLE_MEDIA_VIDEO)), NULL); + } + } + } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_HOLD || + type == PURPLE_MEDIA_INFO_UNHOLD)) { + GList *streams; + gboolean active = (type == PURPLE_MEDIA_INFO_HOLD); + + g_return_if_fail(PURPLE_IS_MEDIA(media)); + + streams = purple_media_get_streams(media, + session_id, participant); + for (; streams; streams = g_list_delete_link(streams, streams)) { + PurpleMediaStream *stream = streams->data; + stream->held = active; + if (stream->session->type & PURPLE_MEDIA_VIDEO) { + FsStreamDirection direction; + + direction = ((active) ? + ~PURPLE_MEDIA_VIDEO : + PURPLE_MEDIA_VIDEO); + if (!active && stream->paused) + direction &= ~PURPLE_MEDIA_SEND_VIDEO; + + g_object_set(stream->stream, "direction", + purple_media_to_fs_stream_direction( + stream->session->type & direction), NULL); + } else if (stream->session->type & PURPLE_MEDIA_AUDIO) { g_object_set(stream->stream, "direction", purple_media_to_fs_stream_direction( stream->session->type & ((active) ? - ~PURPLE_MEDIA_SEND_VIDEO : - PURPLE_MEDIA_VIDEO)), NULL); + ~PURPLE_MEDIA_AUDIO : + PURPLE_MEDIA_AUDIO)), NULL); } } }