interfaces
kimproxy.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KIMPROXY_H
00025 #define KIMPROXY_H
00026
00027 #include <qdict.h>
00028 #include <qmap.h>
00029 #include <qptrdict.h>
00030 #include <qstringlist.h>
00031
00032
00033 #define IM_SERVICE_TYPE "DCOP/InstantMessenger"
00034 #define IM_CLIENT_PREFERENCES_FILE "default_components"
00035 #define IM_CLIENT_PREFERENCES_SECTION "InstantMessenger"
00036 #define IM_CLIENT_PREFERENCES_ENTRY "imClient"
00037
00038 #include "kimproxyiface.h"
00039
00040 class DCOPClient;
00041 class KIMIface_stub;
00042 class KURL;
00043 class ContactPresenceListCurrent;
00044
00046 typedef QMap<QCString, int> AppPresence;
00047 typedef QDict<AppPresence> PresenceMap;
00049 typedef QMap<QString, ContactPresenceListCurrent> PresenceStringMap;
00050
00107 class KIMPROXY_EXPORT KIMProxy : public QObject, virtual public KIMProxyIface
00108 {
00109 Q_OBJECT
00110 struct Private;
00111
00112 template<class> friend class KStaticDeleter;
00113 ~KIMProxy();
00114
00115 public:
00131 static KIMProxy * instance( DCOPClient * client );
00132
00147 bool initialize();
00148
00166 QStringList allContacts();
00167
00182 QStringList reachableContacts();
00183
00202 QStringList onlineContacts();
00203
00224 QStringList fileTransferContacts();
00225
00244 bool isPresent( const QString& uid );
00245
00266 QString displayName( const QString& uid );
00267
00307 int presenceNumeric( const QString& uid );
00308
00343 QString presenceString( const QString& uid );
00344
00372 QPixmap presenceIcon( const QString& uid );
00373
00389 bool canReceiveFiles( const QString & uid );
00390
00414 bool canRespond( const QString & uid );
00415
00432 QString locate( const QString & contactId, const QString & protocol );
00433
00454 QString context( const QString & uid );
00455
00467 void chatWithContact( const QString& uid );
00468
00484 void messageContact( const QString& uid, const QString& message );
00485
00503 void sendFile(const QString &uid, const KURL &sourceURL,
00504 const QString &altFileName = QString::null, uint fileSize = 0);
00505
00519 bool addContact( const QString &contactId, const QString &protocol );
00520
00533 bool imAppsAvailable();
00534
00540 bool startPreferredApp();
00541
00545 void contactPresenceChanged( QString uid, QCString appId, int presence );
00546
00547 public slots:
00560 void registeredToDCOP( const QCString& appId );
00561
00579 void unregisteredFromDCOP( const QCString& appId );
00580 signals:
00591 void sigContactPresenceChanged( const QString &uid );
00592
00600 void sigPresenceInfoExpired();
00601 protected:
00605 void pollApp( const QCString & appId );
00609 void pollAll( const QString &uid );
00610
00614 bool updatePresence( const QString &uid, const QCString &appId, int presence );
00615
00619 QString preferredApp();
00620
00624 KIMIface_stub * stubForUid( const QString &uid );
00625
00630 KIMIface_stub * stubForProtocol( const QString &protocol );
00631
00632 private:
00633
00634
00635 QDict<KIMIface_stub> m_im_client_stubs;
00636
00637
00638 PresenceMap m_presence_map;
00639
00640
00641
00642 QPtrDict<int> m_client_presence_strings;
00643 Private * d;
00644 bool m_apps_available;
00645 bool m_initialized;
00649 KIMProxy( DCOPClient * client);
00650 static KIMProxy * s_instance;
00651 };
00652
00653 #endif
00654