telepathy-glib Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Signals |
#include <telepathy-glib/account-manager.h> TpAccountManager; TpAccountManagerClass; TpAccountManager * tp_account_manager_new (TpDBusDaemon *bus_daemon
); void tp_account_manager_init_known_interfaces (void
); TpAccountManager * tp_account_manager_dup (void
); void tp_account_manager_create_account_async (TpAccountManager *manager
,const gchar *connection_manager
,const gchar *protocol
,const gchar *display_name
,GHashTable *parameters
,GHashTable *properties
,GAsyncReadyCallback callback
,gpointer user_data
); TpAccount * tp_account_manager_create_account_finish (TpAccountManager *manager
,GAsyncResult *result
,GError **error
); TpAccount * tp_account_manager_ensure_account (TpAccountManager *manager
,const gchar *path
); GList * tp_account_manager_get_valid_accounts (TpAccountManager *manager
); TpConnectionPresenceType tp_account_manager_get_most_available_presence (TpAccountManager *manager
,gchar **status
,gchar **message
); void tp_account_manager_set_all_requested_presences (TpAccountManager *manager
,TpConnectionPresenceType type
,const gchar *status
,const gchar *message
); void tp_account_manager_enable_restart (TpAccountManager *manager
); #define TP_ACCOUNT_MANAGER_FEATURE_CORE gboolean tp_account_manager_is_prepared (TpAccountManager *manager
,GQuark feature
); void tp_account_manager_prepare_async (TpAccountManager *manager
,const GQuark *features
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean tp_account_manager_prepare_finish (TpAccountManager *manager
,GAsyncResult *result
,GError **error
); 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
);
"account-disabled" : Run Last "account-enabled" : Run Last "account-removed" : Run Last "account-validity-changed" : Run Last "most-available-presence-changed" : Run Last
The TpAccountManager object is used to communicate with the Telepathy AccountManager service.
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.
Since 0.7.32
TpAccountManager * tp_account_manager_new (TpDBusDaemon *bus_daemon
);
Convenience function to create a new account manager proxy. The returned TpAccountManager is not guaranteed to be ready on return.
Use tp_account_manager_dup()
instead if you want an account manager proxy
on the starter or session bus (which is almost always the right thing for
Telepathy).
|
Proxy for the D-Bus daemon |
Returns : |
a new reference to an account manager proxy |
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
TpAccountManager * tp_account_manager_dup (void
);
Returns an account manager proxy on the D-Bus daemon on which this process was activated (if it was launched by D-Bus service activation), or the session bus (otherwise).
The returned TpAccountManager is cached; the same TpAccountManager object will be returned by this function repeatedly, as long as at least one reference exists. Note that the returned TpAccountManager is not guaranteed to be ready on return.
Returns : |
an account manager proxy on the starter or session bus, or NULL
if it wasn't possible to get a dbus daemon proxy for the
appropriate bus
|
Since 0.9.0
void tp_account_manager_create_account_async (TpAccountManager *manager
,const gchar *connection_manager
,const gchar *protocol
,const gchar *display_name
,GHashTable *parameters
,GHashTable *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.
callback
will only be called when the newly created TpAccount has the
TP_ACCOUNT_FEATURE_CORE
feature ready on it, so when calling
tp_account_manager_create_account_finish()
, one can guarantee this feature
will be ready.
|
a TpAccountManager |
|
the name of a connection manager |
|
the name of a protocol |
|
the display name for the account |
|
parameters for the new account |
|
properties for the new account |
|
a callback to call when the request is satisfied |
|
data to pass to callback
|
Since 0.9.0
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, with the TP_ACCOUNT_FEATURE_CORE
feature ready on it.
|
a TpAccountManager |
|
a GAsyncResult |
|
a GError to be filled |
Returns : |
a new TpAccount which was just created on success, otherwise
NULL
|
Since 0.9.0
TpAccount * tp_account_manager_ensure_account (TpAccountManager *manager
,const gchar *path
);
Lookup an account in the account manager manager
. If the desired account
has already been ensured then the same object will be returned, otherwise
it will create a new TpAccount and add it to manager
. As a result, if
manager
thinks that the account doesn't exist, this will still add it to
manager
to avoid races. Note that the returned TpAccount is not guaranteed
to be ready on return.
The caller must keep a ref to the returned object using g_object_ref()
if
it is to be kept.
|
a TpAccountManager |
|
the object path for an account |
Returns : |
a new TpAccount at path
|
Since 0.9.0
GList * tp_account_manager_get_valid_accounts
(TpAccountManager *manager
);
Returns a newly allocated GList of valid accounts in manager
. The list
must be freed with g_list_free()
after used. None of the accounts in the
returned list are guaranteed to be ready.
Note that the TpAccounts in the returned GList are not reffed before returning from this function. One could ref every item in the list like the following example:
1 2 3 |
GList *accounts; account = tp_account_manager_get_valid_accounts (manager); g_list_foreach (accounts, (GFunc) g_object_ref, NULL); |
The list of valid accounts returned is not guaranteed to have been retrieved
until TP_ACCOUNT_MANAGER_FEATURE_CORE
is prepared
(tp_account_manager_prepare_async()
has returned). Until this feature has
been prepared, an empty list (NULL
) will be returned.
|
a TpAccountManager |
Returns : |
a newly allocated GList of valid accounts in manager
|
Since 0.9.0
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 valid the output will be
(TP_CONNECTION_PRESENCE_TYPE_OFFLINE
, "offline", "").
The return value of this function is not guaranteed to have been retrieved
until tp_account_manager_prepare_async()
has finished; until then, the
value will be the same as if no accounts are enabled or valid.
|
a TpAccountManager |
|
a string to fill with the actual status |
|
a string to fill with the actual status message |
Returns : |
the most available presence across all accounts |
Since 0.9.0
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_account_manager_prepare_async()
has finished.
|
a TpAccountManager |
|
a presence type to request |
|
a status to request |
|
a status message to request |
Since 0.9.0
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.
|
a TpAccountManager |
#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.
One can ask for a feature to be prepared using the
tp_account_manager_prepare_async()
function, and waiting for it to callback.
Since 0.9.0
gboolean tp_account_manager_is_prepared (TpAccountManager *manager
,GQuark feature
);
|
a TpAccountManager |
|
a feature which is required |
Returns : |
TRUE if feature is ready on manager , otherwise FALSE
|
Since 0.9.0
void tp_account_manager_prepare_async (TpAccountManager *manager
,const GQuark *features
,GAsyncReadyCallback callback
,gpointer user_data
);
Requests an asynchronous preparation of manager
with the features specified
by features
. When the operation is finished, callback
will be called. You
can then call tp_account_manager_prepare_finish()
to get the result of the
operation.
If features
is NULL
, then callback
will be called when the implied
TP_ACCOUNT_MANAGER_FEATURE_CORE
feature is ready.
If NULL
is given to callback
, then no callback will be called when the
operation is finished. Instead, it will simply set features
on manager
.
Note that if callback
is NULL
, then user_data
must also be NULL
.
|
a TpAccountManager |
|
a 0-terminated list of features, or NULL
|
|
a callback to call when the request is satisfied |
|
data to pass to callback
|
Since 0.9.0
gboolean tp_account_manager_prepare_finish (TpAccountManager *manager
,GAsyncResult *result
,GError **error
);
Finishes an async preparation of the account manager manager
.
|
a TpAccountManager |
|
a GAsyncResult |
|
a GError to fill |
Returns : |
TRUE if the preparation was successful, otherwise FALSE
|
Since 0.9.0
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.
|
the proxy on which the call was made |
|
Used to return an 'out' argument if error is NULL : The new <tp:dbus-ref namespace="org.freedesktop.Telepathy">Account</tp:dbus-ref>.
|
|
NULL on success, or an error on failure
|
|
user-supplied data |
|
user-supplied 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
);
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.
|
the TpProxy |
|
the timeout in milliseconds, or -1 to use the default |
|
Used to pass an 'in' argument: The name of the connection manager, e.g. "salut". |
|
Used to pass an 'in' argument: The protocol, e.g. "local-xmpp". |
|
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> |
|
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>. |
|
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> |
|
called when the method call succeeds or fails;
may be NULL to make a "fire and forget" call with no
reply tracking
|
|
user-supplied data passed to the callback;
must be NULL if callback is NULL
|
|
called with the user_data as argument, after the
call has succeeded, failed or been cancelled;
must be NULL if callback is NULL
|
|
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. |
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.
|
The proxy on which tp_cli_account_manager_connect_to_account_removed()
was called
|
|
An Account, which must not be used any more. |
|
User-supplied data |
|
User-supplied weakly referenced 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
);
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>
|
A TpAccountManager or subclass |
|
Callback to be called when the signal is received |
|
User-supplied data for the callback |
|
Destructor for the user-supplied data, which
will be called when this signal is disconnected, or
before this function returns NULL
|
|
A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected |
|
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.
|
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.
|
The proxy on which tp_cli_account_manager_connect_to_account_validity_changed()
was called
|
|
An <tp:dbus-ref namespace="org.freedesktop.Telepathy">Account</tp:dbus-ref>. |
|
True if the account is now valid. |
|
User-supplied data |
|
User-supplied weakly referenced 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
);
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>
|
A TpAccountManager or subclass |
|
Callback to be called when the signal is received |
|
User-supplied data for the callback |
|
Destructor for the user-supplied data, which
will be called when this signal is disconnected, or
before this function returns NULL
|
|
A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected |
|
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.
|
"account-disabled"
signalvoid user_function (TpAccountManager *manager, TpAccount *account, gpointer user_data) : Run Last
Emitted when an account from manager
is disabled.
|
a TpAccountManager |
|
a TpAccount |
|
user data set when the signal handler was connected. |
Since 0.9.0
"account-enabled"
signalvoid user_function (TpAccountManager *manager, TpAccount *account, gpointer user_data) : Run Last
Emitted when an account from manager
is enabled.
Note that the returned TpAccount account
is not guaranteed to have any
features pre-prepared, including TP_ACCOUNT_FEATURE_CORE
.
|
a TpAccountManager |
|
a TpAccount |
|
user data set when the signal handler was connected. |
Since 0.9.0
"account-removed"
signalvoid user_function (TpAccountManager *manager, TpAccount *account, gpointer user_data) : Run Last
Emitted when an account is removed from manager
.
|
a TpAccountManager |
|
a TpAccount |
|
user data set when the signal handler was connected. |
Since 0.9.0
"account-validity-changed"
signalvoid user_function (TpAccountManager *manager, TpAccount *account, gboolean valid, gpointer user_data) : Run Last
Emitted when the validity on account
changes. account
is not guaranteed
to be ready when this signal is emitted.
|
a TpAccountManager |
|
a TpAccount |
|
TRUE if the account is now valid
|
|
user data set when the signal handler was connected. |
Since 0.9.0
"most-available-presence-changed"
signalvoid user_function (TpAccountManager *manager, guint presence, gchar *status, gchar *message, gpointer user_data) : Run Last
Emitted when the most available presence on manager
changes.
|
a TpAccountManager |
|
new presence type |
|
new status |
|
new status message |
|
user data set when the signal handler was connected. |
Since 0.9.0