/pidgin/main: f88938e0c353: Fix purple_media_set_params() with F...
Jakub Adam
jakub.adam at ktknet.cz
Sun Jan 27 05:57:50 EST 2013
Changeset: f88938e0c35372d12b0739da8ffd7f4e4a5912b0
Author: Jakub Adam <jakub.adam at ktknet.cz>
Date: 2013-01-27 04:58 -0500
Branch: default
URL: http://hg.pidgin.im/pidgin/main/rev/f88938e0c353
Description:
Fix purple_media_set_params() with Farstream.
Fixes #15331.
diffstat:
libpurple/media/backend-fs2.c | 98 ++++++++++++++++++++++++++++--------------
1 files changed, 66 insertions(+), 32 deletions(-)
diffs (122 lines):
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -41,6 +41,7 @@
#include <farstream/fs-conference.h>
#include <farstream/fs-element-added-notifier.h>
#include <farstream/fs-utils.h>
+#include <gst/gststructure.h>
#endif
/** @copydoc _PurpleMediaBackendFs2Class */
@@ -2366,38 +2367,6 @@ purple_media_backend_fs2_set_send_codec(
return TRUE;
}
-static void
-purple_media_backend_fs2_set_params(PurpleMediaBackend *self,
- guint num_params, GParameter *params)
-{
- PurpleMediaBackendFs2Private *priv;
- const gchar **supported = purple_media_backend_fs2_get_available_params();
- const gchar **p;
- guint i;
-
- g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
-
- priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
-
- if (priv->conference == NULL &&
- !init_conference(PURPLE_MEDIA_BACKEND_FS2(self))) {
- purple_debug_error("backend-fs2",
- "Error initializing the conference.\n");
- return;
- }
-
- for (i = 0; i != num_params; ++i) {
- for (p = supported; *p != NULL; ++p) {
- if (!strcmp(params[i].name, *p)) {
- g_object_set(priv->conference,
- params[i].name, g_value_get_string(¶ms[i].value),
- NULL);
- break;
- }
- }
- }
-}
-
static const gchar **
purple_media_backend_fs2_get_available_params(void)
{
@@ -2408,6 +2377,71 @@ purple_media_backend_fs2_get_available_p
return supported_params;
}
+
+static const gchar*
+param_to_sdes_type(const gchar *param)
+{
+ const gchar **supported = purple_media_backend_fs2_get_available_params();
+ static const gchar *sdes_types[] = {
+ "cname", "email", "location", "name", "note", "phone", "tool", NULL
+ };
+ guint i;
+
+ for (i = 0; supported[i] != NULL; ++i) {
+ if (!strcmp(param, supported[i])) {
+ return sdes_types[i];
+ }
+ }
+
+ return NULL;
+}
+
+static void
+purple_media_backend_fs2_set_params(PurpleMediaBackend *self,
+ guint num_params, GParameter *params)
+{
+ PurpleMediaBackendFs2Private *priv;
+ guint i;
+#ifndef HAVE_FARSIGHT
+ GstStructure *sdes;
+#endif
+
+ g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
+
+ priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
+
+ if (priv->conference == NULL &&
+ !init_conference(PURPLE_MEDIA_BACKEND_FS2(self))) {
+ purple_debug_error("backend-fs2",
+ "Error initializing the conference.\n");
+ return;
+ }
+
+#ifdef HAVE_FARSIGHT
+ for (i = 0; i != num_params; ++i) {
+ if (param_to_sdes_type(params[i].name)) {
+ g_object_set(priv->conference,
+ params[i].name, g_value_get_string(¶ms[i].value),
+ NULL);
+ }
+ }
+#else
+ g_object_get(G_OBJECT(priv->conference), "sdes", &sdes, NULL);
+
+ for (i = 0; i != num_params; ++i) {
+ const gchar *sdes_type = param_to_sdes_type(params[i].name);
+ if (!sdes_type)
+ continue;
+
+ gst_structure_set(sdes, sdes_type,
+ G_TYPE_STRING, g_value_get_string(¶ms[i].value),
+ NULL);
+ }
+
+ g_object_set(G_OBJECT(priv->conference), "sdes", sdes, NULL);
+ gst_structure_free(sdes);
+#endif /* HAVE_FARSIGHT */
+}
#else
GType
purple_media_backend_fs2_get_type(void)
More information about the Commits
mailing list