diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-08-26 11:00:49 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-09-05 18:48:18 +0100 |
commit | 6c102c09557e2988386751ffb1ee7186f0747578 (patch) | |
tree | 42bdee26b7316105feaaa219589771baac3b3e1c | |
parent | 00de9b2849013d7bc011ef34d3a3cb5a2730a83c (diff) |
Connection: assume all handles have ContactCaps
Previously, some places in Gabble which called
gabble_connection_get_handle_contact_capabilities() did not assume that
it never returns NULL. But (due to the implicit text caps for everyone)
it is guaranteed always to return a non-NULL array of capabilities, so
we can simplify the places that call it.
-rw-r--r-- | src/connection.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/src/connection.c b/src/connection.c index 660a8dd5..c8d392f3 100644 --- a/src/connection.c +++ b/src/connection.c @@ -3033,11 +3033,10 @@ empty_caps_set (void) return empty; } -/** +/* * gabble_connection_get_handle_contact_capabilities: * - * Returns: a set of channel classes representing @handle's capabilities, or - * %NULL if unknown. + * Returns: an array of channel classes representing @handle's capabilities */ static GPtrArray * gabble_connection_get_handle_contact_capabilities ( @@ -3424,21 +3423,14 @@ conn_contact_capabilities_fill_contact_attributes (GObject *obj, for (i = 0; i < contacts->len; i++) { TpHandle handle = g_array_index (contacts, TpHandle, i); - GPtrArray *array; - - array = gabble_connection_get_handle_contact_capabilities (self, handle); - - if (array != NULL) - { - GValue *val = tp_g_value_slice_new ( - TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST); + GValue *val = tp_g_value_slice_new_take_boxed ( + TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST, + gabble_connection_get_handle_contact_capabilities (self, handle)); - g_value_take_boxed (val, array); - tp_contacts_mixin_set_contact_attribute (attributes_hash, - handle, - TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES"/capabilities", - val); - } + tp_contacts_mixin_set_contact_attribute (attributes_hash, + handle, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES"/capabilities", + val); } } @@ -3525,13 +3517,11 @@ gabble_connection_get_contact_capabilities ( for (i = 0; i < handles->len; i++) { - GPtrArray *arr; TpHandle handle = g_array_index (handles, TpHandle, i); + GPtrArray *arr; arr = gabble_connection_get_handle_contact_capabilities (self, handle); - - if (arr != NULL) - g_hash_table_insert (ret, GUINT_TO_POINTER (handle), arr); + g_hash_table_insert (ret, GUINT_TO_POINTER (handle), arr); } tp_svc_connection_interface_contact_capabilities_return_from_get_contact_capabilities |