TelepathyGLib.AccountManager

g GObject.Object GObject.Object TelepathyGLib.Proxy TelepathyGLib.Proxy GObject.Object->TelepathyGLib.Proxy TelepathyGLib.AccountManager TelepathyGLib.AccountManager TelepathyGLib.Proxy->TelepathyGLib.AccountManager

Subclasses:

None

Methods

Inherited:

TelepathyGLib.Proxy (11), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

can_set_default ()

class

dup ()

class

get_feature_quark_core ()

class

init_known_interfaces ()

class

new (bus_daemon)

class

new_with_factory (factory)

create_account_async (connection_manager, protocol, display_name, parameters, properties, callback, *user_data)

create_account_finish (result)

dup_valid_accounts ()

enable_restart ()

ensure_account (path)

get_most_available_presence ()

get_valid_accounts ()

set_all_requested_presences (type, status, message)

set_default ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

TelepathyGLib.Proxy (5)

Signals

Inherited:

TelepathyGLib.Proxy (2), GObject.Object (1)

Name

Short Description

account-disabled

Emitted when an account from manager is disabled.

account-enabled

Emitted when an account from manager is enabled.

account-removed

Emitted when an account is removed from manager.

account-validity-changed

Emitted when the validity on account changes.

most-available-presence-changed

Emitted when the most available presence on manager changes.

Fields

Inherited:

TelepathyGLib.Proxy (2), GObject.Object (1)

Name

Type

Access

Description

parent

TelepathyGLib.Proxy

r

Class Details

class TelepathyGLib.AccountManager(**kwargs)
Bases:

TelepathyGLib.Proxy

Abstract:

No

Structure:

TelepathyGLib.AccountManagerClass

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

TelepathyGLib.AccountManager is the “top level” object. Since 0.16 it always has a non-None TelepathyGLib.Proxy :factory, and its TelepathyGLib.Proxy :factory will be propagated to all other objects like TelepathyGLib.AccountManager -> TelepathyGLib.Account -> TelepathyGLib.Connection -> TelepathyGLib.Contact and TelepathyGLib.Channel. This means that desired features set on that factory will be prepared on all those objects. If a TelepathyGLib.Proxy :factory is not specified when the TelepathyGLib.AccountManager is constructed, it will use a TelepathyGLib.AutomaticClientFactory.

TelepathyGLib.AccountManager example

<xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include>

New in version 0.7.32.

classmethod can_set_default()
Returns:

True if TelepathyGLib.AccountManager.set_default() has already successfully been called in this process, False otherwise.

Return type:

bool

Check if TelepathyGLib.AccountManager.set_default() has already successfully been called.

New in version 0.19.6.

classmethod dup()
Returns:

an account manager proxy on the starter or session bus, or None if it wasn’t possible to get a dbus daemon proxy for the appropriate bus

Return type:

TelepathyGLib.AccountManager

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). This account manager will always have the result of TelepathyGLib.DBusDaemon.dup() as its TelepathyGLib.Proxy :dbus-daemon.

The returned TelepathyGLib.AccountManager is cached; the same TelepathyGLib.AccountManager object will be returned by this function repeatedly, as long as at least one reference exists. Note that the returned TelepathyGLib.AccountManager is not guaranteed to be ready on return.

If TelepathyGLib.AccountManager.set_default() has been called successfully, that TelepathyGLib.AccountManager will be returned. Otherwise, a new TelepathyGLib.AccountManager will be created the first time this function is called, using a new TelepathyGLib.AutomaticClientFactory as its TelepathyGLib.Proxy :factory.

New in version 0.9.0.

classmethod get_feature_quark_core()
Returns:

the quark used for representing the core feature of a TelepathyGLib.AccountManager

Return type:

int

New in version 0.9.0.

classmethod init_known_interfaces()

Ensure that the known interfaces for TelepathyGLib.AccountManager 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.

New in version 0.7.32.

classmethod new(bus_daemon)
Parameters:

bus_daemon (TelepathyGLib.DBusDaemon) – Proxy for the D-Bus daemon

Returns:

a new reference to an account manager proxy

Return type:

