From 9ca0b5e28309baf4c8dbd722d3de6e6bdc00bf8b Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 11 Apr 2011 17:06:50 +0200 Subject: [PATCH] TpProtocol: add supported interfaces (fdo #36134) --- telepathy-glib/protocol.c | 25 +++++++++++++++++++++++++ tests/dbus/protocol-objects.c | 5 +++++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/telepathy-glib/protocol.c b/telepathy-glib/protocol.c index 94b911d..fef43c3 100644 --- a/telepathy-glib/protocol.c +++ b/telepathy-glib/protocol.c @@ -436,6 +436,7 @@ tp_protocol_constructed (GObject *object) const GPtrArray *rccs; gboolean had_immutables = TRUE; const gchar * const *auth_types = NULL; + const gchar * const *interfaces; if (chain_up != NULL) chain_up (object); @@ -502,6 +503,30 @@ tp_protocol_constructed (GObject *object) self->priv->authentication_types = g_strdupv (tmp); } + interfaces = tp_asv_get_strv (self->priv->protocol_properties, + TP_PROP_PROTOCOL_INTERFACES); + + if (interfaces != NULL) + { + guint i; + + for (i = 0; interfaces[i] != NULL; i++) + { + const gchar *iface = interfaces[i]; + + if (tp_dbus_check_valid_interface_name (iface, NULL)) + { + GQuark q = g_quark_from_string (iface); + + tp_proxy_add_interface_by_id ((TpProxy *) self, q); + } + else + { + DEBUG ("\t\tInterface %s not valid", iface); + } + } + } + /* become ready immediately */ _tp_proxy_set_feature_prepared (proxy, TP_PROTOCOL_FEATURE_PARAMETERS, had_immutables); diff --git a/tests/dbus/protocol-objects.c b/tests/dbus/protocol-objects.c index db486ac..ecea32f 100644 --- a/tests/dbus/protocol-objects.c +++ b/tests/dbus/protocol-objects.c @@ -336,6 +336,11 @@ test_protocol_object (Test *test, g_assert_cmpstr (tp_protocol_get_name (test->protocol), ==, "example"); + g_assert (tp_proxy_has_interface_by_id (test->protocol, + TP_IFACE_QUARK_PROTOCOL)); + g_assert (tp_proxy_has_interface_by_id (test->protocol, + TP_IFACE_QUARK_PROTOCOL_INTERFACE_AVATARS)); + g_assert (tp_proxy_is_prepared (test->protocol, TP_PROTOCOL_FEATURE_PARAMETERS)); -- 1.7.4.1