## TpAccountManager

TpAccountManager — proxy object for the Telepathy account manager

## Synopsis

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

                        TpAccountManager;
                        TpAccountManagerClass;
    TpAccountManager *  tp_account_manager_new              (TpDBusDaemon *bus_daemon);
    void                tp_account_manager_init_known_interfaces
                                                            (void);

    void                (*tp_cli_account_manager_callback_for_create_account)
                                                            (TpAccountManager *proxy,
                                                             const gchar *out_Account,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_account_manager_call_create_account
                                                            (TpAccountManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_Connection_Manager,
                                                             const gchar *in_Protocol,
                                                             const gchar *in_Display_Name,
                                                             GHashTable *in_Parameters,
                                                             GHashTable *in_Properties,
                                                             tp_cli_account_manager_callback_for_create_account callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_account_manager_signal_callback_account_removed)
                                                            (TpAccountManager *proxy,
                                                             const gchar *arg_Account,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxySignalConnection * tp_cli_account_manager_connect_to_account_removed
                                                            (TpAccountManager *proxy,
                                                             tp_cli_account_manager_signal_callback_account_removed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);
    void                (*tp_cli_account_manager_signal_callback_account_validity_changed)
                                                            (TpAccountManager *proxy,
                                                             const gchar *arg_Account,
                                                             gboolean arg_Valid,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxySignalConnection * tp_cli_account_manager_connect_to_account_validity_changed
                                                            (TpAccountManager *proxy,
                                                             tp_cli_account_manager_signal_callback_account_validity_changed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----TpProxy
             +----TpAccountManager

## Description

The TpAccountManager object is used to communicate with the Telepathy AccountManager service.

## Details

### TpAccountManager

    typedef struct _TpAccountManager TpAccountManager;

The Telepathy Account Manager stores real-time communication accounts and their configuration, places accounts online on request, and manipulates accounts' presence, nicknames and avatars.

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

Until suitable convenience methods are implemented, the generic `tp_cli_dbus_properties_call_get_all()` method can be used to get the D-Bus properties.

Since 0.7.32

### TpAccountManagerClass

    typedef struct {
    } TpAccountManagerClass;

The class of a TpAccount.

### tp_account_manager_new ()

    TpAccountManager *  tp_account_manager_new              (TpDBusDaemon *bus_daemon);

Convenience function to create a new account manager proxy.

`bus_daemon` : | Proxy for the D-Bus daemon
Returns : | a new reference to an account manager proxy

### tp_account_manager_init_known_interfaces ()

    void                tp_account_manager_init_known_interfaces
                                                            (void);

Ensure that the known interfaces for TpAccountManager 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_MANAGER`.

Since 0.7.32

### tp_cli_account_manager_callback_for_create_account ()

    void                (*tp_cli_account_manager_callback_for_create_account)
                                                            (TpAccountManager *proxy,
                                                             const gchar *out_Account,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

`proxy` : | the proxy on which the call was made
`out_Account` : | Used to return an 'out' argument if `error` is `NULL`: The new <tp:dbus-ref namespace="org.freedesktop.Telepathy">Account</tp:dbus-ref>.
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_account_manager_call_create_account ()

    TpProxyPendingCall * tp_cli_account_manager_call_create_account
                                                            (TpAccountManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_Connection_Manager,
                                                             const gchar *in_Protocol,
                                                             const gchar *in_Display_Name,
                                                             GHashTable *in_Parameters,
                                                             GHashTable *in_Properties,
                                                             tp_cli_account_manager_callback_for_create_account callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a CreateAccount method call.

Request the creation of a new <tp:dbus-ref namespace="org.freedesktop.Telepathy">Account</tp:dbus-ref>. The account manager SHOULD NOT allow invalid accounts to be created.

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`in_Connection_Manager` : | Used to pass an 'in' argument: The name of the connection manager, e.g. &quot;salut&quot;.
`in_Protocol` : | Used to pass an 'in' argument: The protocol, e.g. &quot;local-xmpp&quot;.

`in_Display_Name` :

Used to pass an 'in' argument: The initial value of the new account's <tp:dbus-ref namespace="org.freedesktop.Telepathy.Account">DisplayName</tp:dbus-ref> property. The account manager SHOULD modify this to make it unique if an Account already exists with the same display name, for instance by appending a number or the 'account' parameter. Account manager implementations SHOULD accept an empty string, but account editing user interfaces should avoid passing an empty string for this parameter. <tp:rationale> <p>The account creation UI may ask the user for a name for the new account. If the author of the UI chooses not to do this, the account creation UI is better able to suggest a default display name because it has protocol-specific knowledge which the account manager does not.</p> <p>The account manager always knows the complete list of accounts so it can easily tell whether it should append something to the display name to avoid presenting two identically-named accounts to the user.</p> </tp:rationale>

`in_Parameters` : | Used to pass an 'in' argument: Initial parameter values, as would be passed to <tp:dbus-ref namespace="org.freedesktop.Telepathy.ConnectionManager">RequestConnection</tp:dbus-ref>.

`in_Properties` :

Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The values of any other properties to be set immediately on the new Account.</p> <p>Only the properties mentioned in <tp:member-ref>SupportedAccountProperties</tp:member-ref> are acceptable here. In particular, the <tp:dbus-ref namespace="org.freedesktop.Telepathy.Account">DisplayName</tp:dbus-ref> and <tp:dbus-ref namespace="org.freedesktop.Telepathy.Account">Parameters</tp:dbus-ref> properties are never allowed here, since they are set using the other arguments to this method.</p> <p>Account manager implementations SHOULD support creating accounts with an empty value for this argument.</p>

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

    void                (*tp_cli_account_manager_signal_callback_account_removed)
                                                            (TpAccountManager *proxy,
                                                             const gchar *arg_Account,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal AccountRemoved.

`proxy` : | The proxy on which `tp_cli_account_manager_connect_to_account_removed()` was called
`arg_Account` : | An Account, which must not be used any more.
`user_data` : | User-supplied data
`weak_object` : | User-supplied weakly referenced object

### tp_cli_account_manager_connect_to_account_removed ()

    TpProxySignalConnection * tp_cli_account_manager_connect_to_account_removed
                                                            (TpAccountManager *proxy,
                                                             tp_cli_account_manager_signal_callback_account_removed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal AccountRemoved.

The given account has been removed. <tp:rationale> This is effectively change notification for the valid and invalid accounts lists. On emission of this signal, the Account indicated will no longer be present in either of the lists. </tp:rationale>

`proxy` : | A TpAccountManager 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_manager_signal_callback_account_validity_changed ()

    void                (*tp_cli_account_manager_signal_callback_account_validity_changed)
                                                            (TpAccountManager *proxy,
                                                             const gchar *arg_Account,
                                                             gboolean arg_Valid,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal AccountValidityChanged.

`proxy` : | The proxy on which `tp_cli_account_manager_connect_to_account_validity_changed()` was called
`arg_Account` : | An Account.
`arg_Valid` : | True if the account is now valid.
`user_data` : | User-supplied data
`weak_object` : | User-supplied weakly referenced object

### tp_cli_account_manager_connect_to_account_validity_changed ()

    TpProxySignalConnection * tp_cli_account_manager_connect_to_account_validity_changed
                                                            (TpAccountManager *proxy,
                                                             tp_cli_account_manager_signal_callback_account_validity_changed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal AccountValidityChanged.

The validity of the given account has changed. New accounts are also indicated by this signal, as an account validity change (usually to True) on an account that did not previously exist. <tp:rationale> This is effectively change notification for the valid and invalid accounts lists. </tp:rationale>

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

#TpAccount