## TpContact

TpContact — object representing a contact

## Synopsis

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

                        TpContact;
    enum                TpContactFeature;
    #define             TP_CONTACT_FEATURE_INVALID
    #define             NUM_TP_CONTACT_FEATURES
    #define             TP_NUM_CONTACT_FEATURES
    #define             TP_TYPE_CONTACT_FEATURE
    void                (*TpConnectionContactsByHandleCb)   (TpConnection *connection,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             guint n_failed,
                                                             const TpHandle *failed,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpContact *         tp_connection_dup_contact_if_possible
                                                            (TpConnection *connection,
                                                             TpHandle handle,
                                                             const gchar *identifier);
    void                tp_connection_get_contacts_by_handle
                                                            (TpConnection *self,
                                                             guint n_handles,
                                                             const TpHandle *handles,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             TpConnectionContactsByHandleCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*TpConnectionContactsByIdCb)       (TpConnection *connection,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             const gchar * const *requested_ids,
                                                             GHashTable *failed_id_errors,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    void                tp_connection_get_contacts_by_id    (TpConnection *self,
                                                             guint n_ids,
                                                             const gchar * const *ids,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             TpConnectionContactsByIdCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*TpConnectionUpgradeContactsCb)    (TpConnection *connection,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    void                tp_connection_upgrade_contacts      (TpConnection *self,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             TpConnectionUpgradeContactsCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                tp_connection_refresh_contact_info  (TpConnection *self,
                                                             guint n_contacts,
                                                             TpContact * const *contacts);
    const gchar *       tp_contact_get_alias                (TpContact *self);
    const gchar *       tp_contact_get_avatar_token         (TpContact *self);
    GFile *             tp_contact_get_avatar_file          (TpContact *self);
    const gchar *       tp_contact_get_avatar_mime_type     (TpContact *self);
    const gchar * const * tp_contact_get_client_types       (TpContact *self);
    TpAccount *         tp_contact_get_account              (TpContact *self);
    TpConnection *      tp_contact_get_connection           (TpContact *self);
    TpHandle            tp_contact_get_handle               (TpContact *self);
    const gchar *       tp_contact_get_identifier           (TpContact *self);
    const gchar *       tp_contact_get_presence_message     (TpContact *self);
    const gchar *       tp_contact_get_presence_status      (TpContact *self);
    TpConnectionPresenceType tp_contact_get_presence_type   (TpContact *self);
    GHashTable *        tp_contact_get_location             (TpContact *self);
    GVariant *          tp_contact_dup_location             (TpContact *self);
    TpCapabilities *    tp_contact_get_capabilities         (TpContact *self);
    GList *             tp_contact_get_contact_info         (TpContact *self);
    GList *             tp_contact_dup_contact_info         (TpContact *self);
    gboolean            tp_contact_is_blocked               (TpContact *self);
    void                tp_contact_request_contact_info_async
                                                            (TpContact *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_request_contact_info_finish
                                                            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    TpSubscriptionState tp_contact_get_subscribe_state      (TpContact *self);
    TpSubscriptionState tp_contact_get_publish_state        (TpContact *self);
    const gchar *       tp_contact_get_publish_request      (TpContact *self);
    const gchar * const * tp_contact_get_contact_groups     (TpContact *self);
    void                tp_contact_set_contact_groups_async (TpContact *self,
                                                             gint n_groups,
                                                             const gchar * const *groups,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_set_contact_groups_finish
                                                            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            tp_contact_has_feature              (TpContact *self,
                                                             TpContactFeature feature);

    void                tp_connection_dup_contact_by_id_async
                                                            (TpConnection *self,
                                                             const gchar *id,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    TpContact *         tp_connection_dup_contact_by_id_finish
                                                            (TpConnection *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_connection_upgrade_contacts_async
                                                            (TpConnection *self,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_connection_upgrade_contacts_finish
                                                            (TpConnection *self,
                                                             GAsyncResult *result,
                                                             GPtrArray **contacts,
                                                             GError **error);

    void                tp_contact_request_subscription_async
                                                            (TpContact *self,
                                                             const gchar *message,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_request_subscription_finish
                                                            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_contact_authorize_publication_async
                                                            (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_authorize_publication_finish
                                                            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_contact_remove_async             (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_remove_finish            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_contact_unsubscribe_async        (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_unsubscribe_finish       (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_contact_unpublish_async          (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_unpublish_finish         (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_contact_add_to_group_async       (TpContact *self,
                                                             const gchar *group,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_add_to_group_finish      (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_contact_remove_from_group_async  (TpContact *self,
                                                             const gchar *group,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_remove_from_group_finish (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_contact_block_async              (TpContact *self,
                                                             gboolean report_abusive,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_block_finish             (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_contact_unblock_async            (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_contact_unblock_finish           (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----TpContact

      GEnum
       +----TpContactFeature

## Properties

      "alias"                    gchar*                : Read
      "avatar-file"              GFile*                : Read
      "avatar-mime-type"         gchar*                : Read
      "avatar-token"             gchar*                : Read
      "capabilities"             TpCapabilities*       : Read
      "client-types"             GStrv                 : Read
      "connection"               TpConnection*         : Read
      "contact-groups"           GStrv                 : Read
      "contact-info"             TpContactInfoList*    : Read
      "handle"                   guint                 : Read
      "identifier"               gchar*                : Read
      "is-blocked"               gboolean              : Read
      "location"                 GHashTable_gchararray+GValue_*  : Read
      "location-vardict"         GVariant*             : Read
      "presence-message"         gchar*                : Read
      "presence-status"          gchar*                : Read
      "presence-type"            guint                 : Read
      "publish-request"          gchar*                : Read
      "publish-state"            guint                 : Read
      "subscribe-state"          guint                 : Read

## Signals

      "contact-groups-changed"                         : Run Last
      "presence-changed"                               : Run Last
      "subscription-states-changed"                    : Run Last

## Description

TpContact objects represent the contacts on a particular TpConnection.

## Details

### TpContact

    typedef struct _TpContact TpContact;

An object representing a contact on a TpConnection.

Contact objects support tracking a number of attributes of contacts, as described by the TpContactFeature flags. Features can be specified when instantiating contact objects (with `tp_connection_get_contacts_by_id()` or `tp_connection_get_contacts_by_handle()`), or added to an existing contact object with `tp_connection_upgrade_contacts()`. For example, a client wishing to keep track of a contact's alias would set TP_CONTACT_FEATURE_ALIAS, and then listen for the "notify::alias" signal, emitted whenever the "alias" property changes.

Note that releasing a TpContact object might release handle references held by calling `tp_cli_connection_call_request_handles()`, `tp_cli_connection_run_request_handles()`, `tp_cli_connection_call_hold_handles()`, `tp_cli_connection_run_hold_handles()`, `tp_cli_connection_interface_contacts_call_get_contact_attributes()` or `tp_cli_connection_interface_contacts_run_get_contact_attributes()` directly. Those functions should be avoided in favour of using TpContact, `tp_connection_hold_handles()`, `tp_connection_request_handles()` and `tp_connection_get_contact_attributes()`.

Since 0.7.18

### enum TpContactFeature

    typedef enum {
        TP_CONTACT_FEATURE_ALIAS,
        TP_CONTACT_FEATURE_AVATAR_TOKEN,
        TP_CONTACT_FEATURE_PRESENCE,
        TP_CONTACT_FEATURE_LOCATION,
        TP_CONTACT_FEATURE_CAPABILITIES,
        TP_CONTACT_FEATURE_AVATAR_DATA,
        TP_CONTACT_FEATURE_CONTACT_INFO,
        TP_CONTACT_FEATURE_CLIENT_TYPES,
        TP_CONTACT_FEATURE_SUBSCRIPTION_STATES,
        TP_CONTACT_FEATURE_CONTACT_GROUPS,
        TP_CONTACT_FEATURE_CONTACT_BLOCKING,
    } TpContactFeature;

Enumeration representing the features a TpContact can optionally support. When requesting a TpContact, library users specify the desired features; the TpContact code will only initialize state for those features, to avoid unwanted D-Bus round-trips and signal connections.

Since 0.11.5, there is a corresponding GEnumClass type, `TP_TYPE_CONTACT_FEATURE`.

`TP_CONTACT_FEATURE_ALIAS` | "alias"
`TP_CONTACT_FEATURE_AVATAR_TOKEN` | "avatar-token"
`TP_CONTACT_FEATURE_PRESENCE` | "presence-type", "presence-status" and "presence-message"
`TP_CONTACT_FEATURE_LOCATION` | "location" (available since 0.11.1) and "location-vardict" (since 0.19.10)
`TP_CONTACT_FEATURE_CAPABILITIES` | "capabilities" (available since 0.11.3)
`TP_CONTACT_FEATURE_AVATAR_DATA` | "avatar-file" and "avatar-mime-type". Implies `TP_CONTACT_FEATURE_AVATAR_TOKEN` (available since 0.11.6)
`TP_CONTACT_FEATURE_CONTACT_INFO` | "contact-info" (available since 0.11.7)
`TP_CONTACT_FEATURE_CLIENT_TYPES` | "client-types" (available since 0.13.1)
`TP_CONTACT_FEATURE_SUBSCRIPTION_STATES` | "subscribe-state", "publish-state" and "publish-request". Require a Connection implementing the `TP_IFACE_CONNECTION_INTERFACE_CONTACT_LIST` interface. (available since 0.13.12)
`TP_CONTACT_FEATURE_CONTACT_GROUPS` | "contact-groups" (available since 0.13.14)
`TP_CONTACT_FEATURE_CONTACT_BLOCKING` | "is-blocked". Require Connection implementing the `TP_IFACE_CONNECTION_INTERFACE_CONTACT_BLOCKING` interface. (available since 0.17.0)

Since 0.7.18

### TP_CONTACT_FEATURE_INVALID

    #define TP_CONTACT_FEATURE_INVALID ((TpContactFeature) -1)

An invalid TpContactFeature. Used as list termination. See for example `tp_simple_client_factory_add_contact_features_varargs()`.

Since 0.15.5

### NUM_TP_CONTACT_FEATURES

    #define NUM_TP_CONTACT_FEATURES TP_NUM_CONTACT_FEATURES

1 higher than the highest TpContactFeature supported by this version of telepathy-glib. Use `TP_NUM_CONTACT_FEATURES` in new code.

Since 0.7.18

### TP_NUM_CONTACT_FEATURES

    #define TP_NUM_CONTACT_FEATURES (TP_CONTACT_FEATURE_CONTACT_BLOCKING + 1)

1 higher than the highest TpContactFeature supported by this version of telepathy-glib.

Since 0.19.0

### TP_TYPE_CONTACT_FEATURE

    #define TP_TYPE_CONTACT_FEATURE (tp_contact_feature_get_type ())

The GEnumClass type of a TpContactFeature.

Since 0.11.5

### TpConnectionContactsByHandleCb ()

    void                (*TpConnectionContactsByHandleCb)   (TpConnection *connection,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             guint n_failed,
                                                             const TpHandle *failed,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

### Warning

`TpConnectionContactsByHandleCb` is deprecated and should not be used in newly-written code.

Signature of a callback used to receive the result of `tp_connection_get_contacts_by_handle()`.

If an unrecoverable error occurs (for instance, if `connection` becomes disconnected) the whole operation fails, and no contacts or invalid handles are returned.

If some or even all of the `handles` passed to `tp_connection_get_contacts_by_handle()` were not valid, this is not considered to be a failure. `error` will be `NULL` in this situation, `contacts` will contain contact objects for those handles that were valid (possibly none of them), and `invalid` will contain the handles that were not valid.

`connection` : | The connection
`n_contacts` : | The number of TpContact objects successfully created (one per valid handle), or 0 on unrecoverable errors
`contacts` : | An array of `n_contacts` TpContact objects (this callback is not given a reference to any of these objects, and must call `g_object_ref()` on any that it will keep), or `NULL` on unrecoverable errors. [array length=n_contacts]
`n_failed` : | The number of invalid handles that were passed to `tp_connection_get_contacts_by_handle()` (or on unrecoverable errors, the total number of handles that were given)
`failed` : | An array of `n_failed` handles that were passed to `tp_connection_get_contacts_by_handle()` but turned out to be invalid (or on unrecoverable errors, all the handles that were given). [array length=n_failed]
`error` : | `NULL` on success, or an unrecoverable error that caused everything to fail
`user_data` : | the `user_data` that was passed to `tp_connection_get_contacts_by_handle()`
`weak_object` : | the `weak_object` that was passed to `tp_connection_get_contacts_by_handle()`

Since 0.7.18

### tp_connection_dup_contact_if_possible ()

    TpContact *         tp_connection_dup_contact_if_possible
                                                            (TpConnection *connection,
                                                             TpHandle handle,
                                                             const gchar *identifier);

Try to return an existing contact object or create a new contact object immediately.

If `tp_connection_has_immortal_handles()` would return `TRUE` and `identifier` is non-`NULL`, this function always succeeds.

On connections without immortal handles, it is not possible to guarantee that `handle` remains valid without making asynchronous D-Bus calls, so it might be necessary to delay processing of messages or other events until a TpContact can be constructed asynchronously, for instance by using `tp_connection_get_contacts_by_id()`.

Similarly, if `identifier` is `NULL`, it might not be possible to find the identifier for `handle` without making asynchronous D-Bus calls, so it might be necessary to delay processing of messages or other events until a TpContact can be constructed asynchronously, for instance by using `tp_connection_get_contacts_by_handle()`.

`connection` : | a connection
`handle` : | a handle of type `TP_HANDLE_TYPE_CONTACT`
`identifier` : | the normalized identifier (XMPP JID, etc.) corresponding to `handle`, or `NULL` if not known. [transfer none]
Returns : | a contact or `NULL`. [transfer full]

Since 0.13.9

### tp_connection_get_contacts_by_handle ()

    void                tp_connection_get_contacts_by_handle
                                                            (TpConnection *self,
                                                             guint n_handles,
                                                             const TpHandle *handles,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             TpConnectionContactsByHandleCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

### Warning

`tp_connection_get_contacts_by_handle` is deprecated and should not be used in newly-written code. Use `tp_simple_client_factory_ensure_contact()` instead.

Create a number of TpContact objects and make asynchronous method calls to hold their handles and ensure that all the features specified in `features` are ready for use (if they are supported at all).

It is not an error to put features in `features` even if the connection manager doesn't support them - users of this method should have a static list of features they would like to use if possible, and use it for all connection managers.

`self` : | A connection, which must have the `TP_CONNECTION_FEATURE_CONNECTED` feature prepared
`n_handles` : | The number of handles in `handles` (must be at least 1)
`handles` : | An array of handles of type `TP_HANDLE_TYPE_CONTACT` representing the desired contacts. [array length=n_handles][element-type uint]
`n_features` : | The number of features in `features` (may be 0)
`features` : | An array of features that must be ready for use (if supported) before the callback is called (may be `NULL` if `n_features` is 0). [array length=n_features][allow-none][element-type uint]
`callback` : | A user callback to call when the contacts are ready
`user_data` : | Data to pass to the callback
`destroy` : | Called to destroy `user_data` either after `callback` has been called, or if the operation is cancelled
`weak_object` : | An object to pass to the callback, which will be weakly referenced; if this object is destroyed, the operation will be cancelled. [allow-none]

Since 0.7.18

### TpConnectionContactsByIdCb ()

    void                (*TpConnectionContactsByIdCb)       (TpConnection *connection,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             const gchar * const *requested_ids,
                                                             GHashTable *failed_id_errors,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

### Warning

`TpConnectionContactsByIdCb` is deprecated and should not be used in newly-written code.

Signature of a callback used to receive the result of `tp_connection_get_contacts_by_id()`.

`requested_ids` contains the IDs that were converted to handles successfully. The normalized form of requested_ids[i] is tp_contact_get_identifier (contacts[i]).

If some or even all of the `ids` passed to `tp_connection_get_contacts_by_id()` were not valid, this is not considered to be a fatal error. `error` will be `NULL` in this situation, `contacts` will contain contact objects for those IDs that were valid (it may be empty), and `failed_id_errors` will map the IDs that were not valid to a corresponding GError (if the connection manager complies with the Telepathy spec, it will have domain `TP_ERROR` and code `TP_ERROR_INVALID_HANDLE`).

If an unrecoverable error occurs (for instance, if `connection` becomes disconnected) the whole operation fails, and no contacts or requested IDs are returned. `failed_id_errors` will contain all the IDs that were requested, mapped to a corresponding GError (either one indicating that the ID was invalid, if that was determined before the fatal error occurred, or a copy of `error`).

`connection` : | The connection
`n_contacts` : | The number of TpContact objects successfully created (one per valid ID), or 0 on unrecoverable errors
`contacts` : | An array of `n_contacts` TpContact objects (this callback is not given a reference to any of these objects, and must call `g_object_ref()` on any that it will keep), or `NULL` on unrecoverable errors. [array length=n_contacts]
`requested_ids` : | An array of `n_contacts` valid IDs (JIDs, SIP URIs etc.) that were passed to `tp_connection_get_contacts_by_id()`, in an order corresponding to `contacts`, or `NULL` on unrecoverable errors. [array length=n_contacts]
`failed_id_errors` : | A hash table in which the keys are IDs and the values are errors (GError). [element-type utf8 GLib.Error]
`error` : | `NULL` on success, or an unrecoverable error that caused everything to fail
`user_data` : | the `user_data` that was passed to `tp_connection_get_contacts_by_id()`
`weak_object` : | the `weak_object` that was passed to `tp_connection_get_contacts_by_id()`

Since 0.7.18

### tp_connection_get_contacts_by_id ()

    void                tp_connection_get_contacts_by_id    (TpConnection *self,
                                                             guint n_ids,
                                                             const gchar * const *ids,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             TpConnectionContactsByIdCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

### Warning

`tp_connection_get_contacts_by_id` is deprecated and should not be used in newly-written code. Use `tp_connection_dup_contact_by_id_async()` instead.

Create a number of TpContact objects and make asynchronous method calls to obtain their handles and ensure that all the features specified in `features` are ready for use (if they are supported at all).

It is not an error to put features in `features` even if the connection manager doesn't support them - users of this method should have a static list of features they would like to use if possible, and use it for all connection managers.

`self` : | A connection, which must have the `TP_CONNECTION_FEATURE_CONNECTED` feature prepared
`n_ids` : | The number of IDs in `ids` (must be at least 1)
`ids` : | An array of strings representing the desired contacts by their identifiers in the IM protocol (XMPP JIDs, SIP URIs, MSN Passports, AOL screen-names etc.). [array length=n_ids][transfer none]
`n_features` : | The number of features in `features` (may be 0)
`features` : | An array of features that must be ready for use (if supported) before the callback is called (may be `NULL` if `n_features` is 0). [array length=n_features][allow-none]
`callback` : | A user callback to call when the contacts are ready
`user_data` : | Data to pass to the callback
`destroy` : | Called to destroy `user_data` either after `callback` has been called, or if the operation is cancelled
`weak_object` : | An object to pass to the callback, which will be weakly referenced; if this object is destroyed, the operation will be cancelled. [allow-none]

Since 0.7.18

### TpConnectionUpgradeContactsCb ()

    void                (*TpConnectionUpgradeContactsCb)    (TpConnection *connection,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

### Warning

`TpConnectionUpgradeContactsCb` is deprecated and should not be used in newly-written code.

Signature of a callback used to receive the result of `tp_connection_upgrade_contacts()`.

If an unrecoverable error occurs (for instance, if `connection` becomes disconnected) it is indicated by `error`, but the contacts in `contacts` are still provided.

`connection` : | The connection
`n_contacts` : | The number of TpContact objects for which an upgrade was requested
`contacts` : | An array of `n_contacts` TpContact objects (this callback is not given an extra reference to any of these objects, and must call `g_object_ref()` on any that it will keep). [array length=n_contacts]
`error` : | An unrecoverable error, or `NULL` if the connection remains valid
`user_data` : | the `user_data` that was passed to `tp_connection_upgrade_contacts()`
`weak_object` : | the `weak_object` that was passed to `tp_connection_upgrade_contacts()`

Since 0.7.18

### tp_connection_upgrade_contacts ()

    void                tp_connection_upgrade_contacts      (TpConnection *self,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             TpConnectionUpgradeContactsCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

### Warning

`tp_connection_upgrade_contacts` is deprecated and should not be used in newly-written code. Use `tp_connection_upgrade_contacts_async()` instead.

Given several TpContact objects, make asynchronous method calls ensure that all the features specified in `features` are ready for use (if they are supported at all).

It is not an error to put features in `features` even if the connection manager doesn't support them - users of this method should have a static list of features they would like to use if possible, and use it for all connection managers.

`self` : | A connection, which must have the `TP_CONNECTION_FEATURE_CONNECTED` feature prepared
`n_contacts` : | The number of contacts in `contacts` (must be at least 1)
`contacts` : | An array of TpContact objects associated with `self`. [array length=n_contacts]
`n_features` : | The number of features in `features` (must be at least 1)
`features` : | An array of features that must be ready for use (if supported) before the callback is called. [array length=n_features]
`callback` : | A user callback to call when the contacts are ready
`user_data` : | Data to pass to the callback
`destroy` : | Called to destroy `user_data` either after `callback` has been called, or if the operation is cancelled
`weak_object` : | An object to pass to the callback, which will be weakly referenced; if this object is destroyed, the operation will be cancelled. [allow-none]

Since 0.7.18

### tp_connection_refresh_contact_info ()

    void                tp_connection_refresh_contact_info  (TpConnection *self,
                                                             guint n_contacts,
                                                             TpContact * const *contacts);

Requests to refresh the "contact-info" property on each contact from `contacts`, requesting it from the network if an up-to-date version is not cached locally. "notify::contact-info" will be emitted when the contact's information are updated.

If `TP_CONTACT_FEATURE_CONTACT_INFO` is not yet set on a contact, it will be set before its property gets updated.

`self` : | a TpConnection
`n_contacts` : | The number of contacts in `contacts` (must be at least 1)
`contacts` : | An array of TpContact objects associated with `self`. [array length=n_contacts]

Since 0.11.7

### tp_contact_get_alias ()

    const gchar *       tp_contact_get_alias                (TpContact *self);

Return the contact's alias. This remains valid until the main loop is re-entered; if the caller requires a string that will persist for longer than that, it must be copied with `g_strdup()`.

`self` : | a contact
Returns : | the same non-`NULL` alias as the "alias"

Since 0.7.18

### tp_contact_get_avatar_token ()

    const gchar *       tp_contact_get_avatar_token         (TpContact *self);

Return the contact's avatar token. This remains valid until the main loop is re-entered; if the caller requires a string that will persist for longer than that, it must be copied with `g_strdup()`.

`self` : | a contact
Returns : | the same token as the "avatar-token" property (possibly `NULL`)

Since 0.7.18

### tp_contact_get_avatar_file ()

    GFile *             tp_contact_get_avatar_file          (TpContact *self);

Return the contact's avatar file. This remains valid until the main loop is re-entered; if the caller requires a GFile that will persist for longer than that, it must be reffed with `g_object_ref()`.

`self` : | a contact
Returns : | the same GFile as the "avatar-file" property (possibly `NULL`). [transfer none]

Since 0.11.6

### tp_contact_get_avatar_mime_type ()

    const gchar *       tp_contact_get_avatar_mime_type     (TpContact *self);

Return the contact's avatar MIME type. This remains valid until the main loop is re-entered; if the caller requires a string that will persist for longer than that, it must be copied with `g_strdup()`.

`self` : | a contact
Returns : | the same MIME type as the "avatar-mime-type" property (possibly `NULL`)

Since 0.11.6

### tp_contact_get_client_types ()

    const gchar * const * tp_contact_get_client_types       (TpContact *self);

Return the contact's client types or `NULL` if the client types are unspecified.

`self` : | a contact
Returns : | the same GStrv as the "client-types" property. [array zero-terminated=1][transfer none]

Since 0.13.1

### tp_contact_get_account ()

    TpAccount *         tp_contact_get_account              (TpContact *self);

Return the TpAccount of `self`'s "connection". See `tp_connection_get_account()` for details.

`self` : | a contact
Returns : | a borrowed reference to `self`'s account (it must be referenced with g_object_ref if it must remain valid longer than the contact). [transfer none]

Since 0.19.0

### tp_contact_get_connection ()

    TpConnection *      tp_contact_get_connection           (TpContact *self);

`self` : | a contact
Returns : | a borrowed reference to the "connection" (it must be referenced with g_object_ref if it must remain valid longer than the contact). [transfer none]

Since 0.7.18

### tp_contact_get_handle ()

    TpHandle            tp_contact_get_handle               (TpContact *self);

Return the contact's handle, which is of type `TP_HANDLE_TYPE_CONTACT`, or 0 if the "connection" has become invalid.

This handle is referenced using the Telepathy D-Bus API and remains referenced for as long as `self` exists and the "connection" remains valid.

However, the caller of this function does not gain an additional reference to the handle.

`self` : | a contact
Returns : | the same handle as the "handle" property

Since 0.7.18

### tp_contact_get_identifier ()

    const gchar *       tp_contact_get_identifier           (TpContact *self);

Return the contact's identifier. This remains valid for as long as `self` exists; if the caller requires a string that will persist for longer than that, it must be copied with `g_strdup()`.

`self` : | a contact
Returns : | the same non-`NULL` identifier as the "identifier" property

Since 0.7.18

### tp_contact_get_presence_message ()

    const gchar *       tp_contact_get_presence_message     (TpContact *self);

Return the contact's user-defined status message, or an empty string. This remains valid until the main loop is re-entered; if the caller requires a string that will persist for longer than that, it must be copied with `g_strdup()`.

`self` : | a contact
Returns : | the same non-`NULL` message as the "presence-message" property

Since 0.7.18

### tp_contact_get_presence_status ()

    const gchar *       tp_contact_get_presence_status      (TpContact *self);

Return the name of the contact's presence status, or an empty string. This remains valid until the main loop is re-entered; if the caller requires a string that will persist for longer than that, it must be copied with `g_strdup()`.

`self` : | a contact
Returns : | the same non-`NULL` status name as the "presence-status" property

Since 0.7.18

### tp_contact_get_presence_type ()

    TpConnectionPresenceType tp_contact_get_presence_type   (TpContact *self);

If this object has been set up to track `TP_CONTACT_FEATURE_PRESENCE` and the underlying connection supports either the Presence or SimplePresence interfaces, return the type of the contact's presence.

Otherwise, return `TP_CONNECTION_PRESENCE_TYPE_UNSET`.

`self` : | a contact
Returns : | the same presence type as the "presence-type" property

Since 0.7.18

### tp_contact_get_location ()

    GHashTable *        tp_contact_get_location             (TpContact *self);

Return the contact's user-defined location or `NULL` if the location is unspecified. This remains valid until the main loop is re-entered; if the caller requires a hash table that will persist for longer than that, it must be reffed with `g_hash_table_ref()`.

`self` : | a contact
Returns : | the same GHashTable (or `NULL`) as the "location" property. [element-type utf8 GObject.Value][transfer none]

Since 0.11.1

### tp_contact_dup_location ()

    GVariant *          tp_contact_dup_location             (TpContact *self);

Return the contact's user-defined location, or `NULL` if the location is unspecified.

This function returns the same information as `tp_contact_get_location()`, but in a different format.

`self` : | a contact
Returns : | a variant of type `G_VARIANT_TYPE_VARDICT`, the same as the "location-vardict" property

Since 0.19.10

### tp_contact_get_capabilities ()

    TpCapabilities *    tp_contact_get_capabilities         (TpContact *self);

`self` : | a contact
Returns : | the same TpCapabilities (or `NULL`) as the "capabilities" property. [transfer none]

Since 0.11.3

### tp_contact_get_contact_info ()

    GList *             tp_contact_get_contact_info         (TpContact *self);

### Warning

`tp_contact_get_contact_info` is deprecated and should not be used in newly-written code. Since 0.19.9. New code should use `tp_contact_dup_contact_info()` instead.

Returns a newly allocated GList of contact's vCard fields. The list must be freed with `g_list_free()` after used.

Note that the TpContactInfoFields in the returned GList are not dupped before returning from this function. One could copy every item in the list using `tp_contact_info_field_copy()`.

Same as the "contact-info" property.

`self` : | a TpContact
Returns : | a GList of TpContactInfoField, or `NULL` if the feature is not yet prepared. [element-type TelepathyGLib.ContactInfoField][transfer container]

Since 0.11.7

### tp_contact_dup_contact_info ()

    GList *             tp_contact_dup_contact_info         (TpContact *self);

Returns a newly allocated GList of contact's vCard fields. The list must be freed with `tp_contact_info_list_free()` after used.

Same as the "contact-info" property.

`self` : | a TpContact
Returns : | a GList of TpContactInfoField, or `NULL` if the feature is not yet prepared. [element-type TelepathyGLib.ContactInfoField][transfer full]

Since 0.19.9

### tp_contact_is_blocked ()

    gboolean            tp_contact_is_blocked               (TpContact *self);

`self` : | a TpContact
Returns : | the value of "is-blocked".

Since 0.17.0

### tp_contact_request_contact_info_async ()

    void                tp_contact_request_contact_info_async
                                                            (TpContact *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Requests an asynchronous request of the contact info of `self`. When the operation is finished, `callback` will be called. You can then call `tp_contact_request_contact_info_finish()` to get the result of the operation.

If the operation is successful, the "contact-info" property will be updated (emitting "notify::contact-info" signal) before `callback` is called. That means you can call `tp_contact_get_contact_info()` to get the new vCard inside `callback`.

Note that requesting the vCard from the network can take significant time, so a bigger timeout is set on the underlying D-Bus call. `cancellable` can be cancelled to free resources used in the D-Bus call if the caller is no longer interested in the vCard.

If `TP_CONTACT_FEATURE_CONTACT_INFO` is not yet set on `self`, it will be set before its property gets updated and `callback` is called.

`self` : | a TpContact
`cancellable` : | optional GCancellable object, `NULL` to ignore.
`callback` : | a callback to call when the request is satisfied
`user_data` : | data to pass to `callback`

Since 0.11.7

### tp_contact_request_contact_info_finish ()

    gboolean            tp_contact_request_contact_info_finish
                                                            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an async request of `self` info. If the operation was successful, the contact's vCard can be accessed using `tp_contact_get_contact_info()`.

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to be filled
Returns : | `TRUE` if the request call was successful, otherwise `FALSE`

Since 0.11.7

### tp_contact_get_subscribe_state ()

    TpSubscriptionState tp_contact_get_subscribe_state      (TpContact *self);

Return the state of the local user's subscription to this remote contact's presence.

This is set to `TP_SUBSCRIPTION_STATE_UNKNOWN` until `TP_CONTACT_FEATURE_SUBSCRIPTION_STATES` has been prepared

`self` : | a TpContact
Returns : | the value of "subscribe-state".

Since 0.13.12

### tp_contact_get_publish_state ()

    TpSubscriptionState tp_contact_get_publish_state        (TpContact *self);

Return the state of this remote contact's subscription to the local user's presence.

This is set to `TP_SUBSCRIPTION_STATE_UNKNOWN` until `TP_CONTACT_FEATURE_SUBSCRIPTION_STATES` has been prepared

`self` : | a TpContact
Returns : | the value of "publish-state".

Since 0.13.12

### tp_contact_get_publish_request ()

    const gchar *       tp_contact_get_publish_request      (TpContact *self);

If "publish-state" is set to `TP_SUBSCRIPTION_STATE_ASK`, return the message that this remote contact sent when they requested permission to see the local user's presence, an empty string ("") otherwise. This remains valid until the main loop is re-entered; if the caller requires a string that will persist for longer than that, it must be copied with `g_strdup()`.

This is set to `NULL` until `TP_CONTACT_FEATURE_SUBSCRIPTION_STATES` has been prepared, and it is guaranteed to be non-`NULL` afterward.

`self` : | a TpContact
Returns : | the value of "publish-request".

Since 0.13.12

### tp_contact_get_contact_groups ()

    const gchar * const * tp_contact_get_contact_groups     (TpContact *self);

Return names of groups of which a contact is a member. It is incorrect to call this method before `TP_CONTACT_FEATURE_CONTACT_GROUPS` has been prepared. This remains valid until the main loop is re-entered; if the caller requires a GStrv that will persist for longer than that, it must be copied with `g_strdupv()`.

`self` : | a TpContact
Returns : | the same GStrv as the "contact-groups" property. [array zero-terminated=1][transfer none]

Since 0.13.14

### tp_contact_set_contact_groups_async ()

    void                tp_contact_set_contact_groups_async (TpContact *self,
                                                             gint n_groups,
                                                             const gchar * const *groups,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Add `self` to the given groups (creating new groups if necessary), and remove it from all other groups. If the user is removed from a group of which they were the only member, the group MAY be removed automatically. You can then call `tp_contact_set_contact_groups_finish()` to get the result of the operation.

If the operation is successful and `TP_CONTACT_FEATURE_CONTACT_GROUPS` is prepared, the "contact-groups" property will be updated (emitting "notify::contact-groups" signal) and "contact-groups-changed" signal will be emitted before `callback` is called. That means you can call `tp_contact_get_contact_groups()` to get the new contact groups inside `callback`.

`self` : | a TpContact
`n_groups` : | the number of groups, or -1 if `groups` is `NULL`-terminated
`groups` : | the set of groups which the contact should be in (may be `NULL` if `n_groups` is 0). [array length=n_groups][element-type utf8][allow-none]
`callback` : | a callback to call when the request is satisfied
`user_data` : | data to pass to `callback`

Since 0.13.14

### tp_contact_set_contact_groups_finish ()

    gboolean            tp_contact_set_contact_groups_finish
                                                            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an async set of `self` contact groups.

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to be filled
Returns : | `TRUE` if the request call was successful, otherwise `FALSE`

Since 0.13.14

### tp_contact_has_feature ()

    gboolean            tp_contact_has_feature              (TpContact *self,
                                                             TpContactFeature feature);

`self` : | a contact
`feature` : | a desired feature
Returns : | `TRUE` if `self` has been set up to track the feature `feature`

Since 0.7.18

### tp_connection_dup_contact_by_id_async ()

    void                tp_connection_dup_contact_by_id_async
                                                            (TpConnection *self,
                                                             const gchar *id,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Create a TpContact object and make any asynchronous method calls necessary to ensure that all the features specified in `features` are ready for use (if they are supported at all).

It is not an error to put features in `features` even if the connection manager doesn't support them - users of this method should have a static list of features they would like to use if possible, and use it for all connection managers.

`self` : | A connection, which must have the `TP_CONNECTION_FEATURE_CONNECTED` feature prepared
`id` : | A strings representing the desired contact by its identifier in the IM protocol (an XMPP JID, SIP URI, MSN Passport, AOL screen-name etc.)
`n_features` : | The number of features in `features` (may be 0)
`features` : | An array of features that must be ready for use (if supported) before the callback is called (may be `NULL` if `n_features` is 0). [array length=n_features][allow-none]
`callback` : | A user callback to call when the contact is ready
`user_data` : | Data to pass to the callback

Since 0.19.0

### tp_connection_dup_contact_by_id_finish ()

    TpContact *         tp_connection_dup_contact_by_id_finish
                                                            (TpConnection *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_connection_dup_contact_by_id_async()`.

`self` : | a TpConnection
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | a TpContact or `NULL` on error. [transfer full]

Since 0.19.0

### tp_connection_upgrade_contacts_async ()

    void                tp_connection_upgrade_contacts_async
                                                            (TpConnection *self,
                                                             guint n_contacts,
                                                             TpContact * const *contacts,
                                                             guint n_features,
                                                             const TpContactFeature *features,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Given several TpContact objects, make asynchronous method calls ensure that all the features specified in `features` are ready for use (if they are supported at all).

It is not an error to put features in `features` even if the connection manager doesn't support them - users of this method should have a static list of features they would like to use if possible, and use it for all connection managers.

`self` : | A connection, which must have the `TP_CONNECTION_FEATURE_CONNECTED` feature prepared
`n_contacts` : | The number of contacts in `contacts` (must be at least 1)
`contacts` : | An array of TpContact objects associated with `self`. [array length=n_contacts]
`n_features` : | The number of features in `features` (must be at least 1)
`features` : | An array of features that must be ready for use (if supported) before the callback is called. [array length=n_features]
`callback` : | A user callback to call when the contacts are ready
`user_data` : | Data to pass to the callback

Since 0.19.0

### tp_connection_upgrade_contacts_finish ()

    gboolean            tp_connection_upgrade_contacts_finish
                                                            (TpConnection *self,
                                                             GAsyncResult *result,
                                                             GPtrArray **contacts,
                                                             GError **error);

Finishes `tp_connection_upgrade_contacts_async()`.

`self` : | a TpConnection
`result` : | a GAsyncResult
`contacts` : | a location to set a GPtrArray of upgraded TpContact, or `NULL`. [element-type TelepathyGLib.Contact][transfer container][out][allow-none]
`error` : | a GError to fill
Returns : | `TRUE` on success, `FALSE` otherwise.

Since 0.19.0

### tp_contact_request_subscription_async ()

    void                tp_contact_request_subscription_async
                                                            (TpContact *self,
                                                             const gchar *message,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Convenience wrapper for `tp_connection_request_subscription_async()` on a single contact.

`self` : | a TpContact
`message` : | an optional message
`callback` : | a callback to call when the operation finishes
`user_data` : | data to pass to `callback`

Since 0.15.5

### tp_contact_request_subscription_finish ()

    gboolean            tp_contact_request_subscription_finish
                                                            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_contact_request_subscription_async()`

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the operation was successful, otherwise `FALSE`.

Since 0.15.5

### tp_contact_authorize_publication_async ()

    void                tp_contact_authorize_publication_async
                                                            (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Convenience wrapper for `tp_connection_authorize_publication_async()` on a single contact.

`self` : | a TpContact
`callback` : | a callback to call when the operation finishes
`user_data` : | data to pass to `callback`

Since 0.15.5

### tp_contact_authorize_publication_finish ()

    gboolean            tp_contact_authorize_publication_finish
                                                            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_contact_authorize_publication_async()`

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the operation was successful, otherwise `FALSE`.

Since 0.15.5

### tp_contact_remove_async ()

    void                tp_contact_remove_async             (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Convenience wrapper for `tp_connection_remove_contacts_async()` on a single contact.

`self` : | a TpContact
`callback` : | a callback to call when the operation finishes
`user_data` : | data to pass to `callback`

Since 0.15.5

### tp_contact_remove_finish ()

    gboolean            tp_contact_remove_finish            (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_contact_remove_async()`

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the operation was successful, otherwise `FALSE`.

Since 0.15.5

### tp_contact_unsubscribe_async ()

    void                tp_contact_unsubscribe_async        (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Convenience wrapper for `tp_connection_unsubscribe_async()` on a single contact.

`self` : | a TpContact
`callback` : | a callback to call when the operation finishes
`user_data` : | data to pass to `callback`

Since 0.15.5

### tp_contact_unsubscribe_finish ()

    gboolean            tp_contact_unsubscribe_finish       (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_contact_unsubscribe_async()`

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the operation was successful, otherwise `FALSE`.

Since 0.15.5

### tp_contact_unpublish_async ()

    void                tp_contact_unpublish_async          (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Convenience wrapper for `tp_connection_unpublish_async()` on a single contact.

`self` : | a TpContact
`callback` : | a callback to call when the operation finishes
`user_data` : | data to pass to `callback`

Since 0.15.5

### tp_contact_unpublish_finish ()

    gboolean            tp_contact_unpublish_finish         (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_contact_unpublish_async()`

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the operation was successful, otherwise `FALSE`.

Since 0.15.5

### tp_contact_add_to_group_async ()

    void                tp_contact_add_to_group_async       (TpContact *self,
                                                             const gchar *group,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Convenience wrapper for `tp_connection_add_to_group_async()` on a single contact.

`self` : | a TpContact
`group` : | the group to alter.
`callback` : | a callback to call when the operation finishes
`user_data` : | data to pass to `callback`

Since 0.15.5

### tp_contact_add_to_group_finish ()

    gboolean            tp_contact_add_to_group_finish      (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_contact_add_to_group_async()`

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the operation was successful, otherwise `FALSE`.

Since 0.15.5

### tp_contact_remove_from_group_async ()

    void                tp_contact_remove_from_group_async  (TpContact *self,
                                                             const gchar *group,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Convenience wrapper for `tp_connection_remove_from_group_async()` on a single contact.

`self` : | a TpContact
`group` : | the group to alter.
`callback` : | a callback to call when the operation finishes
`user_data` : | data to pass to `callback`

Since 0.15.5

### tp_contact_remove_from_group_finish ()

    gboolean            tp_contact_remove_from_group_finish (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_contact_remove_from_group_async()`

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the operation was successful, otherwise `FALSE`.

Since 0.15.5

### tp_contact_block_async ()

    void                tp_contact_block_async              (TpContact *self,
                                                             gboolean report_abusive,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Block communications with a contact, optionally reporting the contact as abusive to the server administrators. To block more than one contact at once, see `tp_connection_block_contacts_async()`.

`self` : | a TpContact
`report_abusive` : | If `TRUE`, report this contact as abusive to the server administrators as well as blocking him. See "can-report-abusive" to discover whether reporting abuse is supported. If "can-report-abusive" is `FALSE`, this parameter will be ignored.
`callback` : | a callback to call when the operation finishes
`user_data` : | data to pass to `callback`

Since 0.17.0

### tp_contact_block_finish ()

    gboolean            tp_contact_block_finish             (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_contact_block_async()`

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the operation was successful, otherwise `FALSE`.

Since 0.17.0

### tp_contact_unblock_async ()

    void                tp_contact_unblock_async            (TpContact *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Unblock communications with a contact. To unblock more than one contact at once, see `tp_connection_unblock_contacts_async()`.

`self` : | a TpContact
`callback` : | a callback to call when the operation finishes
`user_data` : | data to pass to `callback`

Since 0.17.0

### tp_contact_unblock_finish ()

    gboolean            tp_contact_unblock_finish           (TpContact *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes `tp_contact_unblock_async()`

`self` : | a TpContact
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the operation was successful, otherwise `FALSE`.

Since 0.17.0

## Property Details

### The `"alias"` property

      "alias"                    gchar*                : Read

The contact's alias if available, falling back to their "identifier" if no alias is available or if the TpContact has not been set up to track `TP_CONTACT_FEATURE_ALIAS`.

This alias may have been supplied by the contact themselves, or by the local user, so it does not necessarily unambiguously identify the contact. However, it is suitable for use as a main "display name" for the contact.

This is never `NULL` for contact objects that are visible to library-user code.

Default value: NULL

### The `"avatar-file"` property

      "avatar-file"              GFile*                : Read

GFile to the latest cached avatar image, or `NULL` if this contact has no avatar, or if the avatar data is not yet retrieved.

When "avatar-token" changes, this property is not updated immediately, but will be updated when the new avatar data is retrieved and stored in cache. Until then, the file will keep its old value of the latest cached avatar image.

This is set to `NULL` if `TP_CONTACT_FEATURE_AVATAR_DATA` is not set on this contact. Note that setting `TP_CONTACT_FEATURE_AVATAR_DATA` will also implicitly set `TP_CONTACT_FEATURE_AVATAR_TOKEN`.

Since 0.11.6

### The `"avatar-mime-type"` property

      "avatar-mime-type"         gchar*                : Read

MIME type of the latest cached avatar image, or `NULL` if this contact has no avatar, or if the avatar data is not yet retrieved.

This is always the MIME type of the image given by "avatar-file".

Default value: NULL

Since 0.11.6

### The `"avatar-token"` property

      "avatar-token"             gchar*                : Read

An opaque string representing state of the contact's avatar (depending on the protocol, this might be a hash, a timestamp or something else), or an empty string if there is no avatar.

This may be `NULL` if it is not known whether this contact has an avatar or not (either for network protocol reasons, or because this TpContact has not been set up to track `TP_CONTACT_FEATURE_AVATAR_TOKEN`).

Default value: NULL

### The `"capabilities"` property

      "capabilities"             TpCapabilities*       : Read

The capabilities supported by this contact. If the underlying Connection doesn't support the ContactCapabilities interface, this property will contain the capabilities supported by the connection. Use `tp_capabilities_is_specific_to_contact()` to check if the capabilities are specific to this TpContact or not.

This may be `NULL` if this TpContact object has not been set up to track `TP_CONTACT_FEATURE_CAPABILITIES`.

Since 0.11.3

### The `"client-types"` property

      "client-types"             GStrv                 : Read

A GStrv containing the client types of this contact.

This is set to `NULL` if `TP_CONTACT_FEATURE_CLIENT_TYPES` is not set on this contact; it may also be `NULL` if that feature is prepared, but the contact's client types are unknown.

Since 0.13.1

### The `"connection"` property

      "connection"               TpConnection*         : Read

The TpConnection to which this contact belongs.

### The `"contact-groups"` property

      "contact-groups"           GStrv                 : Read

a GStrv with names of groups of which a contact is a member.

This is set to `NULL` if `TP_CONTACT_FEATURE_CONTACT_GROUPS` is not prepared on this contact, or if the connection does not implement ContactGroups interface.

Since 0.13.14

### The `"contact-info"` property

      "contact-info"             TpContactInfoList*    : Read

A GList of TpContactInfoField representing the vCard of this contact.

This is set to `NULL` if `TP_CONTACT_FEATURE_CONTACT_INFO` is not set on this contact.

Since 0.11.7

### The `"handle"` property

      "handle"                   guint                 : Read

The contact's handle in the Telepathy D-Bus API, a handle of type `TP_HANDLE_TYPE_CONTACT` representing the string given by "identifier".

This handle is referenced using the Telepathy D-Bus API and remains referenced for as long as the TpContact exists and the "connection" remains valid.

However, getting this property does not cause an additional reference to the handle to be held.

If the "connection" becomes invalid, this property is no longer meaningful and will be set to 0.

Default value: 0

### The `"identifier"` property

      "identifier"               gchar*                : Read

The contact's identifier in the instant messaging protocol (e.g. XMPP JID, SIP URI, AOL screenname or IRC nick - whatever the underlying protocol uses to identify a user).

This is never `NULL` for contact objects that are visible to library-user code.

Default value: NULL

### The `"is-blocked"` property

      "is-blocked"               gboolean              : Read

`TRUE` if the contact has been blocked.

This is set to `FALSE` if `TP_CONTACT_FEATURE_CONTACT_BLOCKING` is not prepared on this contact, or if the connection does not implement ContactBlocking interface.

Default value: FALSE

Since 0.17.0

### The `"location"` property

      "location"                 GHashTable_gchararray+GValue_*  : Read

If this contact has set a user-defined location, a string to GValue * hash table containing his location. If not, `NULL`. `tp_asv_get_string()` and similar functions can be used to access the contents.

This may be `NULL` even if the contact has set a location, if this TpContact object has not been set up to track `TP_CONTACT_FEATURE_LOCATION`.

Since 0.11.1

### The `"location-vardict"` property

      "location-vardict"         GVariant*             : Read

If this contact has set a user-defined location, a string to variant map containing his location. If not, `NULL`. `tp_vardict_get_string()` and similar functions can be used to access the contents.

This may be `NULL` even if the contact has set a location, if this TpContact object has not been set up to track `TP_CONTACT_FEATURE_LOCATION`.

This property contains the same information as "location", in a different format.

Allowed values: GVariant<a{sv}>

Default value: NULL

Since 0.19.10

### The `"presence-message"` property

      "presence-message"         gchar*                : Read

If this contact has set a user-defined status message, that message; if not, an empty string (which user interfaces may replace with a localized form of the "presence-status" or "presence-type").

This may be an empty string even if the contact has set a message, if this TpContact object has not been set up to track `TP_CONTACT_FEATURE_PRESENCE`. It is never `NULL`.

Default value: ""

### The `"presence-status"` property

      "presence-status"          gchar*                : Read

A string representing the presence status of this contact. This may be a well-known string from the Telepathy specification, like "available", or a connection-manager-specific string, like "out-to-lunch".

This may be an empty string if this TpContact object has not been set up to track `TP_CONTACT_FEATURE_PRESENCE`. It is never `NULL`.

Default value: ""

### The `"presence-type"` property

      "presence-type"            guint                 : Read

The TpConnectionPresenceType representing the type of presence status for this contact.

This is provided so even unknown values for "presence-status" can be classified into their fundamental types.

This may be `TP_CONNECTION_PRESENCE_TYPE_UNSET` if this TpContact has not been set up to track `TP_CONTACT_FEATURE_PRESENCE`.

Default value: 0

### The `"publish-request"` property

      "publish-request"          gchar*                : Read

The message that contact sent when they requested permission to see the local user's presence, if "publish-state" is `TP_SUBSCRIPTION_STATE_ASK`, an empty string ("") otherwise.

This is set to `NULL` until `TP_CONTACT_FEATURE_SUBSCRIPTION_STATES` has been prepared, and it is guaranteed to be non-`NULL` afterward.

Default value: NULL

Since 0.13.12

### The `"publish-state"` property

      "publish-state"            guint                 : Read

A TpSubscriptionState indicating the state of this contact's subscription to the local user's presence.

This is set to `TP_SUBSCRIPTION_STATE_UNKNOWN` until `TP_CONTACT_FEATURE_SUBSCRIPTION_STATES` has been prepared

Default value: 0

Since 0.13.12

### The `"subscribe-state"` property

      "subscribe-state"          guint                 : Read

A TpSubscriptionState indicating the state of the local user's subscription to this contact's presence.

This is set to `TP_SUBSCRIPTION_STATE_UNKNOWN` until `TP_CONTACT_FEATURE_SUBSCRIPTION_STATES` has been prepared

Default value: 0

Since 0.13.12

## Signal Details

### The `"contact-groups-changed"` signal

    void                user_function                      (TpContact *contact,
                                                            GStrv      added,
                                                            GStrv      removed,
                                                            gpointer   user_data)      : Run Last

Emitted when this contact's groups changes. When this signal is emitted, "contact-groups" property is already updated.

`contact` : | A TpContact
`added` : | A GStrv with added contact groups
`removed` : | A GStrv with removed contact groups
`user_data` : | user data set when the signal handler was connected.

Since 0.13.14

### The `"presence-changed"` signal

    void                user_function                      (TpContact *contact,
                                                            guint      type,
                                                            gchar     *status,
                                                            gchar     *message,
                                                            gpointer   user_data)      : Run Last

Emitted when this contact's presence changes.

`contact` : | a TpContact
`type` : | The new value of "presence-type"
`status` : | The new value of "presence-status"
`message` : | The new value of "presence-message"
`user_data` : | user data set when the signal handler was connected.

Since 0.11.7

### The `"subscription-states-changed"` signal

    void                user_function                      (TpContact *contact,
                                                            guint      subscribe,
                                                            guint      publish,
                                                            gchar     *publish_request,
                                                            gpointer   user_data)            : Run Last

Emitted when this contact's subscription states changes.

`contact` : | a TpContact
`subscribe` : | the new value of "subscribe-state"
`publish` : | the new value of "publish-state"
`publish_request` : | the new value of "publish-request"
`user_data` : | user data set when the signal handler was connected.

Since 0.13.12

## See Also

TpConnection