Home · All Classes · All Namespaces · Modules · Functions · Files

Tp::ClientRegistrar Class Reference

The ClientRegistrar class is responsible for registering Telepathy clients (Observer, Approver, Handler). More...

#include <TelepathyQt4/ClientRegistrar>

Inherits Tp::RefCounted.

List of all members.

Public Member Functions

Static Public Member Functions


Detailed Description

The ClientRegistrar class is responsible for registering Telepathy clients (Observer, Approver, Handler).

Clients should inherit AbstractClientObserver, AbstractClientApprover, AbstractClientHandler or some combination of these, by using multiple inheritance, and register themselves using registerClient().

See the individual classes descriptions for more details.

Usage

Creating a client registrar object

One way to create a ClientRegistrar object is to just call the create method. For example:

 ClientRegistrarPtr cr = ClientRegistrar::create(); 

You can also provide a D-Bus connection as a QDBusConnection:

 ClientRegistrarPtr cr = ClientRegistrar::create(QDBusConnection::systemBus()); 

Registering a client

To register a client, just call registerClient with a given AbstractClientPtr pointing to a valid AbstractClient instance.

 class MyClient : public AbstractClientObserver, public AbstractClientHandler
 {
     ...
 };

 ...

 ClientRegistrarPtr cr = ClientRegistrar::create();
 SharedPtr<MyClient> client = SharedPtr<MyClient>(new MyClient(...));
 cr->registerClient(AbstractClientPtr::dynamicCast(client), "myclient");
See also:
AbstractClientObserver, AbstractClientApprover, AbstractClientHandler

Constructor & Destructor Documentation

Tp::ClientRegistrar::~ClientRegistrar (  ) 

Class destructor.


Member Function Documentation

ClientRegistrarPtr Tp::ClientRegistrar::create ( const QDBusConnection &  bus = QDBusConnection::sessionBus()  )  [static]

Create a new client registrar object using the given bus.

ClientRegistrar instances are unique per D-Bus connection. The returned ClientRegistrarPtr will point to the same ClientRegistrar instance on successive calls with the same bus, unless the instance had already been destroyed, in which case a new instance will be returned.

Parameters:
bus QDBusConnection to use.
Returns:
A ClientRegistrarPtr object pointing to the ClientRegistrar.
QDBusConnection Tp::ClientRegistrar::dbusConnection (  )  const

Return the D-Bus connection being used by this client registrar.

Returns:
QDBusConnection being used.
QList< AbstractClientPtr > Tp::ClientRegistrar::registeredClients (  )  const

Return a list of clients registered using registerClient() on this client registrar.

Returns:
A list of registered clients.
See also:
registerClient()
bool Tp::ClientRegistrar::registerClient ( const AbstractClientPtr client,
const QString &  clientName,
bool  unique = false 
)

Register a client on D-Bus.

The client registrar will export the appropriate D-Bus interfaces, based on the abstract classes subclassed by

Parameters:
client. If each of a client instance should be able to manipulate channels separately, set unique to true.

The client name MUST be a non-empty string of ASCII digits, letters, dots and/or underscores, starting with a letter, and without sets of two consecutive dots or a dot followed by a digit.

This method will do nothing if the client is already registered, and true will be returned.

To unregister a client use unregisterClient().

Parameters:
client The client to register.
clientName The client name used to register.
unique Whether each of a client instance is able to manipulate channels separately.
Returns:
true if client was successfully registered, false otherwise.
See also:
registeredClients(), unregisterClient()
bool Tp::ClientRegistrar::unregisterClient ( const AbstractClientPtr client  ) 

Unregister a client registered using registerClient() on this client registrar.

If client was not registered previously, false will be returned.

Parameters:
client The client to unregister.
Returns:
true if client was successfully unregistered, false otherwise.
See also:
registeredClients(), registerClient()
void Tp::ClientRegistrar::unregisterClients (  ) 

Unregister all clients registered using registerClient() on this client registrar.

See also:
registeredClients(), registerClient(), unregisterClient()


Copyright © 2008-2010 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.3.6