## Connection Location interface

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

## Synopsis

    #include <telepathy-glib/telepathy-glib-dbus.h>

    TpProxySignalConnection * tp_cli_connection_interface_location_connect_to_location_updated
                                                            (TpConnection *proxy,
                                                             tp_cli_connection_interface_location_signal_callback_location_updated callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);
    void                (*tp_cli_connection_interface_location_signal_callback_location_updated)
                                                            (TpConnection *proxy,
                                                             guint arg_Contact,
                                                             GHashTable *arg_Location,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_connection_interface_location_call_get_locations
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             const GArray *in_Contacts,
                                                             tp_cli_connection_interface_location_callback_for_get_locations callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_connection_interface_location_callback_for_get_locations)
                                                            (TpConnection *proxy,
                                                             GHashTable *out_Locations,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_connection_interface_location_call_request_location
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             guint in_Contact,
                                                             tp_cli_connection_interface_location_callback_for_request_location callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_connection_interface_location_callback_for_request_location)
                                                            (TpConnection *proxy,
                                                             GHashTable *out_Location,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_connection_interface_location_call_set_location
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             GHashTable *in_Location,
                                                             tp_cli_connection_interface_location_callback_for_set_location callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_connection_interface_location_callback_for_set_location)
                                                            (TpConnection *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

## Description

Some instant messaging protocols support "rich presence" functionality, such as geolocation (advertising the user's location to authorized contacts, and receiving contacts' locations).

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

## Details

### tp_cli_connection_interface_location_connect_to_location_updated ()

    TpProxySignalConnection * tp_cli_connection_interface_location_connect_to_location_updated
                                                            (TpConnection *proxy,
                                                             tp_cli_connection_interface_location_signal_callback_location_updated callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal LocationUpdated.

Emitted when a contact's location changes or becomes known.

`proxy` : | A TpConnection or subclass
`callback` : | Callback to be called when the signal is received
`user_data` : | User-supplied data for the callback
`destroy` : | Destructor for the user-supplied data, which will be called when this signal is disconnected, or before this function returns `NULL`
`weak_object` : | A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected
`error` : | If not `NULL`, used to raise an error if `NULL` is returned
Returns : | a TpProxySignalConnection containing all of the above, which can be used to disconnect the signal; or `NULL` if the proxy does not have the desired interface or has become invalid.

### tp_cli_connection_interface_location_signal_callback_location_updated ()

    void                (*tp_cli_connection_interface_location_signal_callback_location_updated)
                                                            (TpConnection *proxy,
                                                             guint arg_Contact,
                                                             GHashTable *arg_Location,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal LocationUpdated.

`proxy` : | The proxy on which `tp_cli_connection_interface_location_connect_to_location_updated()` was called
`arg_Contact` : | The contact (TpContactHandle)
`arg_Location` : | The contact's location, or empty to indicate that nothing is known about the contact's location.
`user_data` : | User-supplied data
`weak_object` : | User-supplied weakly referenced object

### tp_cli_connection_interface_location_call_get_locations ()

    TpProxyPendingCall * tp_cli_connection_interface_location_call_get_locations
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             const GArray *in_Contacts,
                                                             tp_cli_connection_interface_location_callback_for_get_locations callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a GetLocations method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Return the current locations of the given contacts, if they are already known. If any of the given contacts' locations are not known, request their current locations, but return immediately without waiting for a reply; if a reply with a non-empty location is later received for those contacts, the <tp:member-ref>LocationUpdated</tp:member-ref> signal will be emitted for them.</p> <tp:rationale> <p>This method is appropriate for &quot;lazy&quot; location finding, for instance displaying the location (if available) of everyone in your contact list.</p> </tp:rationale> <p>For backwards compatibility, if this method is called by a client whose &quot;interest count&quot; for this interface, as defined by <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.AddClientInterest</tp:dbus-ref>, is zero, the Connection SHOULD behave as if AddClientInterest had been called for this interface just before that method call. Clients that do not explicitly call AddClientInterest SHOULD NOT call <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.RemoveClientInterest</tp:dbus-ref> either.</p>

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`in_Contacts` : | Used to pass an 'in' argument: The contacts whose locations should be returned or signalled.
`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_location_callback_for_get_locations ()

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

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

`proxy` : | the proxy on which the call was made
`out_Locations` : | Used to return an 'out' argument if `error` is `NULL`: The contacts' locations, if already known. Contacts whose locations are not already known are omitted from the mapping; contacts known to have no location information appear in the mapping with an empty Location dictionary.
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_connection_interface_location_call_request_location ()

    TpProxyPendingCall * tp_cli_connection_interface_location_call_request_location
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             guint in_Contact,
                                                             tp_cli_connection_interface_location_callback_for_request_location callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a RequestLocation method call.

Return the current location of the given contact. If necessary, make a request to the server for up-to-date information, and wait for a reply. <tp:rationale> This method is appropriate for use in a &quot;Contact Information...&quot; dialog; it can be used to show progress information (while waiting for the method to return), and can distinguish between various error conditions. </tp:rationale>

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`in_Contact` : | Used to pass an 'in' argument: The contact whose location should be returned. (TpContactHandle)
`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_location_callback_for_request_location ()

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

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

`proxy` : | the proxy on which the call was made
`out_Location` : | Used to return an 'out' argument if `error` is `NULL`: The contact's location. It MAY be empty, indicating that no location information was found.
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_connection_interface_location_call_set_location ()

    TpProxyPendingCall * tp_cli_connection_interface_location_call_set_location
                                                            (TpConnection *proxy,
                                                             gint timeout_ms,
                                                             GHashTable *in_Location,
                                                             tp_cli_connection_interface_location_callback_for_set_location callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a SetLocation method call.

Set the local user's own location.

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default

`in_Location` :

Used to pass an 'in' argument: The location to advertise. If the user wants to obscure their exact location by reducing the precision or accuracy, clients MUST do this themselves, rather than relying on the connection manager to do so. Clients that interact with more than one connection SHOULD advertise the same reduced-accuracy location to all of them, so that contacts cannot obtain an undesirably accurate location by assuming that random errors have been added and averaging the locations advertised on multiple connections.

`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_location_callback_for_set_location ()

    void                (*tp_cli_connection_interface_location_callback_for_set_location)
                                                            (TpConnection *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

`proxy` : | the proxy on which the call was made
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

## See Also

TpConnection