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

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

Inherits Tp::AbstractAdaptor.

Public Slots

void Connect (const QDBusMessage &dbusMessage)
 
void Disconnect (const QDBusMessage &dbusMessage)
 
QStringList GetInterfaces (const QDBusMessage &dbusMessage)
 
QString GetProtocol (const QDBusMessage &dbusMessage)
 
uint GetSelfHandle (const QDBusMessage &dbusMessage)
 
uint GetStatus (const QDBusMessage &dbusMessage)
 
void HoldHandles (uint handleType, const Tp::UIntList &handles, const QDBusMessage &dbusMessage)
 
QStringList InspectHandles (uint handleType, const Tp::UIntList &handles, const QDBusMessage &dbusMessage)
 
Tp::ChannelInfoList ListChannels (const QDBusMessage &dbusMessage)
 
void ReleaseHandles (uint handleType, const Tp::UIntList &handles, const QDBusMessage &dbusMessage)
 
QDBusObjectPath RequestChannel (const QString &type, uint handleType, uint handle, bool suppressHandler, const QDBusMessage &dbusMessage)
 
Tp::UIntList RequestHandles (uint handleType, const QStringList &identifiers, const QDBusMessage &dbusMessage)
 
void AddClientInterest (const QStringList &tokens, const QDBusMessage &dbusMessage)
 
void RemoveClientInterest (const QStringList &tokens, const QDBusMessage &dbusMessage)
 

Signals

void SelfHandleChanged (uint selfHandle)
 
void SelfContactChanged (uint selfHandle, const QString &selfID)
 
void NewChannel (const QDBusObjectPath &objectPath, const QString &channelType, uint handleType, uint handle, bool suppressHandler)
 
void ConnectionError (const QString &error, const QVariantMap &details)
 
void StatusChanged (uint status, uint reason)
 

Public Member Functions

QStringList Interfaces () const
 
uint SelfHandle () const
 
QString SelfID () const
 
uint Status () const
 
bool HasImmortalHandles () 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".

Member Function Documentation

◆ Interfaces()

QStringList Tp::Service::ConnectionAdaptor::Interfaces ( ) const

Return the value of the exported D-Bus object property Interfaces of type QStringList.

Adaptees should export this property as a Qt property named 'interfaces' with type QStringList.

The set of optional interfaces supported by this connection. Before the connection status changes to CONNECTED, this property may change at any time, but it is guaranteed that interfaces will only be added, not removed. After the connection status changes to CONNECTED, this property cannot change further.

There is no explicit change notification; reasonable behaviour for a client would be to retrieve the interfaces list once initially, and once more when it becomes CONNECTED.

In some connection managers, certain capabilities of a connection are known to be implemented for all connections (e.g. support for SimplePresence), and some interfaces (like SimplePresence) can even be used before connecting. Other capabilities may or may not exist, depending on server functionality; by the time the connection goes CONNECTED, the connection manager is expected to have evaluated the server's functionality and enabled any extra interfaces for the remainder of the Connection's lifetime.

Returns
The value of exported property Interfaces.

◆ SelfHandle()

uint Tp::Service::ConnectionAdaptor::SelfHandle ( ) const

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

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

The handle which represents the user on this connection, which will remain valid for the lifetime of this connection, or until a change in the user's identifier is signalled by the SelfContactChanged signal. If the connection is not yet in the CONNECTED state, the value of this property MAY be zero.

Returns
The value of exported property SelfHandle.

◆ SelfID()

QString Tp::Service::ConnectionAdaptor::SelfID ( ) const

Return the value of the exported D-Bus object property SelfID of type QString.

Adaptees should export this property as a Qt property named 'selfID' with type QString.

The identifier which represents the user on this connection, which will remain valid for the lifetime of this connection, or until a change in the user's identifier is signalled by the SelfContactChanged signal. If the connection is not yet in the CONNECTED state, the value of this property MAY be empty string.

Returns
The value of exported property SelfID.

◆ Status()

uint Tp::Service::ConnectionAdaptor::Status ( ) const

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

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

The current status of the connection. Change notification is via the StatusChanged() signal.

