aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-tp-chat.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-04-25 17:16:52 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-05-10 16:20:40 +0800
commit1b585fb209271d89f192d4a4adbef66c9ff19b95 (patch)
treea63d4e65b2a14f30e727a7040016b25b6f88718c /libempathy/empathy-tp-chat.c
parent095cb1798bd4214653a85133de8fc577d23c268b (diff)
downloadgsoc2013-empathy-1b585fb209271d89f192d4a4adbef66c9ff19b95.tar
gsoc2013-empathy-1b585fb209271d89f192d4a4adbef66c9ff19b95.tar.gz
gsoc2013-empathy-1b585fb209271d89f192d4a4adbef66c9ff19b95.tar.bz2
gsoc2013-empathy-1b585fb209271d89f192d4a4adbef66c9ff19b95.tar.lz
gsoc2013-empathy-1b585fb209271d89f192d4a4adbef66c9ff19b95.tar.xz
gsoc2013-empathy-1b585fb209271d89f192d4a4adbef66c9ff19b95.tar.zst
gsoc2013-empathy-1b585fb209271d89f192d4a4adbef66c9ff19b95.zip
Use tp_capabilities_get_channel_classes_variant()
https://bugzilla.gnome.org/show_bug.cgi?id=674774
Diffstat (limited to 'libempathy/empathy-tp-chat.c')
-rw-r--r--libempathy/empathy-tp-chat.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 6a8080e9d..65a7dd888 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -1377,8 +1377,8 @@ tp_chat_prepare_ready_async (TpProxy *proxy,
else
{
TpCapabilities *caps;
- GPtrArray *classes;
- guint i;
+ GVariant *classes, *class;
+ GVariantIter iter;
TpContact *contact;
/* Get the self contact from the connection's self handle */
@@ -1392,21 +1392,43 @@ tp_chat_prepare_ready_async (TpProxy *proxy,
caps = tp_connection_get_capabilities (connection);
g_assert (caps != NULL);
- classes = tp_capabilities_get_channel_classes (caps);
+ classes = tp_capabilities_dup_channel_classes_variant (caps);
- for (i = 0; i < classes->len; i++)
+ g_variant_iter_init (&iter, classes);
+ while ((class = g_variant_iter_next_value (&iter)))
{
- GValueArray *array = g_ptr_array_index (classes, i);
- const char **oprops = g_value_get_boxed (
- g_value_array_get_nth (array, 1));
+ GVariant *fixed, *allowed;
+ const gchar *chan_type = NULL;
- if (tp_strv_contains (oprops,
- TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_CHANNELS))
+ fixed = g_variant_get_child_value (class, 0);
+ allowed = g_variant_get_child_value (class, 1);
+
+ g_variant_lookup (fixed, TP_PROP_CHANNEL_CHANNEL_TYPE, "&s",
+ &chan_type);
+ if (!tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_TEXT))
{
- self->priv->can_upgrade_to_muc = TRUE;
- break;
+ const gchar **oprops;
+
+ oprops = g_variant_get_strv (allowed, NULL);
+
+ if (tp_strv_contains (oprops,
+ TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_CHANNELS))
+ {
+ self->priv->can_upgrade_to_muc = TRUE;
+ }
+
+ g_free (oprops);
}
+
+ g_variant_unref (class);
+ g_variant_unref (fixed);
+ g_variant_unref (allowed);
+
+ if (self->priv->can_upgrade_to_muc)
+ break;
}
+
+ g_variant_unref (classes);
}
if (tp_proxy_has_interface_by_id (self,