Interface Connection.Interface.SimplePresence

Interface Index (Compact) | Summary | Description | Methods | Signals | Properties | Contact Attributes | Types

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)
Objects implementing this interface must also implement:

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

(Permalink)

SetPresence (s: Status, s: Status_Message) → nothing

Parameters

  • Status — 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.

  • Status_Message — s
  • The status message associated with the current status.

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
  • Raised when there is an error reading from or writing to the network.
  • Invalid Argument
  • Either the specified status is not supported, the specified status cannot be set on the user themselves, or a non-empty message was supplied for a status that does not accept a message.
  • Not Available
  • Raised when the requested functionality is temporarily unavailable.
(Permalink)

GetPresences (au: Contacts) → a{u(uss)}: Presence

Parameters

  • Contacts — au (Contact_Handle_List)
  • An array of the contacts whose presence should be obtained.

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.

Get presence previously emitted by PresencesChanged for the given contacts. Data is returned in the same structure as the PresencesChanged signal; no additional network requests are made.

Possible Errors

  • Disconnected
  • The connection is not currently connected and cannot be used. This error may also be raised when operations are performed on a Connection for which StatusChanged has signalled status Disconnected for reason None.
    Rationale:
    The second usage corresponds to None in the Connection_Status_Reason enum; if a better reason is available, the corresponding error should be used instead.
  • Invalid Handle
  • The handle specified is unknown on this channel or connection.
  • Network Error
  • While discovering the subscribe list in order to distinguish between Unknown and Offline statuses, a network error occurred.
  • Not Available
  • Raised when the requested functionality is temporarily unavailable.

Signals

(Permalink)

PresencesChanged (a{u(uss)}: Presence)

Parameters

  • Presence — a{u(uss)} (Simple_Contact_Presences)
  • A dictionary of contact handles mapped to the status, presence type and status message.
This signal should be emitted when your own presence has been changed, or the presence of the member of any of the connection's channels has been changed.

Properties

Accessed using the org.freedesktop.DBus.Properties interface.
(Permalink)

Statuses — a{s(ubb)} (Simple_Status_Spec_Map)

Read only

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:
For instance, connection managers for local-xmpp (XEP-0174) would omit "unknown" since there is no such concept.

Contact Attributes

Attributes that a contact can have, accessed with the org.freedesktop.Telepathy.Connection.Interface.Contacts interface.
(Permalink)

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

Enum (Permalink)

Connection_Presence_Type — u

  • Unset (0)
  • An invalid presence type used as a null value. This value MUST NOT appear in the Statuses property, or in the result of GetStatuses on the deprecated Presence interface.
  • Offline (1)
  • Offline
  • Available (2)
  • Available
  • Away (3)
  • Away
  • Extended_Away (4)
  • Away for an extended time
  • Hidden (5)
  • Hidden (invisible)
  • Busy (6)
  • Added in 0.17.0.
    Busy, Do Not Disturb.
  • Unknown (7)
  • Added in 0.17.8.
    Unknown, unable to determine presence for this contact, for example if the protocol only allows presence of subscribed contacts.
  • Error (8)
  • Added in 0.17.8.
    Error, an error occurred while trying to determine presence. The message, if set, is an error from the server.
Enum (Permalink)

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)
  • 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.

  • Publish_List (1)
  • Allow contacts in the user's 'publish' list. The associated variant in Access_Control is ignored.
  • Group (2)
  • Only allow contacts that are in a certain group.

    The associated variant in Access_Control is a Group_Handle representing the permitted group.

  • Open (3)
  • Allow all contacts. The associated variant in Access_Control is ignored.
  • Subscribe_Or_Publish_List (4)
  • Allow all contacts in the user's 'subscribe' or 'publish' list. The associated variant in Access_Control is ignored.
  • Closed (5)
  • Forbid all contacts. The associated variant in Access_Control is ignored.
  • Not_Understood (6)
  • 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:
    XEP-0016 Privacy Lists can easily produce access control mechanisms that can't be expressed in a simpler API. We need to be able to at least indicate that fact.

    The associated variant in Access_Control is ignored.

Enum (Permalink)

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)
  • The associated variant is a list of contacts (signature 'au', Contact_Handle[]) who can see the extended presence information.
  • Publish_List (1)
  • All contacts in the user's 'publish' contact list can see the extended presence information. The associated variant is ignored.
  • Group (2)
  • The associated variant is a handle of type Group (signature 'u', Group_Handle) representing a group of contacts who can see the extended presence information.
  • Open (3)
  • Anyone with access to the service can see the extended presence information.
Mapping (Permalink)

Simple_Contact_Presences — a{u(uss)}

Mapping returned by GetPresences and signalled by PresencesChanged, indicating the presence of a number of contacts.
Mapping (Permalink)

Simple_Status_Spec_Map — a{s(ubb)}

A mapping describing possible statuses.
  • Identifier — s
  • The string identifier of this status.
  • Spec — (ubb) (Simple_Status_Spec)
  • Details of this status.
Struct (Permalink)

Simple_Presence — (uss)

A struct representing the presence of a contact.
  • Type — u (Connection_Presence_Type)
  • The presence type, e.g. Connection_Presence_Type_Away.
  • Status — s
  • The string identifier of the status, e.g. "brb", as defined in the Statuses property.
  • 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:
    Use case: Daf sets his status in Empathy by choosing the Welsh translation of "Available" from a menu. It is more informative for his English-speaking colleagues to see the English translation of "Available" (as localized by their own clients) than to see "Ar Gael" (which they don't understand anyway).
Struct (Permalink)

Simple_Status_Spec — (ubb)

A struct containing information about a status.
  • Type — u (Connection_Presence_Type)
  • The type of a presence. This SHOULD NOT be used as a way to set statuses that the client does not recognise (as explained in SetPresence), but MAY be used to check that the client's assumptions about a particular status name match the connection manager's.
  • May_Set_On_Self — b
  • If true, the user can set this status on themselves using SetPresence.
  • Can_Have_Message — b
  • If true, a non-empty message can be set for this status. Otherwise, the empty string is the only acceptable message.
    Rationale:
    On IRC you can be Away with a status message, but if you are available you cannot set a status message.
Struct (Permalink)

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)
  • The type of access control to apply.
  • Detail — v
  • Any additional information required by the Type. The required type and semantics are defined for each Access_Control_Type.
Struct (Permalink)

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.