If retrieval of property succeeds and yields the value Disconnected, this indicates that the connection has not yet been established. If connection has been attempted and failed, the Connection object SHOULD be removed from the bus entirely, meaning that retrieval of this property SHOULD fail.

Returns
The value of exported property Status.

◆ HasImmortalHandles()

bool Tp::Service::ConnectionAdaptor::HasImmortalHandles ( ) const

Return the value of the exported D-Bus object property HasImmortalHandles of type bool.

Adaptees should export this property as a Qt property named 'hasImmortalHandles' with type bool.

True if handles last for the whole lifetime of the Connection. This SHOULD be the case in all connection managers, but clients MUST interoperate with older connection managers (which reference-count handles).

Returns
The value of exported property HasImmortalHandles.

◆ Connect

void Tp::Service::ConnectionAdaptor::Connect ( const QDBusMessage &  dbusMessage)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void connect(const Tp::Service::ConnectionAdaptor::ConnectContextPtr &context);

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

Request that the connection be established. This will be done asynchronously and errors will be returned by emitting StatusChanged() signals.

Calling this method on a Connection that is already connecting or connected is allowed, and has no effect.

◆ Disconnect

void Tp::Service::ConnectionAdaptor::Disconnect ( const QDBusMessage &  dbusMessage)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void disconnect(const Tp::Service::ConnectionAdaptor::DisconnectContextPtr &context);

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

Request that the connection be closed. This closes the connection if it's not already in DISCONNECTED state, and destroys the connection object.

◆ GetInterfaces

QStringList Tp::Service::ConnectionAdaptor::GetInterfaces ( const QDBusMessage &  dbusMessage)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void getInterfaces(const Tp::Service::ConnectionAdaptor::GetInterfacesContextPtr &context);

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

Returns the set of optional interfaces supported by this connection. See Interfaces for more details.

Returns
The value of the Interfaces property

◆ GetProtocol

QString Tp::Service::ConnectionAdaptor::GetProtocol ( const QDBusMessage &  dbusMessage)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void getProtocol(const Tp::Service::ConnectionAdaptor::GetProtocolContextPtr &context);

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

Get the protocol this connection is using.

Returns
A string identifier for the protocol

◆ GetSelfHandle

uint Tp::Service::ConnectionAdaptor::GetSelfHandle ( const QDBusMessage &  dbusMessage)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void getSelfHandle(const Tp::Service::ConnectionAdaptor::GetSelfHandleContextPtr &context);

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

Returns the value of the SelfHandle property. Change notification is via the SelfHandleChanged signal.

Returns
The value of the SelfHandle property

◆ GetStatus

uint Tp::Service::ConnectionAdaptor::GetStatus ( const QDBusMessage &  dbusMessage)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void getStatus(const Tp::Service::ConnectionAdaptor::GetStatusContextPtr &context);

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

Get the current status as defined in the StatusChanged signal.

Returns
The value of the Status property

◆ HoldHandles

void Tp::Service::ConnectionAdaptor::HoldHandles ( uint  handleType,
const Tp::UIntList handles,
const QDBusMessage &  dbusMessage 
)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void holdHandles(uint handleType, const Tp::UIntList& handles, const Tp::Service::ConnectionAdaptor::HoldHandlesContextPtr &context);

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

If HasImmortalHandles is true, which SHOULD always be the case in this version of telepathy-spec, this method does nothing and returns successfully, unless the given handle type or any of the given handles is invalid.

In older connection managers, this method notifies the connection manger that your client is holding a copy of handles which may not be in use in any existing channel or list, and were not obtained by using the RequestHandles() method. For example, a handle observed in an emitted signal, or displayed somewhere in the UI that is not associated with a channel. The connection manager must not deallocate a handle where any clients have used this method to indicate it is in use until the ReleaseHandles() method is called, or the clients disappear from the bus.

Note that HoldHandles is idempotent - calling it multiple times is equivalent to calling it once. If a handle is "referenced" by several components which share a D-Bus unique name, the client should perform reference counting internally, and only call ReleaseHandles when none of the cooperating components need the handle any longer.

Parameters
handleType
The type of handle to be held
handles
A array of integer handles to hold

◆ InspectHandles

