pidgin.vv: 91814209: Move functionality into purple_media_str...
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Sun Mar 29 21:25:41 EDT 2009
-----------------------------------------------------------------
Revision: 91814209fea456958654529cd589e9488767be7e
Ancestor: 735d5ef88bf74257cfe554a96e9055e3a936284b
Author: maiku at soc.pidgin.im
Date: 2009-03-30T00:30:59
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/91814209fea456958654529cd589e9488767be7e
Modified files:
libpurple/media.c
ChangeLog:
Move functionality into purple_media_stream_info.
-------------- next part --------------
============================================================
--- libpurple/media.c 035168f31af2f763afe0749fba38465de0ee1050
+++ libpurple/media.c dc770e892823ff88958f77bbb28ac57b77ef7f7e
@@ -1386,22 +1386,8 @@ purple_media_accept(PurpleMedia *media)
purple_media_accept(PurpleMedia *media)
{
#ifdef USE_VV
- GList *streams;
-
- g_return_if_fail(PURPLE_IS_MEDIA(media));
-
- streams = media->priv->streams;
-
- for (; streams; streams = g_list_next(streams)) {
- PurpleMediaStream *stream = streams->data;
- g_object_set(G_OBJECT(stream->stream), "direction",
- purple_media_to_fs_stream_direction(
- stream->session->type), NULL);
- stream->accepted = TRUE;
- }
-
- g_signal_emit(media, purple_media_signals[ACCEPTED],
- 0, NULL, NULL);
+ purple_media_stream_info(media, PURPLE_MEDIA_INFO_ACCEPT,
+ NULL, NULL, TRUE);
#endif
}
@@ -1409,11 +1395,8 @@ purple_media_hangup(PurpleMedia *media)
purple_media_hangup(PurpleMedia *media)
{
#ifdef USE_VV
- g_return_if_fail(PURPLE_IS_MEDIA(media));
- g_signal_emit(media, purple_media_signals[STREAM_INFO],
- 0, PURPLE_MEDIA_INFO_HANGUP,
+ purple_media_stream_info(media, PURPLE_MEDIA_INFO_HANGUP,
NULL, NULL, TRUE);
- purple_media_end(media, NULL, NULL);
#endif
}
@@ -1421,11 +1404,8 @@ purple_media_reject(PurpleMedia *media)
purple_media_reject(PurpleMedia *media)
{
#ifdef USE_VV
- g_return_if_fail(PURPLE_IS_MEDIA(media));
- g_signal_emit(media, purple_media_signals[STREAM_INFO],
- 0, PURPLE_MEDIA_INFO_REJECT,
+ purple_media_stream_info(media, PURPLE_MEDIA_INFO_REJECT,
NULL, NULL, TRUE);
- purple_media_end(media, NULL, NULL);
#endif
}
@@ -1450,19 +1430,64 @@ purple_media_stream_info(PurpleMedia *me
gboolean local)
{
#ifdef USE_VV
- GList *streams;
+ g_return_if_fail(PURPLE_IS_MEDIA(media));
- g_return_if_fail(PURPLE_IS_MEDIA(media));
+ if (type == PURPLE_MEDIA_INFO_ACCEPT) {
+ GList *streams;
- streams = purple_media_get_streams(media, session_id, participant);
+ g_return_if_fail(PURPLE_IS_MEDIA(media));
- for (; streams; streams = g_list_delete_link(streams, streams)) {
- PurpleMediaStream *stream = streams->data;
+ streams = purple_media_get_streams(media,
+ session_id, participant);
- g_signal_emit(media, purple_media_signals[STREAM_INFO],
- 0, type, stream->session->id,
- stream->participant, local);
+ for (; streams; streams =
+ g_list_delete_link(streams, streams)) {
+ PurpleMediaStream *stream = streams->data;
+ g_object_set(G_OBJECT(stream->stream), "direction",
+ purple_media_to_fs_stream_direction(
+ stream->session->type), NULL);
+ stream->accepted = TRUE;
+ }
+
+ g_signal_emit(media, purple_media_signals[ACCEPTED],
+ 0, NULL, NULL);
+ } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
+ type == PURPLE_MEDIA_INFO_UNMUTE)) {
+ GList *sessions;
+ gboolean active = (type == PURPLE_MEDIA_INFO_MUTE);
+
+ g_return_if_fail(PURPLE_IS_MEDIA(media));
+
+ if (session_id == NULL)
+ sessions = g_hash_table_get_values(
+ media->priv->sessions);
+ else
+ sessions = g_list_prepend(NULL,
+ purple_media_get_session(
+ media, session_id));
+
+ purple_debug_info("media", "Turning mute %s\n",
+ active ? "on" : "off");
+
+ for (; sessions; sessions = g_list_delete_link(
+ sessions, sessions)) {
+ PurpleMediaSession *session = sessions->data;
+ if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
+ GstElement *volume = gst_bin_get_by_name(
+ GST_BIN(session->src),
+ "purpleaudioinputvolume");
+ g_object_set(volume, "mute", active, NULL);
+ }
+ }
}
+
+ g_signal_emit(media, purple_media_signals[STREAM_INFO],
+ 0, type, session_id, participant, local);
+
+ if (type == PURPLE_MEDIA_INFO_HANGUP ||
+ type == PURPLE_MEDIA_INFO_REJECT) {
+ purple_media_end(media, session_id, participant);
+ }
#endif
}
@@ -2175,22 +2200,8 @@ void purple_media_mute(PurpleMedia *medi
void purple_media_mute(PurpleMedia *media, gboolean active)
{
#ifdef USE_VV
- GList *sessions;
-
- g_return_if_fail(PURPLE_IS_MEDIA(media));
-
- sessions = g_hash_table_get_values(media->priv->sessions);
- purple_debug_info("media", "Turning mute %s\n", active ? "on" : "off");
-
- for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
- PurpleMediaSession *session = sessions->data;
- if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
- GstElement *volume = gst_bin_get_by_name(
- GST_BIN(session->src),
- "purpleaudioinputvolume");
- g_object_set(volume, "mute", active, NULL);
- }
- }
+ purple_media_stream_info(media, active ? PURPLE_MEDIA_INFO_MUTE :
+ PURPLE_MEDIA_INFO_UNMUTE, NULL, NULL, TRUE);
#endif
}
More information about the Commits
mailing list