From 51983f8155148ac7efd36334847d7a8a09828709 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 7 Nov 2013 14:13:26 +0000 Subject: [PATCH 2/5] Adjust code for replacement of TpContactsMixin --- src/conn-addressing.c | 64 +++++++++++++++++++-------------------- src/conn-addressing.h | 5 ++++ src/conn-aliasing.c | 23 +++++++------- src/conn-aliasing.h | 5 ++++ src/conn-avatars.c | 25 ++++++++-------- src/conn-avatars.h | 5 ++++ src/conn-client-types.c | 29 ++++++++---------- src/conn-client-types.h | 5 ++++ src/conn-contact-info.c | 26 ++++++++-------- src/conn-contact-info.h | 5 ++++ src/conn-location.c | 25 +++++++--------- src/conn-location.h | 5 ++++ src/conn-presence.c | 2 -- src/connection.c | 80 ++++++++++++++++++++++++++++++++----------------- src/connection.h | 2 -- 15 files changed, 170 insertions(+), 136 deletions(-) diff --git a/src/conn-addressing.c b/src/conn-addressing.c index 5e3231f..c699ccf 100644 --- a/src/conn-addressing.c +++ b/src/conn-addressing.c @@ -38,38 +38,34 @@ static const char *assumed_interfaces[] = { NULL }; - -static void -_fill_contact_attributes (TpHandleRepoIface *contact_repo, +gboolean +conn_addressing_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, TpHandle contact, - GHashTable *attributes_hash) + TpContactAttributeMap *attributes) { - gchar **uris = gabble_uris_for_handle (contact_repo, contact); - GHashTable *addresses = gabble_vcard_addresses_for_handle (contact_repo, contact); + TpHandleRepoIface *contact_repo; + gchar **uris; + GHashTable *addresses; + + if (tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_ADDRESSING1)) + return FALSE; - tp_contacts_mixin_set_contact_attribute (attributes_hash, + contact_repo = tp_base_connection_get_handles ((TpBaseConnection *) self, + TP_HANDLE_TYPE_CONTACT); + uris = gabble_uris_for_handle (contact_repo, contact); + addresses = gabble_vcard_addresses_for_handle (contact_repo, contact); + + tp_contact_attribute_map_take_sliced_gvalue (attributes, contact, TP_TOKEN_CONNECTION_INTERFACE_ADDRESSING1_URIS, tp_g_value_slice_new_take_boxed (G_TYPE_STRV, uris)); - tp_contacts_mixin_set_contact_attribute (attributes_hash, + tp_contact_attribute_map_take_sliced_gvalue (attributes, contact, TP_TOKEN_CONNECTION_INTERFACE_ADDRESSING1_ADDRESSES, - tp_g_value_slice_new_take_boxed (TP_HASH_TYPE_STRING_STRING_MAP, addresses)); -} + tp_g_value_slice_new_take_boxed (TP_HASH_TYPE_STRING_STRING_MAP, + addresses)); -static void -conn_addressing_fill_contact_attributes (GObject *obj, - const GArray *contacts, - GHashTable *attributes_hash) -{ - guint i; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) obj, TP_HANDLE_TYPE_CONTACT); - - for (i = 0; i < contacts->len; i++) - { - TpHandle contact = g_array_index (contacts, TpHandle, i); - _fill_contact_attributes (contact_repo, contact, attributes_hash); - } + return TRUE; } static void @@ -79,8 +75,9 @@ conn_addressing_get_contacts_by_uri (TpSvcConnectionInterfaceAddressing1 *iface, DBusGMethodInvocation *context) { const gchar **uri; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) iface, TP_HANDLE_TYPE_CONTACT); + TpBaseConnection *base = TP_BASE_CONNECTION (iface); + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, + TP_HANDLE_TYPE_CONTACT); GHashTable *attributes; GHashTable *requested = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); GArray *handles = g_array_sized_new (TRUE, TRUE, sizeof (TpHandle), @@ -97,7 +94,7 @@ conn_addressing_get_contacts_by_uri (TpSvcConnectionInterfaceAddressing1 *iface, g_array_append_val (handles, h); } - attributes = tp_contacts_mixin_get_contact_attributes (G_OBJECT (iface), handles, + attributes = tp_base_connection_dup_contact_attributes_hash (base, handles, interfaces, assumed_interfaces); tp_svc_connection_interface_addressing1_return_from_get_contacts_by_uri ( @@ -116,8 +113,9 @@ conn_addressing_get_contacts_by_vcard_field (TpSvcConnectionInterfaceAddressing1 DBusGMethodInvocation *context) { const gchar **address; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) iface, TP_HANDLE_TYPE_CONTACT); + TpBaseConnection *base = TP_BASE_CONNECTION (iface); + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, + TP_HANDLE_TYPE_CONTACT); GHashTable *attributes; GHashTable *requested = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); GArray *handles = g_array_sized_new (TRUE, TRUE, sizeof (TpHandle), @@ -135,7 +133,7 @@ conn_addressing_get_contacts_by_vcard_field (TpSvcConnectionInterfaceAddressing1 g_array_append_val (handles, h); } - attributes = tp_contacts_mixin_get_contact_attributes (G_OBJECT (iface), handles, + attributes = tp_base_connection_dup_contact_attributes_hash (base, handles, interfaces, assumed_interfaces); tp_svc_connection_interface_addressing1_return_from_get_contacts_by_vcard_field ( @@ -147,10 +145,8 @@ conn_addressing_get_contacts_by_vcard_field (TpSvcConnectionInterfaceAddressing1 } void -conn_addressing_init (GabbleConnection *self) { - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (self), - TP_IFACE_CONNECTION_INTERFACE_ADDRESSING1, - conn_addressing_fill_contact_attributes); +conn_addressing_init (GabbleConnection *self) +{ } void diff --git a/src/conn-addressing.h b/src/conn-addressing.h index 2dbe087..223b67d 100644 --- a/src/conn-addressing.h +++ b/src/conn-addressing.h @@ -29,6 +29,11 @@ G_BEGIN_DECLS void conn_addressing_iface_init (gpointer g_iface, gpointer iface_data); void conn_addressing_init (GabbleConnection *self); +gboolean conn_addressing_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle contact, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* GABBLE_CONN_ADDRESSING_H */ diff --git a/src/conn-aliasing.c b/src/conn-aliasing.c index 38c0d56..7ee43db 100644 --- a/src/conn-aliasing.c +++ b/src/conn-aliasing.c @@ -1031,16 +1031,14 @@ maybe_request_vcard (GabbleConnection *self, TpHandle handle, } } -static void -conn_aliasing_fill_contact_attributes (GObject *obj, - const GArray *contacts, GHashTable *attributes_hash) +gboolean +conn_aliasing_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - guint i; - GabbleConnection *self = GABBLE_CONNECTION(obj); - - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_ALIASING1)) { - TpHandle handle = g_array_index (contacts, TpHandle, i); GabbleConnectionAliasSource source; gchar *alias; GValue *val = tp_g_value_slice_new (G_TYPE_STRING); @@ -1050,21 +1048,20 @@ conn_aliasing_fill_contact_attributes (GObject *obj, g_value_take_string (val, alias); - tp_contacts_mixin_set_contact_attribute (attributes_hash, + tp_contact_attribute_map_take_sliced_gvalue (attributes, handle, TP_TOKEN_CONNECTION_INTERFACE_ALIASING1_ALIAS, val); maybe_request_vcard (self, handle, source); + return TRUE; } + + return FALSE; } void conn_aliasing_init (GabbleConnection *conn) { - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_ALIASING1, - conn_aliasing_fill_contact_attributes); - conn->pep_nick = wocky_pep_service_new (NS_NICK, TRUE); conn->pep_alias_cache = g_hash_table_new_full (NULL, NULL, NULL, g_free); diff --git a/src/conn-aliasing.h b/src/conn-aliasing.h index d165449..ad163d6 100644 --- a/src/conn-aliasing.h +++ b/src/conn-aliasing.h @@ -40,6 +40,11 @@ void gabble_conn_aliasing_nicknames_updated (GObject *object, GabbleConnectionAliasSource _gabble_connection_get_cached_alias ( GabbleConnection *, TpHandle, gchar **); +gboolean conn_aliasing_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_ALIASING_H__ */ diff --git a/src/conn-avatars.c b/src/conn-avatars.c index bac9715..cf128cf 100644 --- a/src/conn-avatars.c +++ b/src/conn-avatars.c @@ -584,17 +584,16 @@ gabble_connection_clear_avatar (TpSvcConnectionInterfaceAvatars1 *iface, gabble_connection_set_avatar (iface, NULL, NULL, context); } -static void -conn_avatars_fill_contact_attributes (GObject *obj, - const GArray *contacts, GHashTable *attributes_hash) +gboolean +conn_avatars_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - guint i; - GabbleConnection *self = GABBLE_CONNECTION(obj); - TpBaseConnection *base = (TpBaseConnection *) self; + TpBaseConnection *base = TP_BASE_CONNECTION (self); - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_AVATARS1)) { - TpHandle handle = g_array_index (contacts, guint, i); GabblePresence *presence = NULL; if (tp_base_connection_get_self_handle (base) == handle) @@ -611,10 +610,14 @@ conn_avatars_fill_contact_attributes (GObject *obj, else g_value_set_string (val, ""); - tp_contacts_mixin_set_contact_attribute (attributes_hash, handle, + tp_contact_attribute_map_take_sliced_gvalue (attributes, handle, TP_TOKEN_CONNECTION_INTERFACE_AVATARS1_TOKEN, val); } + + return TRUE; } + + return FALSE; } @@ -627,10 +630,6 @@ conn_avatars_init (GabbleConnection *conn) (connection_got_self_initial_avatar_cb), conn); g_signal_connect (conn->presence_cache, "avatar-update", G_CALLBACK (connection_avatar_update_cb), conn); - - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_AVATARS1, - conn_avatars_fill_contact_attributes); } diff --git a/src/conn-avatars.h b/src/conn-avatars.h index a26506d..1ea3c6c 100644 --- a/src/conn-avatars.h +++ b/src/conn-avatars.h @@ -41,6 +41,11 @@ void gabble_connection_dup_avatar_requirements (GStrv *supported_mime_types, guint *max_width, guint *max_bytes); +gboolean conn_avatars_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_AVATARS_H__ */ diff --git a/src/conn-client-types.c b/src/conn-client-types.c index 26f7fc1..b4cc128 100644 --- a/src/conn-client-types.c +++ b/src/conn-client-types.c @@ -128,28 +128,29 @@ conn_client_types_iface_init (gpointer g_iface, #undef IMPLEMENT } -static void -conn_client_types_fill_contact_attributes (GObject *obj, - const GArray *contacts, - GHashTable *attributes_hash) +gboolean +conn_client_types_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - GabbleConnection *conn = GABBLE_CONNECTION (obj); - guint i; - - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES1)) { - TpHandle handle = g_array_index (contacts, TpHandle, i); GValue *val; gchar **types; - if (!get_client_types_from_handle (conn, handle, &types)) - continue; + if (!get_client_types_from_handle (self, handle, &types)) + return TRUE; val = tp_g_value_slice_new_take_boxed (G_TYPE_STRV, types); - tp_contacts_mixin_set_contact_attribute (attributes_hash, handle, + tp_contact_attribute_map_take_sliced_gvalue (attributes, handle, TP_TOKEN_CONNECTION_INTERFACE_CLIENT_TYPES1_CLIENT_TYPES, val); + + return TRUE; } + + return FALSE; } typedef struct @@ -220,10 +221,6 @@ presence_cache_client_types_updated_cb (GabblePresenceCache *presence_cache, void conn_client_types_init (GabbleConnection *conn) { - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES1, - conn_client_types_fill_contact_attributes); - g_signal_connect (conn->presence_cache, "client-types-updated", G_CALLBACK (presence_cache_client_types_updated_cb), conn); } diff --git a/src/conn-client-types.h b/src/conn-client-types.h index 2e88dd7..d1096d6 100644 --- a/src/conn-client-types.h +++ b/src/conn-client-types.h @@ -29,6 +29,11 @@ void conn_client_types_iface_init (gpointer g_iface, gpointer iface_data); void conn_client_types_init (GabbleConnection *conn); +gboolean conn_client_types_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_CLIENT_TYPES_H__ */ diff --git a/src/conn-contact-info.c b/src/conn-contact-info.c index 4574b75..ca243ee 100644 --- a/src/conn-contact-info.c +++ b/src/conn-contact-info.c @@ -1032,36 +1032,38 @@ conn_contact_info_status_changed_cb (GabbleConnection *conn, } } -static void -conn_contact_info_fill_contact_attributes (GObject *obj, - const GArray *contacts, - GHashTable *attributes_hash) +gboolean +conn_contact_info_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle contact, + TpContactAttributeMap *attributes) { - guint i; - GabbleConnection *self = GABBLE_CONNECTION (obj); - g_assert (self->vcard_manager != NULL); - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO1)) { - TpHandle contact = g_array_index (contacts, TpHandle, i); WockyNode *vcard_node; if (gabble_vcard_manager_get_cached (self->vcard_manager, contact, &vcard_node)) { GPtrArray *contact_info = _parse_vcard (vcard_node, NULL); + if (contact_info != NULL) { GValue *val = tp_g_value_slice_new_take_boxed ( TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST, contact_info); - tp_contacts_mixin_set_contact_attribute (attributes_hash, + tp_contact_attribute_map_take_sliced_gvalue (attributes, contact, TP_TOKEN_CONNECTION_INTERFACE_CONTACT_INFO1_INFO, val); } } + + return TRUE; } + + return FALSE; } void @@ -1069,10 +1071,6 @@ conn_contact_info_init (GabbleConnection *conn) { g_assert (conn->vcard_manager != NULL); - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO1, - conn_contact_info_fill_contact_attributes); - conn->contact_info_fields = conn_contact_info_build_supported_fields (conn, conn->vcard_manager); diff --git a/src/conn-contact-info.h b/src/conn-contact-info.h index a075daa..abde01c 100644 --- a/src/conn-contact-info.h +++ b/src/conn-contact-info.h @@ -34,6 +34,11 @@ extern TpDBusPropertiesMixinPropImpl *conn_contact_info_properties; void conn_contact_info_properties_getter (GObject *object, GQuark interface, GQuark name, GValue *value, gpointer getter_data); +gboolean conn_contact_info_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle contact, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_CONTACT_INFO_H__ */ diff --git a/src/conn-location.c b/src/conn-location.c index 949c6cd..42ce186 100644 --- a/src/conn-location.c +++ b/src/conn-location.c @@ -591,17 +591,14 @@ location_pep_node_changed (WockyPepService *pep, update_location_from_item (conn, handle, item_node); } -static void -conn_location_fill_contact_attributes (GObject *obj, - const GArray *contacts, - GHashTable *attributes_hash) +gboolean +conn_location_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - GabbleConnection *self = GABBLE_CONNECTION (obj); - guint i; - - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_LOCATION1)) { - TpHandle handle = g_array_index (contacts, TpHandle, i); GHashTable *location = get_cached_location (self, handle); if (location != NULL) @@ -609,19 +606,19 @@ conn_location_fill_contact_attributes (GObject *obj, GValue *val = tp_g_value_slice_new_take_boxed ( TP_HASH_TYPE_STRING_VARIANT_MAP, location); - tp_contacts_mixin_set_contact_attribute (attributes_hash, + tp_contact_attribute_map_take_sliced_gvalue (attributes, handle, TP_TOKEN_CONNECTION_INTERFACE_LOCATION1_LOCATION, val); } + + return TRUE; } + + return FALSE; } void conn_location_init (GabbleConnection *conn) { - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_LOCATION1, - conn_location_fill_contact_attributes); - conn->pep_location = wocky_pep_service_new (NS_GEOLOC, TRUE); g_signal_connect (conn->pep_location, "changed", diff --git a/src/conn-location.h b/src/conn-location.h index fa2d707..b7e5947 100644 --- a/src/conn-location.h +++ b/src/conn-location.h @@ -16,6 +16,11 @@ gboolean conn_location_properties_setter (GObject *object, GQuark interface, void conn_location_init (GabbleConnection *conn); +gboolean conn_location_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_LOCATION_H__ */ diff --git a/src/conn-presence.c b/src/conn-presence.c index ab9585f..ce525c7 100644 --- a/src/conn-presence.c +++ b/src/conn-presence.c @@ -1962,8 +1962,6 @@ conn_presence_init (GabbleConnection *conn) tp_presence_mixin_init ((GObject *) conn, G_STRUCT_OFFSET (GabbleConnection, presence)); - - tp_presence_mixin_register_with_contacts_mixin (G_OBJECT (conn)); } void diff --git a/src/connection.c b/src/connection.c index 7f40c79..f52f5e5 100644 --- a/src/connection.c +++ b/src/connection.c @@ -82,8 +82,6 @@ static guint disco_reply_timeout = 5; #define DISCONNECT_TIMEOUT 5 static void gabble_conn_contact_caps_iface_init (gpointer, gpointer); -static void conn_contact_capabilities_fill_contact_attributes (GObject *obj, - const GArray *contacts, GHashTable *attributes_hash); static void gabble_plugin_connection_iface_init ( GabblePluginConnectionInterface *iface, gpointer conn); @@ -103,8 +101,6 @@ G_DEFINE_TYPE_WITH_CODE(GabbleConnection, conn_contact_info_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES, tp_dbus_properties_mixin_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACTS, - tp_contacts_mixin_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_LIST1, tp_base_contact_list_mixin_list_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_GROUPS1, @@ -419,17 +415,10 @@ gabble_connection_constructor (GType type, g_signal_connect (self->presence_cache, "capabilities-update", G_CALLBACK (connection_capabilities_update_cb), self); - tp_contacts_mixin_init (G_OBJECT (self), - G_STRUCT_OFFSET (GabbleConnection, contacts)); - self->roster = gabble_roster_new (self); g_signal_connect (self->roster, "nicknames-update", G_CALLBACK (gabble_conn_aliasing_nicknames_updated), self); - tp_base_connection_register_with_contacts_mixin (base); - tp_base_contact_list_mixin_register_with_contacts_mixin ( - gabble_connection_get_contact_list (self), base); - conn_aliasing_init (self); conn_avatars_init (self); conn_contact_info_init (self); @@ -440,10 +429,6 @@ gabble_connection_constructor (GType type, conn_client_types_init (self); conn_addressing_init (self); - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (self), - TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1, - conn_contact_capabilities_fill_contact_attributes); - self->bytestream_factory = gabble_bytestream_factory_new (self); self->avatar_requests = g_hash_table_new (NULL, NULL); @@ -868,7 +853,6 @@ static const gchar *implemented_interfaces[] = { TP_IFACE_CONNECTION_INTERFACE_PRESENCE1, TP_IFACE_CONNECTION_INTERFACE_AVATARS1, TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO1, - TP_IFACE_CONNECTION_INTERFACE_CONTACTS, TP_IFACE_CONNECTION_INTERFACE_CONTACT_LIST1, TP_IFACE_CONNECTION_INTERFACE_CONTACT_GROUPS1, TP_IFACE_CONNECTION_INTERFACE_REQUESTS, @@ -924,6 +908,11 @@ conn_aliasing_properties_getter (GObject *object, g_value_set_uint (value, GPOINTER_TO_UINT (getter_data)); } +static void gabble_connection_fill_contact_attributes (TpBaseConnection *base, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + static void gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) { @@ -1008,6 +997,8 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) parent_class->start_connecting = _gabble_connection_connect; parent_class->get_interfaces_always_present = _gabble_connection_get_interfaces_always_present; + parent_class->fill_contact_attributes = + gabble_connection_fill_contact_attributes; g_type_class_add_private (gabble_connection_class, sizeof (GabbleConnectionPrivate)); @@ -1238,9 +1229,6 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) tp_dbus_properties_mixin_class_init (object_class, G_STRUCT_OFFSET (GabbleConnectionClass, properties_class)); - tp_contacts_mixin_class_init (object_class, - G_STRUCT_OFFSET (GabbleConnectionClass, contacts_class)); - conn_presence_class_init (gabble_connection_class); conn_contact_info_class_init (gabble_connection_class); @@ -1352,8 +1340,6 @@ gabble_connection_finalize (GObject *object) g_free (priv->alias); g_free (priv->stream_id); - tp_contacts_mixin_finalize (G_OBJECT(self)); - conn_aliasing_finalize (self); conn_presence_finalize (self); conn_contact_info_finalize (self); @@ -3414,24 +3400,62 @@ gabble_connection_update_capabilities ( } static void -conn_contact_capabilities_fill_contact_attributes (GObject *obj, - const GArray *contacts, GHashTable *attributes_hash) +gabble_connection_fill_contact_attributes (TpBaseConnection *base, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - GabbleConnection *self = GABBLE_CONNECTION (obj); - guint i; + GabbleConnection *self = GABBLE_CONNECTION (base); - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1)) { - TpHandle handle = g_array_index (contacts, TpHandle, i); GValue *val = tp_g_value_slice_new_take_boxed ( TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST, gabble_connection_get_handle_contact_capabilities (self, handle)); - tp_contacts_mixin_set_contact_attribute (attributes_hash, + tp_contact_attribute_map_take_sliced_gvalue (attributes, handle, TP_TOKEN_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1_CAPABILITIES, val); + return; } + + if (tp_base_contact_list_fill_contact_attributes ( + gabble_connection_get_contact_list (self), dbus_interface, handle, + attributes)) + return; + + if (tp_presence_mixin_fill_contact_attributes ((GObject *) self, + dbus_interface, handle, attributes)) + return; + + if (conn_addressing_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; + + if (conn_aliasing_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; + + if (conn_avatars_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; + + if (conn_client_types_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; + + if (conn_contact_info_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; + + if (conn_location_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; + + TP_BASE_CONNECTION_CLASS (gabble_connection_parent_class)-> + fill_contact_attributes (base, dbus_interface, handle, attributes); } const char * diff --git a/src/connection.h b/src/connection.h index a7886e7..eb775f2 100644 --- a/src/connection.h +++ b/src/connection.h @@ -168,13 +168,11 @@ struct _GabbleConnectionClass { TpBaseConnectionClass parent_class; TpDBusPropertiesMixinClass properties_class; TpPresenceMixinClass presence_class; - TpContactsMixinClass contacts_class; }; struct _GabbleConnection { TpBaseConnection parent; TpPresenceMixin presence; - TpContactsMixin contacts; /* DBus daemon instance */ TpDBusDaemon *daemon; -- 1.8.4.2