/** * tp_connection_request_handles: * @self: a connection * @timeout_ms: the timeout in milliseconds, or -1 to use the default * @handle_type: the handle type * @ids: (array zero-terminated=1): an array of string identifiers for which * handles are required, terminated by %NULL (must not be %NULL or empty) * @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 * * Request the handles corresponding to the given identifiers, and if they * are valid, hold (ensure a reference to) the corresponding handles. * * If they are valid, the callback will later be called with the given * handles; if not all of them are valid, the callback will be called with * an error. * * Deprecated: If @handle_type is TP_HANDLE_TYPE_CONTACT, use * tp_connection_dup_contact_by_id_async() instead. For channel requests, * use tp_account_channel_request_set_target_id() instead. */ void tp_connection_request_handles (TpConnection *self, gint timeout_ms, TpHandleType handle_type, const gchar * const *ids, TpConnectionRequestHandlesCb callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object) { RequestHandlesContext *context; g_return_if_fail (TP_IS_CONNECTION (self)); g_return_if_fail (handle_type > TP_HANDLE_TYPE_NONE); g_return_if_fail (handle_type < TP_NUM_HANDLE_TYPES); g_return_if_fail (ids != NULL); g_return_if_fail (ids[0] != NULL); g_return_if_fail (callback != NULL); context = g_slice_new0 (RequestHandlesContext); context->handle_type = handle_type; context->ids = g_strdupv ((GStrv) ids); context->user_data = user_data; context->destroy = destroy; context->callback = callback; tp_cli_connection_call_request_handles (self, timeout_ms, handle_type, (const gchar **) context->ids, connection_requested_handles, context, request_handles_context_free, weak_object); }
/* This function takes ownership of handles array */ static void tp_contact_list_group_add (EmpathyTpContactList *list, const gchar *group_name, GArray *handles) { EmpathyTpContactListPriv *priv = GET_PRIV (list); TpChannel *channel; const gchar *names[] = {group_name, NULL}; /* Search the channel for that group name */ channel = g_hash_table_lookup (priv->groups, group_name); if (channel) { tp_cli_channel_interface_group_call_add_members (channel, -1, handles, NULL, NULL, NULL, NULL, NULL); g_array_unref (handles); return; } /* That group does not exist yet, we have to: * 1) Request an handle for the group name * 2) Request a channel * 3) When NewChannel is emitted, add handles in members */ g_hash_table_insert (priv->add_to_group, g_strdup (group_name), handles); tp_cli_connection_call_request_handles (priv->connection, -1, TP_HANDLE_TYPE_GROUP, names, tp_contact_list_group_request_handles_cb, NULL, NULL, G_OBJECT (list)); }