• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

interfaces

kimproxy.h

Go to the documentation of this file.
00001 /*
00002     kimproxy.h
00003 
00004     IM service library for KDE
00005 
00006     Copyright (c) 2004 Will Stephenson   <lists@stevello.free-online.co.uk>
00007 
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Library General Public
00010     License as published by the Free Software Foundation; either
00011     version 2 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     Library General Public License for more details.
00017 
00018     You should have received a copy of the GNU Library General Public License
00019     along with this library; see the file COPYING.LIB.  If not, write to
00020     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021     Boston, MA 02110-1301, USA.
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;        // appId->presence; contains all applications' ideas of a user's presence
00047 typedef QDict<AppPresence> PresenceMap;         // uid->AppPresence; contains a AppPresences for all users
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         // client stubs used to get presence
00634         // appId (from DCOP) -> KIMIface_stub
00635         QDict<KIMIface_stub> m_im_client_stubs;
00636         // map containing numeric presence and the originating application ID for each KABC uid we know of
00637         // KABC Uid -> (appId, numeric presence )(AppPresence)
00638         PresenceMap m_presence_map;
00639         // cache of the client strings in use by each application
00640         // dictionary of KIMIface_stub -> map of numeric presence -> string presence
00641         // FIXME: remove for KDE4 - UNUSED but maintained for binary compatibility in KDE 3.4
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 

interfaces

Skip menu "interfaces"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal