TpPrototype::PresenceManager Class Reference
[Connection Management]

#include <TelepathyQt4/Prototype/PresenceManager.h>

Collaboration diagram for TpPrototype::PresenceManager:

Collaboration graph
[legend]

List of all members.

Signals

void signalRemotePresencesUpdated (TpPrototype::Contact *contact, const Telepathy::SimplePresence &presence)
void signalOwnPresenceUpdated (const TpPrototype::Account *account, const Telepathy::SimplePresence &presence)

Public Member Functions

bool isValid ()
Telepathy::SimpleStatusSpecMap statuses ()
bool setPresence (const QString &status, const QString &statusMessage)
Telepathy::SimplePresence currentPresence ()
Telepathy::SimpleContactPresences presencesForContacts (const QList< QPointer< TpPrototype::Contact > > &contacts)
TpPrototype::Connectionconnection ()

Protected Slots

void slotPresencesChanged (const Telepathy::SimpleContactPresences &presences)
void slotPresencesUpdate (const Telepathy::ContactPresences &presences)

Protected Member Functions

 PresenceManager (TpPrototype::Connection *connection, Telepathy::Client::ConnectionInterface *interface, QObject *parent=NULL)
 ~PresenceManager ()

Friends

class Connection
class ConnectionPrivate


Detailed Description

This class manages presence information for one connection. Whenever a contact presence changes, the signal signalRemotePresencesUpdated() is emitted. This signal provides the related contact object obtained from the ContactManager. In order to keep the contacts updated, you just have to instantiate this class (by requesting the object with Connection::presenceManager()) and initialize the list of contacts once (by calling presencesForContacts() ). After this point, the presence information of the contact is updated automatically if a change is signalled by the backend.

Info: The deprecated interface "org.freedesktop.Telepathy.Channel.Interface.Presence" is used as fallback, if the interface "org.freedesktop.Telepathy.Channel.Interface.SimplePresence" is not supported by the connection manager. Thus, a wide range of connection managers should work with this class.

See also:
Connection

Constructor & Destructor Documentation

PresenceManager::PresenceManager ( TpPrototype::Connection connection,
Telepathy::Client::ConnectionInterface interface,
QObject *  parent = NULL 
) [protected]

Constructor. The presence manager cannot be instantiated directly. Use Connection::presenceManager() for it!

PresenceManager::~PresenceManager (  )  [protected]


Member Function Documentation

TpPrototype::Connection * PresenceManager::connection (  ) 

Returns the connection that belongs to this presence information.

Returns:
The connection object

Telepathy::SimplePresence PresenceManager::currentPresence (  ) 

Gets local presence. The local presence is returned for the connection.

Returns:
Returns my current local presence or an empty item on error.

Referenced by TpPrototype::Account::currentPresence().

bool PresenceManager::isValid (  ) 

Validity. Do not access any methods if the object is invalid!

Telepathy::SimpleContactPresences TpPrototype::PresenceManager::presencesForContacts ( const QList< QPointer< TpPrototype::Contact > > &  contacts  ) 

Request presences. Requests a list of presences for the given list of contacts.

Parameters:
contacts List of contacts.
Returns:
List of presence information for contacts as QMap<int,SimplePresence> . The int represents the identifier of the contact as returned by Contact::identifier(), An empty list is returned on error.
Todo:
Future: Use QList<Contact> instead QList<QPointer<Contact> > or introduce a class ContactGroup that handles all internally.

Future: Telepathy::SimpleContactPresences relies of an handle (the int). This should be encapsulated.

bool PresenceManager::setPresence ( const QString &  status,
const QString &  statusMessage 
)

Set Presence. Request that the presence status and status message are published for the connection. Changes will be indicated by signal signalOwnPresenceUpdated().

Parameters:
status The state to set the presence to as returned by statuses().
See also:
signalOwnPresenceUpdated().;

References signalOwnPresenceUpdated().

void TpPrototype::PresenceManager::signalOwnPresenceUpdated ( const TpPrototype::Account account,
const Telepathy::SimplePresence presence 
) [signal]

Local presence changed. This signal is emitted when the local presence state was changed.

Parameters:
account The account that changes.
presence The presence information.

Referenced by setPresence(), and slotPresencesChanged().

void TpPrototype::PresenceManager::signalRemotePresencesUpdated ( TpPrototype::Contact contact,
const Telepathy::SimplePresence presence 
) [signal]

Presences of remote contacts are changed. This signal is emitted when the presence state of a remote contact is changed.

Parameters:
contact The contact that changes.
presence The presence information.

Referenced by slotPresencesChanged().

void PresenceManager::slotPresencesChanged ( const Telepathy::SimpleContactPresences presences  )  [protected, slot]

void PresenceManager::slotPresencesUpdate ( const Telepathy::ContactPresences presences  )  [protected, slot]

Telepathy::SimpleStatusSpecMap PresenceManager::statuses (  ) 

Supported statuses. Returns the list of supported status states. The list may change if the status of the connection changes from disconnected to connected.

Returns:
The list of supported statuses.
See also:
connection::status();

Referenced by slotPresencesUpdate().


Friends And Related Function Documentation

friend class Connection [friend]

friend class ConnectionPrivate [friend]


Generated on Thu Mar 5 18:52:15 2009 for TelepathyQt4-0.1.1 by  doxygen 1.5.8