TelepathyGLib.AccountManager

Convenience function to create a new account manager proxy. The returned TelepathyGLib.AccountManager is not guaranteed to be prepared on return. Its TelepathyGLib.Proxy :factory will be a new TelepathyGLib.AutomaticClientFactory for bus_daemon.

Use TelepathyGLib.AccountManager.dup() instead if you want an account manager proxy on the starter or session bus (which is almost always the right thing for Telepathy).

classmethod new_with_factory(factory)
Parameters:

factory (TelepathyGLib.SimpleClientFactory) – a TelepathyGLib.SimpleClientFactory

Returns:

a new reference to an account manager proxy

Return type:

TelepathyGLib.AccountManager

Convenience function to create a new account manager proxy. The returned TelepathyGLib.AccountManager is not guaranteed to be ready on return.

Should be used only by applications having their own TelepathyGLib.SimpleClientFactory subclass. Usually this should be done at application startup and followed by a call to TelepathyGLib.AccountManager.set_default() to ensure other libraries/plugins will use this custom factory as well.

create_account_async(connection_manager, protocol, display_name, parameters, properties, callback, *user_data)
Parameters:
  • connection_manager (str) – the name of a connection manager

  • protocol (str) – the name of a protocol

  • display_name (str) – the display name for the account

  • parameters ({str: GObject.Value}) – parameters for the new account

  • properties ({str: GObject.Value}) – properties for the new account

  • callback (Gio.AsyncReadyCallback or None) – a callback to call when the request is satisfied

  • user_data (object or None) – data to pass to callback

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

The TelepathyGLib.Account returned by TelepathyGLib.AccountManager.create_account_finish() will already have %TP_ACCOUNT_FEATURE_CORE prepared, along with all features previously passed to TelepathyGLib.SimpleClientFactory.add_account_features() for the account manager’s TelepathyGLib.Proxy :factory.

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

New in version 0.9.0.

create_account_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

a new TelepathyGLib.Account which was just created on success, otherwise None

Return type:

TelepathyGLib.Account

Finishes an async create account operation, and returns a new TelepathyGLib.Account object. It has %TP_ACCOUNT_FEATURE_CORE prepared, along with all features previously passed to TelepathyGLib.SimpleClientFactory.add_account_features() for the account manager’s TelepathyGLib.Proxy :factory.

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

New in version 0.9.0.

dup_valid_accounts()
Returns:

a newly allocated GLib.List of reffed valid accounts in self

Return type:

[TelepathyGLib.Account]

Returns a newly allocated GLib.List of reffed valid accounts in self. The list must be freed with g_list_free_full() and GObject.Object.unref() after used.

The returned TelepathyGLib.Account s are guaranteed to have %TP_ACCOUNT_FEATURE_CORE prepared, along with all features previously passed to TelepathyGLib.SimpleClientFactory.add_account_features() for the account manager’s TelepathyGLib.Proxy :factory.

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

New in version 0.19.9.

enable_restart()

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

ensure_account(path)
Parameters:

path (str) – the object path for an account

Returns:

a new TelepathyGLib.Account at path, or None if path is not a valid account path.

Return type:

TelepathyGLib.Account

Lookup an account in the account manager self. If the desired account has already been ensured then the same object will be returned, otherwise it will create a new TelepathyGLib.Account and add it to self. As a result, if self thinks that the account doesn’t exist, this will still add it to self to avoid races.

The account will be constructed via this account manager’s TelepathyGLib.Proxy :factory (so it will be of an appropriate TelepathyGLib.Account subclass if the factory returns one), but does not necessarily have any features prepared yet. Use TelepathyGLib.Proxy.prepare_async() to prepare features, using the contents of TelepathyGLib.SimpleClientFactory.dup_account_features() as a parameter if you want to prepare the same features that would normally be used.

The caller must keep a ref to the returned object using GObject.Object.ref() if it is to be kept.

New in version 0.9.0.

Deprecated since version ???: New code should call TelepathyGLib.SimpleClientFactory.ensure_account() on this object’s TelepathyGLib.Proxy :factory instead, which ensures that a new reference is returned.

