From 18daeb539a5a1adf55fa5c118a82022e4e140255 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 20 Jul 2011 19:22:21 +0100 Subject: [PATCH] Contacts: add stub support for ContactInfo --- src/idle-contact-info.c | 20 ++++++++++++++++++++ tests/twisted/contacts.py | 1 + 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/src/idle-contact-info.c b/src/idle-contact-info.c index fb5d3c3..564800c 100644 --- a/src/idle-contact-info.c +++ b/src/idle-contact-info.c @@ -495,6 +495,22 @@ void idle_contact_info_class_init (IdleConnectionClass *klass) { props); } +static void +idle_contact_info_fill_contact_attributes ( + GObject *obj, + const GArray *contacts, + GHashTable *attributes_hash) +{ + /* We don't cache contact info, so we just never put /info into the + * attributes hash. This is spec-compliant: we don't implement + * GetContactInfo, and the spec says the attribute should be the same as the + * value returned by that method (or omitted if unknown). This function + * exists at all to make ContactInfo show up in ContactAttributeInterfaces + * (otherwise tp-glib might be justified in falling back to + * GetContactInfo(), which we know will fail). + */ +} + void idle_contact_info_init (IdleConnection *conn) { conn->contact_info_requests = g_queue_new(); @@ -512,6 +528,10 @@ void idle_contact_info_init (IdleConnection *conn) { idle_parser_add_handler(conn->parser, IDLE_PARSER_NUMERIC_NOSUCHSERVER, _no_such_server_handler, conn); idle_parser_add_handler(conn->parser, IDLE_PARSER_NUMERIC_TRYAGAIN, _try_again_handler, conn); + + tp_contacts_mixin_add_contact_attributes_iface ((GObject *) conn, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO, + idle_contact_info_fill_contact_attributes); } void idle_contact_info_iface_init(gpointer g_iface, gpointer iface_data) { diff --git a/tests/twisted/contacts.py b/tests/twisted/contacts.py index 96a3ec3..1e83f35 100644 --- a/tests/twisted/contacts.py +++ b/tests/twisted/contacts.py @@ -16,6 +16,7 @@ def test(q, bus, conn, stream): attr_ifaces = conn.Properties.Get(cs.CONN_IFACE_CONTACTS, "ContactAttributeInterfaces") assertContains(cs.CONN_IFACE_ALIASING, attr_ifaces) + assertContains(cs.CONN_IFACE_CONTACT_INFO, attr_ifaces) brillana, miriam = conn.RequestHandles(cs.HT_CONTACT, ["brillana", "miriam"]) -- 1.7.5.4