kimproxy.h
/*
kimproxy.h
IM service library for KDE
Copyright (c) 2004 Will Stephenson <lists@stevello.free-online.co.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIMPROXY_H
#define KIMPROXY_H
#include <qdict.h>
#include <qmap.h>
#include <qptrdict.h>
#include <qstringlist.h>
#define IM_SERVICE_TYPE "DCOP/InstantMessenger"
#define IM_CLIENT_PREFERENCES_FILE "default_components"
#define IM_CLIENT_PREFERENCES_SECTION "InstantMessenger"
#define IM_CLIENT_PREFERENCES_ENTRY "imClient"
#include "kimproxyiface.h"
class DCOPClient;
class KIMIface_stub;
class KURL;
class ContactPresenceListCurrent;
typedef QMap<QCString, int> AppPresence; // appId->presence; contains all applications' ideas of a user's presence
typedef QDict<AppPresence> PresenceMap; // uid->AppPresence; contains a AppPresences for all users
typedef QMap<QString, ContactPresenceListCurrent> PresenceStringMap;
class KIMPROXY_EXPORT KIMProxy : public QObject, virtual public KIMProxyIface
{
Q_OBJECT
struct Private;
template<class> friend class KStaticDeleter;
~KIMProxy();
public:
static KIMProxy * instance( DCOPClient * client );
bool initialize();
QStringList allContacts();
QStringList reachableContacts();
QStringList onlineContacts();
QStringList fileTransferContacts();
bool isPresent( const QString& uid );
QString displayName( const QString& uid );
int presenceNumeric( const QString& uid );
QString presenceString( const QString& uid );
QPixmap presenceIcon( const QString& uid );
bool canReceiveFiles( const QString & uid );
bool canRespond( const QString & uid );
QString locate( const QString & contactId, const QString & protocol );
QString context( const QString & uid );
void chatWithContact( const QString& uid );
void messageContact( const QString& uid, const QString& message );
void sendFile(const QString &uid, const KURL &sourceURL,
const QString &altFileName = QString::null, uint fileSize = 0);
bool addContact( const QString &contactId, const QString &protocol );
bool imAppsAvailable();
bool startPreferredApp();
void contactPresenceChanged( QString uid, QCString appId, int presence );
public slots:
void registeredToDCOP( const QCString& appId );
void unregisteredFromDCOP( const QCString& appId );
signals:
void sigContactPresenceChanged( const QString &uid );
void sigPresenceInfoExpired();
protected:
void pollApp( const QCString & appId );
void pollAll( const QString &uid );
bool updatePresence( const QString &uid, const QCString &appId, int presence );
QString preferredApp();
KIMIface_stub * stubForUid( const QString &uid );
KIMIface_stub * stubForProtocol( const QString &protocol );
private:
// client stubs used to get presence
// appId (from DCOP) -> KIMIface_stub
QDict<KIMIface_stub> m_im_client_stubs;
// map containing numeric presence and the originating application ID for each KABC uid we know of
// KABC Uid -> (appId, numeric presence )(AppPresence)
PresenceMap m_presence_map;
// cache of the client strings in use by each application
// dictionary of KIMIface_stub -> map of numeric presence -> string presence
// FIXME: remove for KDE4 - UNUSED but maintained for binary compatibility in KDE 3.4
QPtrDict<int> m_client_presence_strings;
Private * d;
bool m_apps_available;
bool m_initialized;
KIMProxy( DCOPClient * client);
static KIMProxy * s_instance;
};
#endif
DCOPClient
KIMProxy
Provides access to instant messenger programs which implement KDE's instant messanger interface KIMIf...
Definition: kimproxy.h:107

KDE Home | KDE Accessibility Home | Description of Access Keys