interfaces/tdeimproxy/library
tdeimproxy.h
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 TDEIMPROXY_H
00025 #define TDEIMPROXY_H
00026
00027 #include <tqdict.h>
00028 #include <tqmap.h>
00029 #include <tqptrdict.h>
00030 #include <tqstringlist.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 "tdeimproxyiface.h"
00039
00040 class DCOPClient;
00041 class KIMIface_stub;
00042 class KURL;
00043 class ContactPresenceListCurrent;
00044
00046 typedef TQMap<TQCString, int> AppPresence;
00047 typedef TQDict<AppPresence> PresenceMap;
00049 typedef TQMap<TQString, ContactPresenceListCurrent> PresenceStringMap;
00050
00107 class TDEIMPROXY_EXPORT KIMProxy : public TQObject, 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 TQStringList allContacts();
00167
00182 TQStringList reachableContacts();
00183
00202 TQStringList onlineContacts();
00203
00224 TQStringList fileTransferContacts();
00225
00244 bool isPresent( const TQString& uid );
00245
00266 TQString displayName( const TQString& uid );
00267
00307 int presenceNumeric( const TQString& uid );
00308
00343 TQString presenceString( const TQString& uid );
00344
00372 TQPixmap presenceIcon( const TQString& uid );
00373
00389 bool canReceiveFiles( const TQString & uid );
00390
00414 bool canRespond( const TQString & uid );
00415
00432 TQString locate( const TQString & contactId, const TQString & protocol );
00433
00454 TQString context( const TQString & uid );
00455
00467 void chatWithContact( const TQString& uid );
00468
00484 void messageContact( const TQString& uid, const TQString& message );
00485
00503 void sendFile(const TQString &uid, const KURL &sourceURL,
00504 const TQString &altFileName = TQString::null, uint fileSize = 0);
00505
00519 bool addContact( const TQString &contactId, const TQString &protocol );
00520
00533 bool imAppsAvailable();
00534
00540 bool startPreferredApp();
00541
00545 void contactPresenceChanged( TQString uid, TQCString appId, int presence );
00546
00547 public slots:
00560 void registeredToDCOP( const TQCString& appId );
00561
00579 void unregisteredFromDCOP( const TQCString& appId );
00580 signals:
00591 void sigContactPresenceChanged( const TQString &uid );
00592
00600 void sigPresenceInfoExpired();
00601 protected:
00605 void pollApp( const TQCString & appId );
00609 void pollAll( const TQString &uid );
00610
00614 bool updatePresence( const TQString &uid, const TQCString &appId, int presence );
00615
00619 TQString preferredApp();
00620
00624 KIMIface_stub * stubForUid( const TQString &uid );
00625
00630 KIMIface_stub * stubForProtocol( const TQString &protocol );
00631
00632 private:
00633
00634
00635 TQDict<KIMIface_stub> m_im_client_stubs;
00636
00637
00638 PresenceMap m_presence_map;
00639
00640
00641
00642 TQPtrDict<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