QStringList Tp::Service::ConnectionAdaptor::InspectHandles ( uint  handleType,
const Tp::UIntList handles,
const QDBusMessage &  dbusMessage 
)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void inspectHandles(uint handleType, const Tp::UIntList& handles, const Tp::Service::ConnectionAdaptor::InspectHandlesContextPtr &context);

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

Return a string representation for a number of handles of a given type.

Parameters
handleType
The type of handle to be inspected
handles
An array of integer handles of this type
Returns
An array of identifiers corresponding to the given handles, in the 
same order.

◆ ListChannels

Tp::ChannelInfoList Tp::Service::ConnectionAdaptor::ListChannels ( const QDBusMessage &  dbusMessage)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void listChannels(const Tp::Service::ConnectionAdaptor::ListChannelsContextPtr &context);

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

List all the channels which currently exist on this connection.

Returns
An array of structs representing channels.

◆ ReleaseHandles

void Tp::Service::ConnectionAdaptor::ReleaseHandles ( uint  handleType,
const Tp::UIntList handles,
const QDBusMessage &  dbusMessage 
)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void releaseHandles(uint handleType, const Tp::UIntList& handles, const Tp::Service::ConnectionAdaptor::ReleaseHandlesContextPtr &context);

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

If HasImmortalHandles is true, which SHOULD always be the case in this version of telepathy-spec, this method does nothing and returns successfully, unless the given handle type or any of the given handles is invalid. In older connection managers, this method explicitly notifies the connection manager that your client is no longer holding any references to the given handles, and that they may be deallocated if they are not held by any other clients or referenced by any existing channels. See HoldHandles for notes.

Parameters
handleType
An integer handle type (as defined in RequestHandle)
handles
An array of integer handles being held by the client

◆ RequestChannel

QDBusObjectPath Tp::Service::ConnectionAdaptor::RequestChannel ( const QString &  type,
uint  handleType,
uint  handle,
bool  suppressHandler,
const QDBusMessage &  dbusMessage 
)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void requestChannel(const QString& type, uint handleType, uint handle, bool suppressHandler, const Tp::Service::ConnectionAdaptor::RequestChannelContextPtr &context);

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

Request a channel satisfying the specified type and communicating with the contact, room, list etc. indicated by the given handle_type and handle. The handle_type and handle may both be zero to request the creation of a new, empty channel, which may or may not be possible, depending on the protocol and channel type.

On success, the returned channel will always be of the requested type (i.e. implement the requested channel-type interface).

If a new, empty channel is requested, on success the returned channel will always be an "anonymous" channel for which the type and handle are both zero.

If a channel to a contact, room etc. is requested, on success, the returned channel may either be a new or existing channel to the requested entity (i.e. its ChannelInterface::TargetHandleType and ChannelInterface::TargetHandle properties are the requested handle type and handle), or a newly created "anonymous" channel associated with the requested handle in some implementation-specific way.

For example, for a contact handle, the returned channel might be "anonymous", but implement the groups interface and have the requested contact already present among the members.

If the request cannot be satisfied, an error is raised and no channel is created.

Parameters
type
A D-Bus interface name representing base channel type
handleType
An integer representing the handle type, or Handle_Type_None if no 
handle is specified
handle
A nonzero integer handle representing a contact, room, list etc. 
according to handle_type, or zero if the handle_type is 
Handle_Type_None
suppressHandler
Clients SHOULD always set this to true. The historical meaning was 
that clients that did not intend to take responsibility for 
displaying the channel to the user could set this to FALSE, in 
which case the channel dispatcher would launch an appropriate 
channel handler. However, clients whose functionality relies on 
having a working channel dispatcher should obtain that 
functionality by calling methods on the channel dispatcher, so that 
they will get an appropriate error if the channel dispatcher is 
missing or not working. The channel dispatcher itself should set 
this to true too, so that it will ignore the NewChannel signal that 
results from the creation of the channel. It can then dispatch the 
channel returned from this method to an appropriate handler. So, 
there is no sensible use-case for setting this to false, and 
setting it to false can result in unhandled channels (in the case 
where clients assume that a channel dispatcher is present, but it 
isn&apos;t).
Returns
The D-Bus object path for the channel created or retrieved

