Managing Presence

The Account Manager is responsible for managing the user's presence for each configured Account. The presence requested for an account also controls whether that account is connected or disconnected in Mission Control.

The presence you desire for each Account should be set as that account's RequestedPresence property. The Account Manager will then attempt to set that presence on the account, connecting or disconnecting the account as required. The CurrentPresence property can be read to find out what the current presence of an account is.

All presence properties in the Account Manager are of type SimplePresence (see Section 5.3.1 ― The SimplePresence Tuple).

Who Is Responsible For Setting Presence?

Application authors should be aware that lots of applications may be connected to the Telepathy service and may be interested in displaying or editing the user's presence; that some applications may allow more fine-grained control than others.

The Telepathy specification does not delegate the task of setting the presence to any one client, or type of client. Applications should take care not to trample over the configured presence unneccesarily. Applications should not change the value of RequestedPresence (especially when starting up) unless it is because of a change by the user.

Rather than requesting a default presence to bring themselves online, applications can ensure that they're brought online by requesting their channels from the Channel Dispatcher (for example, ensuring the ContactList channels).

Telepathy allows for a separate presence per-Account (e.g. your work account might be Available/"In the Office" and your personal account might be Busy/"Working"). If a user interface cannot display or edit presence with this level of detail, it should provide some visual indication of this (i.e. similar to the way a checkbox might indicate an inconsistent state).

3.2.1. Going Online

When using an Account Manager with Telepathy, clients are no longer responsible for establishing their own connections, and indeed will vary rarely make use of the ConnectionManager interface. Connections are instead established through the Account Manager.

The Account Manager will attempt to connect any account that meets three requirements: the account must be valid, the account must be enabled, and the requested presence must be something other than Offline.

There are also three ways in which the requested presence may be set: directly by an application, on demand by the Channel Dispatcher or automatically by the Account Manager.

3.2.1.1. On Request

The Account Manager will attempt to connect any enabled account that has a RequestedPresence other than Connection_Presence_Type_Offline.

Bringing an Account online in the Account Manager simply requires setting the presence via RequestedPresence to a presence that requires being online (see Table 3-2).

For example, to make an account be connected, you might set the presence (Connection_Presence_Type_Available, "available", "Working Hard"). You can watch the properties Connection, ConnectionStatus, ConnectionStatusReason and CurrentPresence to monitor the state of the new connection via the signal AccountPropertyChanged.

Table 3-2Status Types (Connection_Presence_Type)
Online Statuses Offline Statuses
Available Offline
Away
Extended_Away
Hidden
Busy

To disconnect an account for any reason, simply set its status to Offline with the presence (Connection_Presence_Type_Offline, "offline", "").

3.2.1.2. On Demand

Enabled accounts can be brought online automatically at the request of the Channel Dispatcher to service a new channel request.

The Account Manager brings the account online by setting the current value for AutomaticPresence as the RequestedPresence.

AutomaticPresence

The AutomaticPresence property can be set on an account to any type of user-requestable online presence (i.e. not Connection_Presence_Type_Offline).

It is expected that this property will usually be set to Available, but some other common mode, like Busy, is also acceptable. Like RequestedPresence, clients should only update this property in response to a request from the user.

3.2.1.3. Automatically

Enabled accounts with the ConnectAutomatically property set are brought online automatically by the Account Manager without any action required on the part of the user or other software whenever the Account Manager deems it possible to do so.

The Account Manager brings the account online by setting the current value for AutomaticPresence as the RequestedPresence.

Connect When Possible

The ConnectAutomatically property leaves responsibility of determining when it is possible to establish a connection up to the specific implementation of the Account Manager.

For example, an Account Manager that communicates with a hardware information service, such as NetworkManager may only attempt to establish connections when it knows the network is available. A specific Account Manager implementation may choose only to establish connections automatically on a specific type of network (e.g. one that is uncharged).