summaryrefslogtreecommitdiff
path: root/tests/lib
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-07-21 15:47:35 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-07-27 18:15:42 +0100
commit0fa6d8c766622c8310cc746a4575f22fb2c42dc3 (patch)
tree230b5c34ac4856c8b3b102b670b78bb6f9391e34 /tests/lib
parent2dfeab6378ca0fc57a9060c873f2c2db6ff29682 (diff)
Contacts: avoid re-introspecting client types
My reading of the spec says that it's okay to leave /client-types out of the result of GetContactAttributes(). My reading of the tp-glib documentation is that it's valid for tp_contact_get_client_types() to return NULL even if TP_CONTACT_FEATURE_CLIENT_TYPES is prepared. TpContact:client-types is documented a little differently, so I'm changing it to match.
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/contacts-conn.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lib/contacts-conn.c b/tests/lib/contacts-conn.c
index c49d268a2..a993beba0 100644
--- a/tests/lib/contacts-conn.c
+++ b/tests/lib/contacts-conn.c
@@ -53,6 +53,8 @@ G_DEFINE_TYPE_WITH_CODE (TpTestsContactsConnection,
tp_base_contact_list_mixin_list_iface_init);
G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_GROUPS,
tp_base_contact_list_mixin_groups_iface_init);
+ G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CLIENT_TYPES,
+ NULL);
);
/* type definition stuff */
@@ -341,6 +343,18 @@ conn_contact_info_properties_getter (GObject *object,
}
static void
+client_types_fill_contact_attributes (
+ GObject *object,
+ const GArray *contacts,
+ GHashTable *attributes)
+{
+ /* Do nothing: a no-op implementation is valid, relatively speaking. The spec
+ * sez the /client-types attribute should be “omitted from the result if the
+ * contact's client types are not known.”
+ */
+}
+
+static void
constructed (GObject *object)
{
TpBaseConnection *base = TP_BASE_CONNECTION (object);
@@ -369,6 +383,9 @@ constructed (GObject *object)
tp_contacts_mixin_add_contact_attributes_iface (object,
TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO,
contact_info_fill_contact_attributes);
+ tp_contacts_mixin_add_contact_attributes_iface (object,
+ TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES,
+ client_types_fill_contact_attributes);
tp_presence_mixin_init (object,
G_STRUCT_OFFSET (TpTestsContactsConnection, presence_mixin));
@@ -501,6 +518,7 @@ tp_tests_contacts_connection_class_init (TpTestsContactsConnectionClass *klass)
TP_IFACE_CONNECTION_INTERFACE_PRESENCE,
TP_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE,
TP_IFACE_CONNECTION_INTERFACE_LOCATION,
+ TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES,
TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES,
TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO,
TP_IFACE_CONNECTION_INTERFACE_REQUESTS,