## Connection Contacts interface

Connection Contacts interface — client-side wrappers for the Contacts interface

## Synopsis

    #include <telepathy-glib/connection.h>

    TpProxyPendingCall * tp_cli_connection_interface_contacts_call_get_contact_attributes
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             const GArray *in_Handles,
                                                             const gchar **in_Interfaces,
                                                             gboolean in_Hold,
                                                             tp_cli_connection_interface_contacts_callback_for_get_contact_attributes callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_connection_interface_contacts_callback_for_get_contact_attributes)
                                                            (TpConnection *proxy,
                                                             GHashTable *out_Attributes,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    gboolean            tp_cli_connection_interface_contacts_run_get_contact_attributes
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             const GArray *in_Handles,
                                                             const gchar **in_Interfaces,
                                                             gboolean in_Hold,
                                                             GHashTable **out_Attributes,
                                                             GError **error,
                                                             GMainLoop **loop);

## Description

This interface allows a client to get information from various connection interfaces in one dbus call.

This section documents the auto-generated C wrappers for the Contacts interface, used with TpConnection objects.

## Details

### tp_cli_connection_interface_contacts_call_get_contact_attributes ()

    TpProxyPendingCall * tp_cli_connection_interface_contacts_call_get_contact_attributes
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             const GArray *in_Handles,
                                                             const gchar **in_Interfaces,
                                                             gboolean in_Hold,
                                                             tp_cli_connection_interface_contacts_callback_for_get_contact_attributes callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a GetContactAttributes method call.

Return any number of contact attributes for the given handles.

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`in_Handles` : | Used to pass an 'in' argument: An array of handles representing contacts.

