Methods
SetPresence | (s: Status, s: Status_Message) | → | nothing | |
GetPresences | (au: Contacts) | → | a{u(uss)}: Presence |
Signals
PresencesChanged | (a{u(uss)}: Presence) |
Properties
Statuses | a{s(ubb)} (Simple_Status_Spec_Map) | Read only |
Contact Attributes
org.freedesktop.Telepathy.Connection.Interface.SimplePresence/presence | (uss) (Simple_Presence) |
Types
Connection_Presence_Type | Enum | u | |
Access_Control_Type | Enum | u | |
Rich_Presence_Access_Control_Type | Enum | u | |
Simple_Contact_Presences | Mapping | a{u(uss)} | |
Simple_Status_Spec_Map | Mapping | a{s(ubb)} | |
Simple_Presence | Struct | (uss) | |
Simple_Status_Spec | Struct | (ubb) | |
Access_Control | Struct | (uv) | |
Rich_Presence_Access_Control | Struct | (uv) |
Description
This interface is for services which have a concept of presence which can be published for yourself and monitored on your contacts.
Presence on an individual (yourself or one of your contacts) is modelled as a status and a status message. Valid statuses are defined per connection, and a list of those that can be set on youself can be obtained from the Statuses property.
Each status has an arbitrary string identifier which should have an agreed meaning between the connection manager and any client which is expected to make use of it. The following well-known values should be used where possible to allow clients to identify common choices:
status identifier | Connection_Presence_Type | comments |
---|---|---|
available | Connection_Presence_Type_Available | |
away | Connection_Presence_Type_Away | |
brb | Connection_Presence_Type_Away | Be Right Back (a more specific form of Away) |
busy | Connection_Presence_Type_Busy | |
dnd | Connection_Presence_Type_Busy | Do Not Disturb (a more specific form of Busy) |
xa | Connection_Presence_Type_Extended_Away | Extended Away |
hidden | Connection_Presence_Type_Hidden | Also known as "Invisible" or "Appear Offline" |
offline | Connection_Presence_Type_Offline | |
unknown | Connection_Presence_Type_Unknown | special, see below |
error | Connection_Presence_Type_Error | special, see below |
As well as these well-known status identifiers, every status also has a numerical type value chosen from Connection_Presence_Type which can be used by the client to classify even unknown statuses into different fundamental types.
These numerical types exist so that even if a client does not understand the string identifier being used, and hence cannot present the presence to the user to set on themselves, it may display an approximation of the presence if it is set on a contact.
As well as the normal status identifiers, there are two special ones that may be present: 'unknown' with type Unknown and 'error' with type Error. 'unknown' indicates that it is impossible to determine the presence of a contact at this time, for example because it's not on the 'subscribe' list and the protocol only allows one to determine the presence of contacts you're subscribed to. 'error' indicates that there was a failure in determining the status of a contact.
If the connection has a 'subscribe' contact list, PresencesChanged signals should be emitted to indicate changes of contacts on this list, and should also be emitted for changes in your own presence. Depending on the protocol, the signal may also be emitted for others such as people with whom you are communicating, and any user interface should be updated accordingly.
Methods
SetPresence (s: Status, s: Status_Message) → nothing
Parameters
- Status — s
- Status_Message — s
The string identifier of the desired status. Possible status identifiers are defined in the Statuses property.
Clients MUST NOT set a status whose string value they do not recognise, even if its presence type in Statuses matches what the user requested.
Rationale:
Suppose a protocol has statuses that include 'phone' (of type BUSY) and 'in-a-meeting' (of type BUSY), but there is no generic 'busy' status.
If the user requests "Busy" status from a menu, a client author might be tempted to pick an arbitrary status that has type BUSY. However, on this protocol, neither of the choices would be appropriate, and incorrect information about the user would be conveyed.
Statuses whose Connection_Presence_Type is Offline, Error or Unknown MUST NOT be passed to this function. Connection managers SHOULD reject these statuses.
Rationale:
To go offline, call Disconnect instead. The "error" and "unknown" statuses make no sense.
Request that the presence status and status message are published for the connection. Changes will be indicated by PresencesChanged signals being emitted.
This method may be called on a newly-created connection while it is still in the DISCONNECTED state, to request that when the connection connects, it will do so with the selected status.
In DISCONNECTED state the Statuses property will indicate which statuses are allowed to be set while DISCONNECTED (none, if the Connection Manager doesn't allow this). This value MUST NOT be cached, as the set of allowed presences might change upon connecting.
Possible Errors
- Network Error
- Invalid Argument
- Not Available
GetPresences (au: Contacts) → a{u(uss)}: Presence
Parameters
- Contacts — au (Contact_Handle_List)
Returns
- Presence — a{u(uss)} (Simple_Contact_Presences)
Presence information in the same format as for the PresencesChanged signal. The returned mapping MUST include an entry for each contact in the method's argument.
The definition of the connection presence types Unknown and Offline means that if a connection manager will return Unknown for contacts not on the subscribe list, it MUST delay the reply to this method call until it has found out which contacts are, in fact, on the subscribe list.
Possible Errors
- Disconnected
- Invalid Handle
- Network Error
- Not Available
Rationale:
Signals
PresencesChanged (a{u(uss)}: Presence)
Parameters
- Presence — a{u(uss)} (Simple_Contact_Presences)
Properties
Statuses — a{s(ubb)} (Simple_Status_Spec_Map)
A dictionary where the keys are the presence statuses that are available on this connection, and the values are the corresponding presence types.
While the connection is in the DISCONNECTED state, it contains the set of presence statuses allowed to be set before connecting. The connection manager will attempt to set the appropriate status when the connection becomes connected, but cannot necessarily guarantee it. The available statuses cannot change until the connection status changes, so there is no change notification.
While the connection is in the CONNECTED state, this property contains the set of presence statuses which are actually available on this protocol. This set is constant for the remaining lifetime of the connection, so again, there is no change notification.
While the connection is in the CONNECTING state, the value of this property is undefined and SHOULD NOT be used. It can change at any time without notification (in particular, any cached values from when the connection was in the DISCONNECTED or CONNECTING state MUST NOT be assumed to still be correct when the state has become CONNECTED).
This property MUST include the special statuses "unknown" and "error" if and only if the connection manager can emit them as a contact's status.
Rationale:
Contact Attributes
org.freedesktop.Telepathy.Connection.Interface.SimplePresence/presence — (uss) (Simple_Presence)
The same struct that would be returned by GetPresences (always present with some value if information from the SimplePresence interface was requested)
Types
Connection_Presence_Type — u
- Unset (0)
- Offline (1)
- Available (2)
- Away (3)
- Extended_Away (4)
- Hidden (5)
- Busy (6)
- Unknown (7)
- Error (8)
Access_Control_Type — u
A type for communication access control. These control policies are used in CommunicationPolicy.DRAFT as well as most rich presence interfaces.
New interfaces should use this type, and NOT Rich_Presence_Access_Control_Type.
- Whitelist (0)
- Publish_List (1)
- Group (2)
- Open (3)
- Subscribe_Or_Publish_List (4)
- Closed (5)
- Not_Understood (6)
Only allow contacts that are in a certain whitelist.
The associated variant
in Access_Control is a list of
Contact_Handle representing
the whitelist, with signature au
.
Only allow contacts that are in a certain group.
The associated variant in Access_Control is a Group_Handle representing the permitted group.
The access control rule is too complex to be represented in the current Telepathy API. The associated variant is meaningless. Setting this mode is never valid; the connection manager MUST raise an error if this is attempted.
Rationale:
The associated variant in Access_Control is ignored.
Rich_Presence_Access_Control_Type — u
A type of access control for Rich_Presence_Access_Control. For most types, the exact access control is given by an associated variant.
Rationale:
These are the access control types from XMPP publish/subscribe (XEP-0060).
Location uses this for historical reasons, new interfaces will use Access_Control_Type.
- Whitelist (0)
- Publish_List (1)
- Group (2)
- Open (3)
Simple_Contact_Presences — a{u(uss)}
- Contact — u (Contact_Handle)
- Presence — (uss) (Simple_Presence)
Simple_Status_Spec_Map — a{s(ubb)}
- Identifier — s
- Spec — (ubb) (Simple_Status_Spec)
Simple_Presence — (uss)
- Type — u (Connection_Presence_Type)
- Status — s
- Status_Message — s
The user-defined status message, e.g. "Back soon!".
Clients SHOULD set the status message for the local user to the empty string, unless the user has actually provided a specific message (i.e. one that conveys more information than the Status).
User interfaces SHOULD regard an empty status message as unset, and MAY replace it with a localized string corresponding to the Status or Type.
Rationale:
Simple_Status_Spec — (ubb)
- Type — u (Connection_Presence_Type)
- May_Set_On_Self — b
- Can_Have_Message — b
Rationale:
Access_Control — (uv)
An access control mode for extended presence items like geolocation. This type isn't actually used by the SimplePresence interface, but it's included here so it can be referenced by rich presence interfaces.
New interfaces should use this type, and NOT Rich_Presence_Access_Control.
- Type — u (Access_Control_Type)
- Detail — v
Rich_Presence_Access_Control — (uv)
An access control mode for extended presence items like geolocation. This type isn't actually used by the SimplePresence interface, but it's included here so it can be referenced by rich presence interfaces such as Location.
Location uses this for historical reasons, new interfaces will use Access_Control_Type.
- Type — u (Rich_Presence_Access_Control_Type)
- Detail — v