## TpAccount

TpAccount — proxy object for an account in the Telepathy account manager

## Synopsis

    #include <telepathy-glib/account.h>

                        TpAccount;
                        TpAccountClass;
    TpAccount *         tp_account_new                      (TpDBusDaemon *bus_daemon,
                                                             const gchar *object_path,
                                                             GError **error);
    void                tp_account_init_known_interfaces    (void);

    void                (*tp_cli_account_callback_for_reconnect)
                                                            (TpAccount *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_account_call_reconnect      (TpAccount *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_account_callback_for_reconnect callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_account_callback_for_remove)
                                                            (TpAccount *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_account_call_remove         (TpAccount *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_account_callback_for_remove callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_account_callback_for_update_parameters)
                                                            (TpAccount *proxy,
                                                             const gchar **out_Reconnect_Required,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_account_call_update_parameters
                                                            (TpAccount *proxy,
                                                             gint timeout_ms,
                                                             GHashTable *in_Set,
                                                             const gchar **in_Unset,
                                                             tp_cli_account_callback_for_update_parameters callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_account_signal_callback_account_property_changed)
                                                            (TpAccount *proxy,
                                                             GHashTable *arg_Properties,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxySignalConnection * tp_cli_account_connect_to_account_property_changed
                                                            (TpAccount *proxy,
                                                             tp_cli_account_signal_callback_account_property_changed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);
    void                (*tp_cli_account_signal_callback_removed)
                                                            (TpAccount *proxy,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxySignalConnection * tp_cli_account_connect_to_removed
                                                            (TpAccount *proxy,
                                                             tp_cli_account_signal_callback_removed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

    void                (*tp_cli_account_interface_avatar_signal_callback_avatar_changed)
                                                            (TpAccount *proxy,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxySignalConnection * tp_cli_account_interface_avatar_connect_to_avatar_changed
                                                            (TpAccount *proxy,
                                                             tp_cli_account_interface_avatar_signal_callback_avatar_changed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----TpProxy
             +----TpAccount

## Description

The Telepathy Account Manager stores the user's configured real-time communication accounts. The TpAccount object represents a stored account.

## Details

### TpAccount

    typedef struct _TpAccount TpAccount;

The Telepathy Account Manager stores the user's configured real-time communication accounts. This object represents a stored account.

If this account is deleted from the account manager, the "invalidated" signal will be emitted with the domain `TP_DBUS_ERRORS` and the error code `TP_DBUS_ERROR_OBJECT_REMOVED`.

This proxy is usable but very incomplete: accessors for the Account's D-Bus properties will be added in a later version of telepathy-glib, along with a mechanism similar to `tp_connection_call_when_ready()`.

Most operations performed on an Account are done via D-Bus properties. Until convenience methods for this are implemented, use of the generic `tp_cli_dbus_properties_call_get_all()` and `tp_cli_dbus_properties_call_set()` methods is recommended.

Other useful auto-generated method wrappers on an Account include `tp_cli_account_call_remove()`, `tp_cli_account_call_update_parameters()` and `tp_cli_account_call_reconnect()`.

Since 0.7.32

### TpAccountClass

    typedef struct {
    } TpAccountClass;

The class of a TpAccount.

### tp_account_new ()

    TpAccount *         tp_account_new                      (TpDBusDaemon *bus_daemon,
                                                             const gchar *object_path,
                                                             GError **error);

Convenience function to create a new account proxy.

`bus_daemon` : | Proxy for the D-Bus daemon
`object_path` : | The non-NULL object path of this account
`error` : | Used to raise an error if `object_path` is not valid
Returns : | a new reference to an account proxy, or `NULL` if `object_path` is not valid

### tp_account_init_known_interfaces ()

    void                tp_account_init_known_interfaces    (void);

Ensure that the known interfaces for TpAccount have been set up. This is done automatically when necessary, but for correct overriding of library interfaces by local extensions, you should call this function before calling `tp_proxy_or_subclass_hook_on_interface_add()` with first argument `TP_TYPE_ACCOUNT`.

Since 0.7.32

### tp_cli_account_callback_for_reconnect ()

    void                (*tp_cli_account_callback_for_reconnect)
                                                            (TpAccount *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Signature of the callback called when a Reconnect 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

### tp_cli_account_call_reconnect ()

    TpProxyPendingCall * tp_cli_account_call_reconnect      (TpAccount *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_account_callback_for_reconnect callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a Reconnect method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Re-connect this account. If the account is currently disconnected and the requested presence is offline, or if the account is not <tp:member-ref>Enabled</tp:member-ref> or not <tp:member-ref>Valid</tp:member-ref>, this does nothing.</p> <p>If the account is disconnected and the requested presence is not offline, this forces an attempt to connect with the requested presence immediately.</p> <p>If the account is connecting or connected, this is equivalent to remembering the current value of <tp:member-ref>RequestedPresence</tp:member-ref>, setting its value to (OFFLINE, &quot;offline&quot;, &quot;&quot;), waiting for the change to take effect, then setting its value to the value that was previously remembered.</p> <tp:rationale> <p>Clients desiring &quot;instant apply&quot; semantics for CM parameters MAY call this method to achieve that.</p> </tp:rationale> <p>In particular, if the account's <tp:member-ref>Connection</tp:member-ref> is in the Connecting state, calling this method causes the attempt to connect to be aborted and re-tried.</p> <tp:rationale> <p>This is necessary to ensure that the new parameters are picked up.</p> </tp:rationale>

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`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_account_callback_for_remove ()

    void                (*tp_cli_account_callback_for_remove)
                                                            (TpAccount *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Signature of the callback called when a Remove 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

### tp_cli_account_call_remove ()

    TpProxyPendingCall * tp_cli_account_call_remove         (TpAccount *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_account_callback_for_remove callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a Remove method call.

Delete the account.

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`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_account_callback_for_update_parameters ()

    void                (*tp_cli_account_callback_for_update_parameters)
                                                            (TpAccount *proxy,
                                                             const gchar **out_Reconnect_Required,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

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

`out_Reconnect_Required` :

Used to return an 'out' argument if `error` is `NULL`: A list of the names of parameters with changes that will not take effect until the account is reconnected (this may be empty, e.g. if all the parameters are D-Bus properties or parameters for which the account manager has specific support). User interfaces that require &quot;instant apply&quot; semantics MAY call <tp:member-ref>Reconnect</tp:member-ref> in response to receiving a non-empty list.

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

### tp_cli_account_call_update_parameters ()

    TpProxyPendingCall * tp_cli_account_call_update_parameters
                                                            (TpAccount *proxy,
                                                             gint timeout_ms,
                                                             GHashTable *in_Set,
                                                             const gchar **in_Unset,
                                                             tp_cli_account_callback_for_update_parameters callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a UpdateParameters method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Change the value of the <tp:member-ref>Parameters</tp:member-ref> property.</p> <p>If any of the changed parameters' <tp:type>Conn_Mgr_Param_Flags</tp:type> include <code>DBus_Property</code>, the change will be applied to the corresponding D-Bus Property on the active <tp:member-ref>Connection</tp:member-ref>, if there is one. Changes to other parameters will not take effect until the next time the account is disconnected and reconnected.</p> <tp:rationale> <p>In general, reconnecting is a destructive operation that shouldn't happen as a side-effect. In particular, migration tools that twiddle the settings of all accounts shouldn't cause an automatic disconnect and reconnect.</p> </tp:rationale>

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`in_Set` : | Used to pass an 'in' argument: A mapping from parameter names to their values. These parameters should be stored for future use.
`in_Unset` : | Used to pass an 'in' argument: A list of the names of parameters to be removed from the set of stored values, allowing the default values to be used. If the given parameters were not, in fact, stored, or even if they do not exist at all, the account manager MUST accept this without error.
`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_account_signal_callback_account_property_changed ()

    void                (*tp_cli_account_signal_callback_account_property_changed)
                                                            (TpAccount *proxy,
                                                             GHashTable *arg_Properties,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal AccountPropertyChanged.

`proxy` : | The proxy on which `tp_cli_account_connect_to_account_property_changed()` was called
`arg_Properties` : | A map from property names in this namespace (e.g. <tp:member-ref>Nickname</tp:member-ref>) to values. Properties whose values have not changed SHOULD be omitted, but this need not be done.
`user_data` : | User-supplied data
`weak_object` : | User-supplied weakly referenced object

### tp_cli_account_connect_to_account_property_changed ()

    TpProxySignalConnection * tp_cli_account_connect_to_account_property_changed
                                                            (TpAccount *proxy,
                                                             tp_cli_account_signal_callback_account_property_changed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal AccountPropertyChanged.

The values of one or more properties on this interface (that do not specify that this signal does not apply to them) may have changed. This does not cover properties of other interfaces, which must provide their own change notification if appropriate.

`proxy` : | A TpAccount 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_account_signal_callback_removed ()

    void                (*tp_cli_account_signal_callback_removed)
                                                            (TpAccount *proxy,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal Removed.

`proxy` : | The proxy on which `tp_cli_account_connect_to_removed()` was called
`user_data` : | User-supplied data
`weak_object` : | User-supplied weakly referenced object

### tp_cli_account_connect_to_removed ()

    TpProxySignalConnection * tp_cli_account_connect_to_removed
                                                            (TpAccount *proxy,
                                                             tp_cli_account_signal_callback_removed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal Removed.

This account has been removed. <tp:rationale> This is redundant with <tp:dbus-ref namespace="org.freedesktop.Telepathy.AccountManager">AccountRemoved</tp:dbus-ref>, but it's still worth having, to avoid having to bind to AccountManager.AccountRemoved to tell you whether your Account is valid — ideally, an account-editing UI should only care about a single Account. </tp:rationale>

`proxy` : | A TpAccount 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_account_interface_avatar_signal_callback_avatar_changed ()

    void                (*tp_cli_account_interface_avatar_signal_callback_avatar_changed)
                                                            (TpAccount *proxy,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal AvatarChanged.

`proxy` : | The proxy on which `tp_cli_account_interface_avatar_connect_to_avatar_changed()` was called
`user_data` : | User-supplied data
`weak_object` : | User-supplied weakly referenced object

### tp_cli_account_interface_avatar_connect_to_avatar_changed ()

    TpProxySignalConnection * tp_cli_account_interface_avatar_connect_to_avatar_changed
                                                            (TpAccount *proxy,
                                                             tp_cli_account_interface_avatar_signal_callback_avatar_changed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal AvatarChanged.

Emitted when the Avatar property changes. <tp:rationale>The avatar itself is deliberately not included in this signal, to reduce bus traffic in the (likely common) case where no running application cares about the user's own avatar.</tp:rationale>

`proxy` : | A TpAccount 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.

## See Also

#TpAccountManager