`in_Interfaces` :

Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A list of strings indicating which D-Bus interfaces the calling process is interested in. All supported attributes from these interfaces, whose values can be obtained without additional network activity, will be in the reply.</p> <p>It is an error to request interfaces that are not supported by this Connection (i.e. mentioned in the <tp:member-ref>ContactAttributeInterfaces</tp:member-ref> property).</p> <tp:rationale> <p>This makes it possible to distinguish between interfaces for which the Connection has nothing to say (e.g. we don't know the avatar tokens of any of the contacts, so we omitted them all), and interfaces for which this API isn't supported.</p> </tp:rationale> <p>Attributes from the interface <tp:dbus-ref>org.freedesktop.Telepathy.Connection</tp:dbus-ref> are always returned, and need not be requested explicitly.</p> <p>As well as returning cached information immediately, the connection MAY start asynchronous requests to obtain better values for the contact attributes. If better values are later obtained by this process, they will be indicated with the usual signals (such as <tp:dbus-ref namespace="org.freedesktop.Telepathy.Connection.Interface.Aliasing">AliasesChanged</tp:dbus-ref>).</p> <tp:rationale> For instance, an XMPP connection manager could download vCards in response to a request for <tp:dbus-ref namespace="org.freedesktop.Telepathy.Connection.Interface">Aliasing</tp:dbus-ref> attributes. </tp:rationale>

`in_Hold` : | Used to pass an 'in' argument: If true, all handles in the result have been held on behalf of the calling process, as if by a call to <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.HoldHandles</tp:dbus-ref>. <tp:rationale> For further round-trip avoidance. </tp:rationale>
`callback` : | called when the method call succeeds or fails; may be `NULL` to make a "fire and forget" call with no reply tracking
`user_data` : | user-supplied data passed to the callback; must be `NULL` if `callback` is `NULL`
`destroy` : | called with the user_data as argument, after the call has succeeded, failed or been cancelled; must be `NULL` if `callback` is `NULL`
`weak_object` : | If not `NULL`, a GObject which will be weakly referenced; if it is destroyed, this call will automatically be cancelled. Must be `NULL` if `callback` is `NULL`
Returns : | a TpProxyPendingCall representing the call in progress. It is borrowed from the object, and will become invalid when the callback is called, the call is cancelled or the TpProxy becomes invalid.

### tp_cli_connection_interface_contacts_callback_for_get_contact_attributes ()

    void                (*tp_cli_connection_interface_contacts_callback_for_get_contact_attributes)
                                                            (TpConnection *proxy,
                                                             GHashTable *out_Attributes,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Signature of the callback called when a GetContactAttributes method call succeeds or fails.

`proxy` : | the proxy on which the call was made

`out_Attributes` :

Used to return an 'out' argument if `error` is `NULL`: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A dictionary mapping the contact handles to contact attributes. If any of the requested handles are in fact invalid, they are simply omitted from this mapping. If contact attributes are not immediately known, the behaviour is defined by the interface; the attribute should either be omitted from the result or replaced with a default value.</p> <p>Each contact's attributes will always include at least the identifier that would be obtained by inspecting the handle (<code>org.freedesktop.Telepathy.Connection/contact-id</code>).</p>

`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_connection_interface_contacts_run_get_contact_attributes ()

    gboolean            tp_cli_connection_interface_contacts_run_get_contact_attributes
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             const GArray *in_Handles,
                                                             const gchar **in_Interfaces,
                                                             gboolean in_Hold,
                                                             GHashTable **out_Attributes,
                                                             GError **error,
                                                             GMainLoop **loop);

Call the method GetContactAttributes and run the main loop until it returns. Before calling this method, you must add a reference to any borrowed objects you need to keep, and generally ensure that everything is in a consistent state.

Return any number of contact attributes for the given handles.

`proxy` : | A TpConnection or subclass
`timeout_ms` : | Timeout in milliseconds, or -1 for default
`in_Handles` : | Used to pass an 'in' argument: An array of handles representing contacts.

`in_Interfaces` :

Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A list of strings indicating which D-Bus interfaces the calling process is interested in. All supported attributes from these interfaces, whose values can be obtained without additional network activity, will be in the reply.</p> <p>It is an error to request interfaces that are not supported by this Connection (i.e. mentioned in the <tp:member-ref>ContactAttributeInterfaces</tp:member-ref> property).</p> <tp:rationale> <p>This makes it possible to distinguish between interfaces for which the Connection has nothing to say (e.g. we don't know the avatar tokens of any of the contacts, so we omitted them all), and interfaces for which this API isn't supported.</p> </tp:rationale> <p>Attributes from the interface <tp:dbus-ref>org.freedesktop.Telepathy.Connection</tp:dbus-ref> are always returned, and need not be requested explicitly.</p> <p>As well as returning cached information immediately, the connection MAY start asynchronous requests to obtain better values for the contact attributes. If better values are later obtained by this process, they will be indicated with the usual signals (such as <tp:dbus-ref namespace="org.freedesktop.Telepathy.Connection.Interface.Aliasing">AliasesChanged</tp:dbus-ref>).</p> <tp:rationale> For instance, an XMPP connection manager could download vCards in response to a request for <tp:dbus-ref namespace="org.freedesktop.Telepathy.Connection.Interface">Aliasing</tp:dbus-ref> attributes. </tp:rationale>

`in_Hold` : | Used to pass an 'in' argument: If true, all handles in the result have been held on behalf of the calling process, as if by a call to <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.HoldHandles</tp:dbus-ref>. <tp:rationale> For further round-trip avoidance. </tp:rationale>

`out_Attributes` :

Used to return an 'out' argument if `TRUE` is returned: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A dictionary mapping the contact handles to contact attributes. If any of the requested handles are in fact invalid, they are simply omitted from this mapping. If contact attributes are not immediately known, the behaviour is defined by the interface; the attribute should either be omitted from the result or replaced with a default value.</p> <p>Each contact's attributes will always include at least the identifier that would be obtained by inspecting the handle (<code>org.freedesktop.Telepathy.Connection/contact-id</code>).</p>

`error` : | If not `NULL`, used to return errors if `FALSE` is returned
`loop` : | If not `NULL`, set before re-entering the main loop, to point to a GMainLoop which can be used to cancel this call with `g_main_loop_quit()`, causing a return of `FALSE` with `error` set to `TP_DBUS_ERROR_CANCELLED`
Returns : | TRUE on success, FALSE and sets `error` on error

## See Also

#TpConnection