get_most_available_presence()
Returns:

the most available presence across all accounts

status:

a string to fill with the actual status

message:

a string to fill with the actual status message

Return type:

(TelepathyGLib.ConnectionPresenceType, status: str, message: str)

Gets the most available presence over all accounts in self. 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 self with the returned presence.

If no accounts are enabled or valid the output will be (TelepathyGLib.ConnectionPresenceType.OFFLINE, “offline”, “”).

Since 0.17.5, if the only connected accounts does not implement TelepathyGLib.IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE, the output will be (TelepathyGLib.ConnectionPresenceType.AVAILABLE, “available”, “”).

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

New in version 0.9.0.

get_valid_accounts()
Returns:

a newly allocated GLib.List of valid accounts in self

Return type:

[TelepathyGLib.Account]

Returns a newly allocated GLib.List of valid accounts in self. 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 TelepathyGLib.Account s in the returned GLib.List are not reffed before returning from this function. One could ref every item in the list like the following example:

GList *accounts;
account = tp_account_manager_get_valid_accounts (manager);
g_list_foreach (accounts, (GFunc) g_object_ref, NULL);

The returned TelepathyGLib.Account s are guaranteed to have %TP_ACCOUNT_FEATURE_CORE prepared, along with all features previously passed to TelepathyGLib.SimpleClientFactory.add_account_features() for the account manager’s TelepathyGLib.Proxy :factory.

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

New in version 0.9.0.

Deprecated since version 0.19.9: New code should use TelepathyGLib.AccountManager.dup_valid_accounts() instead.

set_all_requested_presences(type, status, message)
Parameters:

Iterates through the accounts in self 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 TelepathyGLib.AccountManager.get_most_available_presence().

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

New in version 0.9.0.

set_default()

Define the TelepathyGLib.AccountManager singleton that will be returned by TelepathyGLib.AccountManager.dup().

This function may only be called before the first call to TelepathyGLib.AccountManager.dup(), and may not be called more than once. Applications which use a custom TelepathyGLib.SimpleClientFactory and want the default TelepathyGLib.AccountManager to use that factory should call this after calling TelepathyGLib.AccountManager.new_with_factory().

Unlike TelepathyGLib.AccountManager.dup(), this function will keep an internal reference to self, so it will never be destroyed.

Note that self must use the default TelepathyGLib.DBusDaemon as returned by TelepathyGLib.DBusDaemon.dup()

New in version 0.15.5.

Signal Details

TelepathyGLib.AccountManager.signals.account_disabled(account_manager, account)
Signal Name:

account-disabled

Flags:

RUN_LAST

Parameters:

Emitted when an account from manager is disabled.

New in version 0.9.0.

TelepathyGLib.AccountManager.signals.account_enabled(account_manager, account)
Signal Name:

account-enabled

Flags:

RUN_LAST

Parameters:

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 TelepathyGLib.Proxy :factory ‘s TelepathyGLib.SimpleClientFactory.add_account_features().

New in version 0.9.0.

TelepathyGLib.AccountManager.signals.account_removed(account_manager, account)
Signal Name:

account-removed

Flags:

RUN_LAST

Parameters:

Emitted when an account is removed from manager.

New in version 0.9.0.

TelepathyGLib.AccountManager.signals.account_validity_changed(account_manager, account, valid)
Signal Name:

account-validity-changed

Flags:

RUN_LAST

Parameters:

Emitted when the validity on account changes.

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

If valid is True, account is guaranteed to have %TP_ACCOUNT_FEATURE_CORE prepared, along with all the features previously passed to the TelepathyGLib.Proxy :factory ‘s TelepathyGLib.SimpleClientFactory.add_account_features().

New in version 0.9.0.

TelepathyGLib.AccountManager.signals.most_available_presence_changed(account_manager, presence, status, message)
Signal Name:

most-available-presence-changed

Flags:

RUN_LAST

Parameters:
  • account_manager (TelepathyGLib.AccountManager) – The object which received the signal

  • presence (int) – new presence type

  • status (str) – new status

  • message (str) – new status message

Emitted when the most available presence on manager changes.

New in version 0.9.0.