Interface Connection.Interface.Presence1

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

Methods

SetPresence (s: Status, s: Status_Message) nothing

Signals

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

Properties

Statuses a{s(ubb)} (Status_Spec_Map) Read only
MaximumStatusMessageLength u Read only

Contact Attributes

im.telepathy.v1.Connection.Interface.Presence1/presence (uss) (Presence)

Types

Connection_Presence_Type Enum u
Access_Control_Type Enum u
Contact_Presence_Map Mapping a{u(uss)}
Status_Spec_Map Mapping a{s(ubb)}
Presence Struct (uss)
Status_Spec Struct (ubb)
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 Remarks
"available" Available
"chat" Available Actively interested in chatting, as opposed to merely available.
"pstn" Available This contact is actually a phone number, not an IM account. As such, the contact is conceptually always available, but not in the same way that a contact can set their IM status to “available”. It does not make sense to allow the user to set this status on herself; hence, on protocols where this status is supported, its entry in Statuses SHOULD have May_Set_On_Self set to False.
"away" Away
"brb" Away Be Right Back (a more specific form of Away)
"busy" Busy
"dnd" Busy Do Not Disturb (a more specific form of Busy)
"xa" Extended_Away Extended Away
"hidden" Hidden Also known as "Invisible" or "Appear Offline"
"offline" Offline
"unknown" Unknown special, see below
"error" 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.

Signals

(Permalink)

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

Parameters

  • Presence — a{u(uss)} (Contact_Presence_Map)
  • 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)} (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.
(Permalink)

MaximumStatusMessageLength — u

Read only
Added in 0.22.2.

The maximum length in characters for any individual status message, or 0 if there is no limit.

While the connection is in the DISCONNECTED state, this property will be 0. The connection manager will attempt to set the appropriate value when the connection becomes connected, but cannot necessarily guarantee it. The maximum length 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 maximum length in characters for any individual status message which is actually allowed on this protocol. This value 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).

If a message passed to SetPresence is longer than allowed by this property, the connection manager MUST truncate the supplied message; when emitting PresencesChanged, the truncated version of the message MUST be used.

Rationale:

Some XMPP servers, like Google Talk, define a maximum length for status messages. Whether the user's server is one of these cannot be detected until quite late in the connection process.

Contact Attributes

Attributes that a contact can have, accessed with the im.telepathy.v1.Connection.Interface.Contacts interface.
(Permalink)

im.telepathy.v1.Connection.Interface.Presence1/presence — (uss) (Presence)

The contact's presence.

The presence is likely to be (Unknown, "unknown", "") unless subscribe contact attribute is Yes, or the local user can temporarily see their presence for some other reason (for instance, on XMPP, contacts seen in chatrooms will temporarily have available presence).

Always present with some value if information if the Presence 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.
  • 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 CommunicationPolicy1 and in rich presence interfaces such as Location1.

  • 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 whose publish state is Yes, i.e. those who can normally see the local user's presence. The associated variant in Access_Control is ignored.
  • Group (2)
  • Only allow contacts that are in a certain user-defined group, as configured by the ContactGroups1 interface.

    The associated variant in Access_Control is a string (D-Bus type 's'), the name of a contact group.

  • Open (3)
  • Allow all contacts. The associated variant in Access_Control is ignored.
  • Subscribe_Or_Publish_List (4)
  • Allow contacts whose subscribe and/or publish state is Yes, i.e. those whose presence can normally be seen by the local user, and those who can normally see the local user's presence. 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.

Mapping (Permalink)

Contact_Presence_Map — a{u(uss)}

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

Status_Spec_Map — a{s(ubb)}

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

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)

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 Presence interface, but it's included here so it can be referenced by rich presence interfaces.

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