diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-06-03 13:47:59 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-06-07 12:55:18 +0100 |
commit | d8eb4ec496873cc1d3f3a50ec88fd5f456afa245 (patch) | |
tree | d9442d65ef2e1d388e8a830dc759e10cf8db1201 /telepathy-glib/connection-handles.c | |
parent | 8d5d7baa7603f0b31456c94d566bf86a8d32b26c (diff) | |
download | telepathy-glib-d8eb4ec496873cc1d3f3a50ec88fd5f456afa245.tar.gz |
tp_connection_request_contact_list_attributes: add
This needs a specific binding for the same reasons as
GetContactAttributes. I've called it _request_ rather than _get_ since
I plan to rename the underlying D-Bus method at some point.
Diffstat (limited to 'telepathy-glib/connection-handles.c')
-rw-r--r-- | telepathy-glib/connection-handles.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/telepathy-glib/connection-handles.c b/telepathy-glib/connection-handles.c index 006d307c9..2a26534d5 100644 --- a/telepathy-glib/connection-handles.c +++ b/telepathy-glib/connection-handles.c @@ -808,3 +808,68 @@ tp_connection_get_contact_attributes (TpConnection *self, c, get_contact_attributes_context_free, weak_object); g_array_free (a, TRUE); } + +/** + * tp_connection_request_contact_list_attributes: + * @self: a connection + * @timeout_ms: the timeout in milliseconds (using a large timeout is + * recommended) + * @interfaces: a #GStrv of interfaces + * @hold: if %TRUE, the callback will hold one reference to each valid handle + * @callback: (type GObject.Callback): called on success or + * failure (unless @weak_object has become unreferenced) + * @user_data: arbitrary user-supplied data + * @destroy: called to destroy @user_data after calling @callback, or when + * @weak_object becomes unreferenced (whichever occurs sooner) + * @weak_object: if not %NULL, an object to be weakly referenced: if it is + * destroyed, @callback will not be called + * + * Return (via a callback) any number of attributes of the given handles, and + * if they are valid and @hold is TRUE, hold a reference to them. + * + * This is a thin wrapper around the GetContactAttributes D-Bus method, and + * should be used in preference to + * tp_cli_connection_interface_contacts_get_contact_attributes(); mixing this + * function, tp_connection_hold_handles(), tp_connection_unref_handles(), and + * #TpContact with direct use of the RequestHandles, HoldHandles and + * GetContactAttributes D-Bus methods is unwise, as #TpConnection and + * #TpContact perform client-side reference counting of handles. + * The #TpContact API provides a higher-level abstraction which should + * usually be used instead. + * + * @callback will later be called with the attributes of those of the given + * handles that were valid. Invalid handles are simply omitted from the + * parameter to the callback. + * + * If @hold is %TRUE, the @callback is given one reference to each handle + * that appears as a key in the callback's @attributes parameter. + */ +void +tp_connection_request_contact_list_attributes (TpConnection *self, + gint timeout_ms, + const gchar * const *interfaces, + gboolean hold, + tp_cli_connection_interface_contacts_callback_for_get_contact_attributes callback, + gpointer user_data, + GDestroyNotify destroy, + GObject *weak_object) +{ + GetContactAttributesContext *c; + + DEBUG ("hold=%c", hold ? 'T' : 'F'); + + g_return_if_fail (TP_IS_CONNECTION (self)); + g_return_if_fail (callback != NULL); + + c = g_slice_new0 (GetContactAttributesContext); + + c->destroy = destroy; + c->user_data = user_data; + c->callback = callback; + c->hold = hold; + + tp_cli_connection_interface_contact_list_call_get_contact_list_attributes ( + self, -1, (const gchar **) interfaces, hold, + connection_got_contact_attributes, + c, get_contact_attributes_context_free, weak_object); +} |