• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Interfaces

  • interfaces
  • kimproxy
  • library
kimproxy.h
Go to the documentation of this file.
1/*
2 kimproxy.h
3
4 IM service library for KDE
5
6 Copyright (c) 2004 Will Stephenson <lists@stevello.free-online.co.uk>
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22*/
23
24#ifndef KIMPROXY_H
25#define KIMPROXY_H
26
27#include <QtCore/QHash>
28#include <QtCore/QMap>
29#include <QtCore/QStringList>
30#include <QtGui/QPixmap>
31
32#include <kimproxy_export.h>
33
34#define IM_SERVICE_TYPE "DBUS/InstantMessenger"
35#define IM_CLIENT_PREFERENCES_FILE "default_components"
36#define IM_CLIENT_PREFERENCES_SECTION "InstantMessenger"
37#define IM_CLIENT_PREFERENCES_ENTRY "imClient"
38
39class KUrl;
40class ContactPresenceListCurrent;
41class OrgKdeKIMInterface;
42
44typedef QMap<QString, int> AppPresence; // appId->presence; contains all applications' ideas of a user's presence
45typedef QHash<QString, AppPresence*> PresenceMap; // uid->AppPresence; contains a AppPresences for all users
47typedef QMap<QString, ContactPresenceListCurrent> PresenceStringMap;
48
68class KIMPROXY_EXPORT KIMProxy : public QObject
69{
70 Q_OBJECT
71 public:
72 ~KIMProxy();
77 static KIMProxy * instance();
78
84 bool initialize();
85
86 public Q_SLOTS:
92 QStringList allContacts();
93
99 QStringList reachableContacts();
100
106 QStringList onlineContacts();
107
113 QStringList fileTransferContacts();
114
120 bool isPresent( const QString& uid );
121
128 QString displayName( const QString& uid );
129
135 int presenceNumeric( const QString& uid );
136
142 QString presenceString( const QString& uid );
143
149 QPixmap presenceIcon( const QString& uid );
150
156 bool canReceiveFiles( const QString & uid );
157
163 bool canRespond( const QString & uid );
164
172 QString locate( const QString & contactId, const QString & protocol );
173
179 QString context( const QString & uid );
180
185 void chatWithContact( const QString& uid );
186
194 void messageContact( const QString& uid, const QString& message );
195
203 void sendFile(const QString &uid, const QString &sourceURL, const QString &altFileName = QString(), uint fileSize = 0);
204
211 bool addContact( const QString &contactId, const QString &protocol );
212
217 bool imAppsAvailable();
218
223 bool startPreferredApp();
224
228 void contactPresenceChanged( const QString& uid, const QString& appId, int presence );
229
230 private Q_SLOTS:
231 void nameOwnerChanged( const QString &name, const QString &oldOwner, const QString &newOwner);
232 Q_SIGNALS:
237 void sigContactPresenceChanged( const QString &uid );
238
243 void sigPresenceInfoExpired();
244 protected:
248 void pollApp( const QString & appId );
252 void pollAll( const QString &uid );
253
257 bool updatePresence( const QString &uid, const QString &appId, int presence );
258
262 QString preferredApp();
263
267 OrgKdeKIMInterface * stubForUid( const QString &uid );
268
273 OrgKdeKIMInterface * stubForProtocol( const QString &protocol );
274
275 private:
276 // client stubs used to get presence
277 // appId (from D-Bus) -> KIMIface_stub
278 QHash<QString, OrgKdeKIMInterface*> m_im_client_stubs;
279 // map containing numeric presence and the originating application ID for each KABC uid we know of
280 // KABC Uid -> (appId, numeric presence )(AppPresence)
281 PresenceMap m_presence_map;
282 // cache of the client strings in use by each application
283 // dictionary of KIMIface_stub -> map of numeric presence -> string presence
284 class Private;
285
286 Private * const d;
287 bool m_apps_available;
288 bool m_initialized;
292 KIMProxy();
293};
294
295#endif
296
KIMProxy::context
QString context(const QString &uid)
Get the supplied addressee's current context (home, work, or any).
Definition kimproxy.cpp:465
KIMProxy::locate
QString locate(const QString &contactId, const QString &protocol)
Get the KABC uid corresponding to the supplied IM address Protocols should be.
Definition kimproxy.cpp:530
KIMProxy::onlineContacts
QStringList onlineContacts()
Obtain a list of KDE address book entries who are currently online.
Definition kimproxy.cpp:400
KIMProxy::fileTransferContacts
QStringList fileTransferContacts()
Obtain a list of KDE address book entries who may receive file transfers.
Definition kimproxy.cpp:412
KIMProxy::sigPresenceInfoExpired
void sigPresenceInfoExpired()
Indicates that the sources of presence information have changed so any previously supplied presence i...
KIMProxy::instance
static KIMProxy * instance()
Obtain an instance of KIMProxy.
Definition kimproxy.cpp:175
KIMProxy::canRespond
bool canRespond(const QString &uid)
Some media are unidirectional (eg, sending SMS via a web interface).
Definition kimproxy.cpp:455
KIMProxy::contactPresenceChanged
void contactPresenceChanged(const QString &uid, const QString &appId, int presence)
Just exists to let the idl compiler make the D-Bus signal for this.
Definition kimproxy.cpp:312
KIMProxy::initialize
bool initialize()
Get the proxy ready to connect Discover any running preferred IM clients and set up stubs for it.
Definition kimproxy.cpp:215
KIMProxy::preferredApp
QString preferredApp()
Get the name of the user's IM weapon of choice.
Definition kimproxy.cpp:645
KIMProxy::isPresent
bool isPresent(const QString &uid)
Confirm if a given KABC uid is known to KIMProxy.
Definition kimproxy.cpp:428
KIMProxy::messageContact
void messageContact(const QString &uid, const QString &message)
Send a single message to the specified addressee Any response will be handled by the IM client as a n...
Definition kimproxy.cpp:488
KIMProxy::presenceNumeric
int presenceNumeric(const QString &uid)
Obtain the IM presence as a number (see KIMIface) for the specified addressee.
Definition kimproxy.cpp:330
KIMProxy::displayName
QString displayName(const QString &uid)
Obtain the IM app's idea of the contact's display name Useful if KABC lookups may be too slow.
Definition kimproxy.cpp:433
KIMProxy::startPreferredApp
bool startPreferredApp()
Start the user's preferred IM application.
Definition kimproxy.cpp:545
KIMProxy::imAppsAvailable
bool imAppsAvailable()
Are there any compatible instant messaging apps installed?
Definition kimproxy.cpp:540
KIMProxy::addContact
bool addContact(const QString &contactId, const QString &protocol)
Add a contact to the contact list.
Definition kimproxy.cpp:520
KIMProxy::stubForUid
OrgKdeKIMInterface * stubForUid(const QString &uid)
Get the app stub best able to reach this uid.
Definition kimproxy.cpp:610
KIMProxy::allContacts
QStringList allContacts()
Obtain a list of IM-contactable entries in the KDE address book.
Definition kimproxy.cpp:378
KIMProxy::chatWithContact
void chatWithContact(const QString &uid)
Start a chat session with the specified addressee.
Definition kimproxy.cpp:475
KIMProxy::pollAll
void pollAll(const QString &uid)
Bootstrap our presence data by polling all known apps.
Definition kimproxy.cpp:566
KIMProxy::canReceiveFiles
bool canReceiveFiles(const QString &uid)
Indicate if a given uid can receive files.
Definition kimproxy.cpp:445
KIMProxy::presenceString
QString presenceString(const QString &uid)
Obtain the IM presence as a i18ned string for the specified addressee.
Definition kimproxy.cpp:342
KIMProxy::presenceIcon
QPixmap presenceIcon(const QString &uid)
Obtain the icon representing IM presence for the specified addressee.
Definition kimproxy.cpp:357
KIMProxy::sendFile
void sendFile(const QString &uid, const QString &sourceURL, const QString &altFileName=QString(), uint fileSize=0)
Send the file to the contact.
Definition kimproxy.cpp:501
KIMProxy::updatePresence
bool updatePresence(const QString &uid, const QString &appId, int presence)
Update our records with the given data.
KIMProxy::sigContactPresenceChanged
void sigContactPresenceChanged(const QString &uid)
Indicates that the specified UID's presence changed.
KIMProxy::pollApp
void pollApp(const QString &appId)
Bootstrap our presence data for a newly registered app.
Definition kimproxy.cpp:585
KIMProxy::stubForProtocol
OrgKdeKIMInterface * stubForProtocol(const QString &protocol)
Get the app stub for this protocol.
Definition kimproxy.cpp:618
KIMProxy::reachableContacts
QStringList reachableContacts()
Obtain a list of KDE address book entries who are currently reachable.
Definition kimproxy.cpp:384
KUrl
QHash
QMap
QObject
PresenceMap
QHash< QString, AppPresence * > PresenceMap
Definition kimproxy.h:45
AppPresence
QMap< QString, int > AppPresence
FIXME: remove for KDE4, binary compatibility again.
Definition kimproxy.h:44
PresenceStringMap
QMap< QString, ContactPresenceListCurrent > PresenceStringMap
FIXME: remove presenceMap and call this presenceMap in KDE4.
Definition kimproxy.h:47
kimproxy_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Interfaces

Skip menu "Interfaces"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal