TpAccountManager

TpAccountManager — proxy object for the Telepathy account manager

Functions

Signals

void account-disabled Run Last
void account-enabled Run Last
void account-removed Run Last
void account-usability-changed Run Last
void most-available-presence-changed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── TpProxy
        ╰── TpAccountManager

Includes

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

Description

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

A new TpAccountManager object can be created with tp_account_manager_dup().

To list the existing valid accounts, the client should first prepare the TP_ACCOUNT_MANAGER_FEATURE_CORE feature using tp_proxy_prepare_async(), then call tp_account_manager_dup_usable_accounts().

The “account-validity-changed” signal is emitted to notify of the validity of an account changing. New accounts are also indicated by the emission of this signal on an account that did not previously exist. (The rationale behind indicating new accounts by an account validity change signal is that clients interested in this kind of thing should be connected to this signal anyway: an account having just become valid is effectively a new account to a client.)

The “account-removed” signal is emitted when existing accounts are removed.

Functions

tp_account_manager_dup ()

TpAccountManager *
tp_account_manager_dup (void);

Returns the default TpClientFactory's TpAccountManager. It will use tp_client_factory_dup(), print a warning and return NULL if it fails.

Returns

a reference on a TpAccountManager singleton.

[transfer full]

Since 0.9.0


tp_account_manager_create_account_async ()

void
tp_account_manager_create_account_async
                               (TpAccountManager *manager,
                                const gchar *connection_manager,
                                const gchar *protocol,
                                const gchar *display_name,
                                GVariant *parameters,
                                GVariant *properties,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Requests an asynchronous create of an account on the account manager manager . When the operation is finished, callback will be called. You can then call tp_account_manager_create_account_finish() to get the result of the operation.

The TpAccount returned by tp_account_manager_create_account_finish() will already have TP_ACCOUNT_FEATURE_CORE prepared, along with all features previously passed to tp_simple_client_factory_add_account_features() for the account manager's “factory”.

parameters and properties are consumed if they are floating.

It is usually better to use TpAccountRequest instead, particularly when using high-level language bindings.

Parameters

manager

a TpAccountManager

 

connection_manager

the name of a connection manager

 

protocol

the name of a protocol

 

display_name

the display name for the account

 

parameters

a G_VARIANT_TYPE_VARDICT GVariant containing the parameters for the new account

 

properties

a G_VARIANT_TYPE_VARDICT GVariant containing the properties for the new account

 

callback

a callback to call when the request is satisfied

 

user_data

data to pass to callback

 

Since 0.9.0


tp_account_manager_create_account_finish ()

TpAccount *
tp_account_manager_create_account_finish
                               (TpAccountManager *manager,
                                GAsyncResult *result,
                                GError **error);

Finishes an async create account operation, and returns a new TpAccount object. It has TP_ACCOUNT_FEATURE_CORE prepared, along with all features previously passed to tp_simple_client_factory_add_account_features() for the account manager's “factory”.

The caller must keep a ref to the returned object using g_object_ref() if it is to be kept beyond the lifetime of result .

Parameters

manager

a TpAccountManager

 

result

a GAsyncResult

 

error

a GError to be filled

 

Returns

a new TpAccount which was just created on success, otherwise NULL.

[transfer none]

Since 0.9.0


tp_account_manager_dup_usable_accounts ()

GList *
tp_account_manager_dup_usable_accounts
                               (TpAccountManager *manager);

Returns a newly allocated GList of reffed valid accounts in manager . The list must be freed with g_list_free_full() and g_object_unref() after used.

The returned TpAccounts are guaranteed to have TP_ACCOUNT_FEATURE_CORE prepared, along with all features previously passed to tp_simple_client_factory_add_account_features() for the account manager's “factory”.

The list of valid accounts returned is not guaranteed to have been retrieved until TP_ACCOUNT_MANAGER_FEATURE_CORE is prepared (tp_proxy_prepare_async() has returned). Until this feature has been prepared, an empty list (NULL) will be returned.

Parameters

manager

a TpAccountManager

 

Returns

a newly allocated GList of reffed valid accounts in manager .

[element-type TelepathyGLib.Account][transfer full]

Since 0.19.9


tp_account_manager_get_most_available_presence ()

TpConnectionPresenceType
tp_account_manager_get_most_available_presence
                               (TpAccountManager *manager,
                                gchar **status,
                                gchar **message);

Gets the most available presence over all accounts in manager . This function does not average presences across all accounts, but it merely finds the "most available" presence. As a result, there is a guarantee that there exists at least one account in manager with the returned presence.

If no accounts are enabled or usable the output will be (TP_CONNECTION_PRESENCE_TYPE_OFFLINE, "offline", "").

Since 0.17.5, if the only connected accounts does not implement TP_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE, the output will be (TP_CONNECTION_PRESENCE_TYPE_AVAILABLE, "available", "").

The return value of this function is not guaranteed to have been retrieved until tp_proxy_prepare_async() has finished; until then, the value will be the same as if no accounts are enabled or usable.

Parameters

manager

a TpAccountManager

 

status

a string to fill with the actual status.

[out][transfer full]

message

a string to fill with the actual status message.

[out][transfer full]

Returns

the most available presence across all accounts

Since 0.9.0


tp_account_manager_set_all_requested_presences ()

void
tp_account_manager_set_all_requested_presences
                               (TpAccountManager *manager,
                                TpConnectionPresenceType type,
                                const gchar *status,
                                const gchar *message);

Iterates through the accounts in manager and requests the presence (type , status and message ). Note that the presence requested here is merely a request, and if might not be satisfiable.

You can find the most available presence across all accounts by calling tp_account_manager_get_most_available_presence().

Setting a requested presence on all accounts will have no effect until tp_proxy_prepare_async() (or the older tp_account_manager_prepare_async()) has finished.

Parameters

manager

a TpAccountManager

 

type

a presence type to request

 

status

a status to request

 

message

a status message to request

 

Since 0.9.0


tp_account_manager_enable_restart ()

void
tp_account_manager_enable_restart (TpAccountManager *manager);

Enable autostarting the account manager D-Bus service. This means that the account manager will be restarted if it disappears from the bus.

Parameters

manager

a TpAccountManager

 

Types and Values

struct TpAccountManager

struct 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.

TpAccountManager is the "top level" object. Since 0.16 it always has a non-NULL “factory”, and its “factory” will be propagated to all other objects like TpAccountManager -> TpAccount -> TpConnection -> TpContact and TpChannel. This means that desired features set on that factory will be prepared on all those objects. If a “factory” is not specified when the TpAccountManager is constructed, it will use a TpAutomaticClientFactory.

Example 4. TpAccountManager example

1
FIXME: MISSING XINCLUDE CONTENT

Since 0.7.32


struct TpAccountManagerClass

struct TpAccountManagerClass {
};

The class of a TpAccount.


TP_ACCOUNT_MANAGER_FEATURE_CORE

#define             TP_ACCOUNT_MANAGER_FEATURE_CORE

Expands to a call to a function that returns a quark for the "core" feature on a TpAccountManager.

When this feature is prepared, the list of accounts have been retrieved and are available for use, and change-notification has been set up. Additionally, since 0.16 the TpAccount objects returned by tp_account_manager_dup_usable_accounts() have their features prepared as configured by the “factory”; in particular, they will all have TP_ACCOUNT_FEATURE_CORE.

One can ask for a feature to be prepared using the tp_proxy_prepare_async() function, and waiting for it to callback.

Since 0.9.0

Signal Details

The “account-disabled” signal

void
user_function (TpAccountManager *manager,
               TpAccount        *account,
               gpointer          user_data)

Emitted when an account from manager is disabled.

Parameters

manager

a TpAccountManager

 

account

a TpAccount

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since 0.9.0


The “account-enabled” signal

void
user_function (TpAccountManager *manager,
               TpAccount        *account,
               gpointer          user_data)

Emitted when an account from manager is enabled.

account is guaranteed to have TP_ACCOUNT_FEATURE_CORE prepared, along with all the features previously passed to the “factory”'s tp_client_factory_add_account_features().

Parameters

manager

a TpAccountManager

 

account

a TpAccount

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since 0.9.0


The “account-removed” signal

void
user_function (TpAccountManager *manager,
               TpAccount        *account,
               gpointer          user_data)

Emitted when an account is removed from manager .

Parameters

manager

a TpAccountManager

 

account

a TpAccount

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since 0.9.0


The “account-usability-changed” signal

void
user_function (TpAccountManager *manager,
               TpAccount        *account,
               gboolean          usable,
               gpointer          user_data)

Emitted when the usability on account changes.

This signal is also used to indicate a new account that did not previously exist has been added (with usable set to TRUE).

If usable is TRUE, account is guaranteed to have TP_ACCOUNT_FEATURE_CORE prepared, along with all the features previously passed to the “factory”'s tp_client_factory_add_account_features().

Parameters

manager

a TpAccountManager

 

account

a TpAccount

 

usable

TRUE if the account is now usable

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since 0.9.0


The “most-available-presence-changed” signal

void
user_function (TpAccountManager *manager,
               guint             presence,
               gchar            *status,
               gchar            *message,
               gpointer          user_data)

Emitted when the most available presence on manager changes.

Parameters

manager

a TpAccountManager

 

presence

new presence type

 

status

new status

 

message

new status message

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since 0.9.0

See Also

TpAccount