◆ RequestHandles

Tp::UIntList Tp::Service::ConnectionAdaptor::RequestHandles ( uint  handleType,
const QStringList &  identifiers,
const QDBusMessage &  dbusMessage 
)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void requestHandles(uint handleType, const QStringList& identifiers, const Tp::Service::ConnectionAdaptor::RequestHandlesContextPtr &context);

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

Request several handles from the connection manager which represent a number of contacts, rooms or server-stored lists on the service.

If HasImmortalHandles is true, which SHOULD always be the case in this version of telepathy-spec, the handles remain valid until the connection disconnects.

The implementation of this method in older connection managers must record that these handles are in use by the client who invokes this method, and must not deallocate the handles until the client disconnects from the bus or calls the ReleaseHandles() method. Where the identifier refers to an entity that already has a handle in this connection manager, this handle should be returned instead. The handle number 0 must not be returned by the connection manager.

Parameters
handleType
The type of handle required
identifiers
An array of identifiers of entities to request handles for
Returns
An array of integer handle numbers in the same order as the given 
identifiers.

◆ AddClientInterest

void Tp::Service::ConnectionAdaptor::AddClientInterest ( const QStringList &  tokens,
const QDBusMessage &  dbusMessage 
)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void addClientInterest(const QStringList& tokens, const Tp::Service::ConnectionAdaptor::AddClientInterestContextPtr &context);

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

Register a client's interest in notifications related to one or more interfaces.

Groups of notifications are identified by a token which is either a D-Bus interface name, or a string that starts with a D-Bus interface name. The meaning of each token is given by that D-Bus interface, which MUST define it in its documentation.

Initially, all interests are in entire interface, but allowing other strings allows subscription to part of an interface; for instance, an interest in ...MailNotification/count could track the number of messages without caring about their detailed content.

For each token with which this method interacts, the Connection tracks an "interest count" (like a reference count) for each unique bus name that has called this method. When a client calls this method, for each token, the interest count for its unique bus name is incremented; when RemoveClientInterest() is called, all interest counts for that unique bus name are decremented. If the unique bus name leaves the bus (for instance, if the client crashes or exits), all interest counts for that unique bus name are set to zero.

The Connection can then use these reference counts to avoid subscribing to protocol-level notifications unless at least one client has a non-zero interest count for the relevant token.

This method exists to reduce memory and network overhead when there is no active subscription.

One situation where this is useful is ConnectionInterfaceLocationInterface : on XMPP, location updates are received over PEP. If the Connection advertises the geoloc+notify capability, it will be sent location updates for all contacts. To avoid consuming resources for this, the connection should avoid advertising that capability until a client has expressed an interest in contacts' locations.

Another example of a protocol that benefits from this method is the Google XMPP Mail Notification extension, which can be used to implement ConnectionInterfaceMailNotificationInterface . In this protocol, the CM receives a notification that something has changed, but to get more information, the CM must request this information. Knowing that nobody is currently interested in this information, the CM can avoid generating useless network traffic. Similarly, the CM may free the list of unread messages to reduce memory overhead.

If this method is called for an interface that might require protocol-level subscription, but the connection cannot set up that subscription yet (for instance because the Status is not Connected yet), the Connection MUST remember the client's interest, and attempt to subscribe to the appropriate protocol feature when this becomes possible.

Clients MAY ignore any errors raised by this method; it is intended to be called with the reply ignored.

The only reason it could fail is if it's unimplemented, in which case the only thing the client can usefully do is to proceed as if it had succeeded.

Parameters
tokens

Interfaces or parts of interfaces in which to register an interest, represented by either a DBus_Interface, or a string prefixed with a DBus_Interface.

If the Connection does not support one of these tokens, this is not considered to be an error; the unsupported token is simply ignored.

◆ RemoveClientInterest

void Tp::Service::ConnectionAdaptor::RemoveClientInterest ( const QStringList &  tokens,
const QDBusMessage &  dbusMessage 
)
slot

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

Adaptees should export this method as a Qt slot with the following signature: void removeClientInterest(const QStringList& tokens, const Tp::Service::ConnectionAdaptor::RemoveClientInterestContextPtr &context);

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

