Home · Modules · All Classes · All Namespaces
Public Slots | Signals | Public Member Functions | List of all members
Tp::Service::ConnectionInterfaceSimplePresenceAdaptor Class Reference

#include <TelepathyQt/_gen/svc-connection.h>

Inherits Tp::AbstractAdaptor.

Public Slots

void SetPresence (const QString &status, const QString &statusMessage, const QDBusMessage &dbusMessage)
 
Tp::SimpleContactPresences GetPresences (const Tp::UIntList &contacts, const QDBusMessage &dbusMessage)
 

Signals

void PresencesChanged (const Tp::SimpleContactPresences &presence)
 

Public Member Functions

Tp::SimpleStatusSpecMap Statuses () const
 
uint MaximumStatusMessageLength () const
 
- Public Member Functions inherited from Tp::AbstractAdaptor
 AbstractAdaptor (const QDBusConnection &connection, QObject *adaptee, QObject *parent)
 
 ~AbstractAdaptor ()
 
QDBusConnection dbusConnection () const
 
QObject * adaptee () const
 

Detailed Description

Adaptor class providing a 1:1 mapping of the D-Bus interface "org.freedesktop.Telepathy.Connection.Interface.SimplePresence".

Member Function Documentation

◆ Statuses()

Tp::SimpleStatusSpecMap Tp::Service::ConnectionInterfaceSimplePresenceAdaptor::Statuses ( ) const

Return the value of the exported D-Bus object property Statuses of type Tp::SimpleStatusSpecMap.

Adaptees should export this property as a Qt property named 'statuses' with type Tp::SimpleStatusSpecMap.

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.

For instance, connection managers for local-xmpp (XEP-0174) would omit "unknown" since there is no such concept.

Returns
The value of exported property Statuses.

◆ MaximumStatusMessageLength()

uint Tp::Service::ConnectionInterfaceSimplePresenceAdaptor::MaximumStatusMessageLength ( ) const

Return the value of the exported D-Bus object property MaximumStatusMessageLength of type uint.

Adaptees should export this property as a Qt property named 'maximumStatusMessageLength' with type uint.

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.

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.

Returns
The value of exported property MaximumStatusMessageLength.

◆ SetPresence

void Tp::Service::ConnectionInterfaceSimplePresenceAdaptor::SetPresence ( const QString &  status,
const QString &  statusMessage,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method SetPresence on this object.

Adaptees should export this method as a Qt slot with the following signature: void setPresence(const QString& status, const QString& statusMessage, const Tp::Service::ConnectionInterfaceSimplePresenceAdaptor::SetPresenceContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

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.

Parameters
status

The string identifier of the desired status. Possible status identifiers are defined in the \\\ \\link requestPropertyStatuses() Statuses \\endlink \\htmlonly 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.

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 <tp:type>Connection_Presence_Type</tp:type> is Offline, Error or Unknown MUST NOT be passed to this function. Connection managers SHOULD reject these statuses.

To go offline, call \\endhtmlonly ConnectionInterface::Disconnect() \\htmlonly instead. The "error" and "unknown" statuses make no sense.
Parameters
statusMessage
The status message associated with the current status.

◆ GetPresences

Tp::SimpleContactPresences Tp::Service::ConnectionInterfaceSimplePresenceAdaptor::GetPresences ( const Tp::UIntList contacts,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method GetPresences on this object.

Adaptees should export this method as a Qt slot with the following signature: void getPresences(const Tp::UIntList& contacts, const Tp::Service::ConnectionInterfaceSimplePresenceAdaptor::GetPresencesContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

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.

Parameters
contacts
An array of the contacts whose presence should be obtained.
Returns

Presence information in the same format as for the \\\ PresencesChanged() \\htmlonly 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.

◆ PresencesChanged

void Tp::Service::ConnectionInterfaceSimplePresenceAdaptor::PresencesChanged ( const Tp::SimpleContactPresences presence)
signal

Represents the exported D-Bus signal PresencesChanged on this object.

Adaptees should export this signal as a Qt signal with the following signature: void presencesChanged(const Tp::SimpleContactPresences& presence);

The adaptee signal will be automatically relayed as a D-Bus signal once emitted.

Parameters
presence
A dictionary of contact handles mapped to the status, presence type 
and status message.