00001 /* 00002 * This file is part of TelepathyQt4 00003 * 00004 * Copyright (C) 2008 basysKom GmbH 00005 * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/> 00006 * Copyright (C) 2008 Nokia Corporation 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 #ifndef TelepathyQt4_Prototype_PresenceManager_H_ 00023 #define TelepathyQt4_Prototype_PresenceManager_H_ 00024 00025 #include <QDBusObjectPath> 00026 #include <QObject> 00027 #include <QPointer> 00028 00029 #include <TelepathyQt4/Types> 00030 00031 namespace Telepathy 00032 { 00033 namespace Client 00034 { 00035 class ConnectionInterface; 00036 } 00037 } 00038 00039 namespace TpPrototype { 00040 00041 class PresenceManagerPrivate; 00042 class Connection; 00043 class Contact; 00044 class Account; 00045 00061 class PresenceManager : public QObject 00062 { 00063 Q_OBJECT 00064 public: 00069 bool isValid(); 00070 00077 Telepathy::SimpleStatusSpecMap statuses(); 00078 00086 bool setPresence( const QString& status, const QString& statusMessage ); 00087 00093 Telepathy::SimplePresence currentPresence(); 00094 00104 Telepathy::SimpleContactPresences presencesForContacts( const QList<QPointer<TpPrototype::Contact> >& contacts ); 00105 00110 TpPrototype::Connection* connection(); 00111 00112 signals: 00119 void signalRemotePresencesUpdated( TpPrototype::Contact* contact, const Telepathy::SimplePresence& presence ); 00120 00127 void signalOwnPresenceUpdated( const TpPrototype::Account* account, const Telepathy::SimplePresence& presence ); 00128 00129 protected: 00133 PresenceManager( TpPrototype::Connection* connection, 00134 Telepathy::Client::ConnectionInterface* interface, 00135 QObject* parent = NULL ); 00136 ~PresenceManager(); 00137 00138 protected slots: 00139 void slotPresencesChanged( const Telepathy::SimpleContactPresences& presences ); 00140 void slotPresencesUpdate( const Telepathy::ContactPresences& presences ); 00141 private: 00142 void init(); 00143 00144 TpPrototype::PresenceManagerPrivate * const d; 00145 friend class Connection; 00146 friend class ConnectionPrivate; 00147 }; 00148 } 00149 00150 00151 #endif