Release an interest registered using AddClientInterest() . See that method's documentation for details.

Clients MAY ignore any errors raised by this method; it is intended to be called with the reply ignored.

The only reasons it could fail are if it's unimplemented, or if the client's reference-counting is wrong and it has tried to remove a client interest that it did not add. In both cases, there's nothing the client could do about it.

Parameters
tokens

Interfaces or parts of interfaces that were previously passed to \\\ AddClientInterest() \\htmlonly .

◆ SelfHandleChanged

void Tp::Service::ConnectionAdaptor::SelfHandleChanged ( uint  selfHandle)
signal

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

Adaptees should export this signal as a Qt signal with the following signature: void selfHandleChanged(uint selfHandle);

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

Parameters
selfHandle
The new value of the SelfHandle property.

◆ SelfContactChanged

void Tp::Service::ConnectionAdaptor::SelfContactChanged ( uint  selfHandle,
const QString &  selfID 
)
signal

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

Adaptees should export this signal as a Qt signal with the following signature: void selfContactChanged(uint selfHandle, const QString& selfID);

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

Parameters
selfHandle
The new value of the SelfHandle property.
selfID
The new value of the SelfID property.

◆ NewChannel

void Tp::Service::ConnectionAdaptor::NewChannel ( const QDBusObjectPath &  objectPath,
const QString &  channelType,
uint  handleType,
uint  handle,
bool  suppressHandler 
)
signal

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

Adaptees should export this signal as a Qt signal with the following signature: void newChannel(const QDBusObjectPath& objectPath, const QString& channelType, uint handleType, uint handle, bool suppressHandler);

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

Parameters
objectPath
A D-Bus object path for the channel object on this service
channelType
A D-Bus interface name representing the channel type
handleType
An integer representing the type of handle this channel 
communicates with, or Handle_Type_None if no handle is specified
handle
A handle indicating the specific contact, room or list this channel 
communicates with, or zero if no handle is specified
suppressHandler

If true, the channel was requested by a client that intends to present it to the user itself (i.e. it passed suppress_handler=TRUE to the \\\ RequestChannel() \\htmlonly method), so no other handler should be launched. Clients MAY assume that channels where this is true were created by a user request.

If false, either the channel was created due to incoming information from the service, or the channel was requested by a local client that does not intend to handle the channel itself (this usage is deprecated).

Clients MUST NOT assume that only incoming channels will have this flag set to false.

◆ ConnectionError

void Tp::Service::ConnectionAdaptor::ConnectionError ( const QString &  error,
const QVariantMap &  details 
)
signal

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

Adaptees should export this signal as a Qt signal with the following signature: void connectionError(const QString& error, const QVariantMap& details);

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

Parameters
error
The name of a D-Bus error describing the error that occurred, which 
may correspond to a Connection_Status_Reason, or may be a more 
specific Telepathy error (such as 
org.freedesktop.Telepathy.Error.ConnectionRefused for 
Connection_Status_Reason_Network_Error) or a protocol-specific or 
connection-manager-specific error in a suitable namespace. For 
instance, a SIP connection manager could signal &quot;402 Payment 
Required&quot; as an error in a connection-manager-specific 
namespace, or a link-local XMPP implementation that used Avahi 
could provide the error given to it by the avahi-daemon.
details

Additional information about the error, which may include the following well-known keys:

debug-message (s)
Debugging information on the change, corresponding to the message part of a D-Bus error message, which SHOULD NOT be displayed to users under normal circumstances
server-message (s)
A human-readable message from the server explaining what happened. This may be in the user's native language, or in the server operator's native language, or even in Lojban.
user-requested (b), expected-hostname (s), certificate-hostname (s)
The same details defined in TLS_Certificate_Rejection.

◆ StatusChanged

void Tp::Service::ConnectionAdaptor::StatusChanged ( uint  status,
uint  reason 
)
signal

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

Adaptees should export this signal as a Qt signal with the following signature: void statusChanged(uint status, uint reason);

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

Parameters
status
An integer indicating the new status, as defined by ConnectionStatus
reason
An integer indicating the reason for the status change, as defined 
by ConnectionStatusReason