• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • interfaces
 

interfaces

  • interfaces
  • tdeimproxy
  • library
tdeimproxy.h
1/*
2 tdeimproxy.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 TDEIMPROXY_H
25#define TDEIMPROXY_H
26
27#include <tqdict.h>
28#include <tqmap.h>
29#include <tqptrdict.h>
30#include <tqstringlist.h>
31
32
33#define IM_SERVICE_TYPE "DCOP/InstantMessenger"
34#define IM_CLIENT_PREFERENCES_FILE "default_components"
35#define IM_CLIENT_PREFERENCES_SECTION "InstantMessenger"
36#define IM_CLIENT_PREFERENCES_ENTRY "imClient"
37
38#include "tdeimproxyiface.h"
39
40class DCOPClient;
41class KIMIface_stub;
42class KURL;
43class ContactPresenceListCurrent;
44
46typedef TQMap<TQCString, int> AppPresence; // appId->presence; contains all applications' ideas of a user's presence
47typedef TQDict<AppPresence> PresenceMap; // uid->AppPresence; contains a AppPresences for all users
49typedef TQMap<TQString, ContactPresenceListCurrent> PresenceStringMap;
50
107class TDEIMPROXY_EXPORT KIMProxy : public TQObject, virtual public KIMProxyIface
108{
109 TQ_OBJECT
110 struct Private;
111
112 template<class> friend class KStaticDeleter;
113 ~KIMProxy();
114
115 public:
131 static KIMProxy * instance( DCOPClient * client );
132
147 bool initialize();
148
166 TQStringList allContacts();
167
182 TQStringList reachableContacts();
183
202 TQStringList onlineContacts();
203
224 TQStringList fileTransferContacts();
225
244 bool isPresent( const TQString& uid );
245
266 TQString displayName( const TQString& uid );
267
307 int presenceNumeric( const TQString& uid );
308
343 TQString presenceString( const TQString& uid );
344
372 TQPixmap presenceIcon( const TQString& uid );
373
389 bool canReceiveFiles( const TQString & uid );
390
414 bool canRespond( const TQString & uid );
415
432 TQString locate( const TQString & contactId, const TQString & protocol );
433
454 TQString context( const TQString & uid );
455
467 void chatWithContact( const TQString& uid );
468
484 void messageContact( const TQString& uid, const TQString& message );
485
503 void sendFile(const TQString &uid, const KURL &sourceURL,
504 const TQString &altFileName = TQString::null, uint fileSize = 0);
505
519 bool addContact( const TQString &contactId, const TQString &protocol );
520
533 bool imAppsAvailable();
534
540 bool startPreferredApp();
541
545 void contactPresenceChanged( TQString uid, TQCString appId, int presence );
546
547 public slots:
560 void registeredToDCOP( const TQCString& appId );
561
579 void unregisteredFromDCOP( const TQCString& appId );
580 signals:
591 void sigContactPresenceChanged( const TQString &uid );
592
600 void sigPresenceInfoExpired();
601 protected:
605 void pollApp( const TQCString & appId );
609 void pollAll( const TQString &uid );
610
614 bool updatePresence( const TQString &uid, const TQCString &appId, int presence );
615
619 TQString preferredApp();
620
624 KIMIface_stub * stubForUid( const TQString &uid );
625
630 KIMIface_stub * stubForProtocol( const TQString &protocol );
631
632 private:
633 // client stubs used to get presence
634 // appId (from DCOP) -> KIMIface_stub
635 TQDict<KIMIface_stub> m_im_client_stubs;
636 // map containing numeric presence and the originating application ID for each KABC uid we know of
637 // KABC Uid -> (appId, numeric presence )(AppPresence)
638 PresenceMap m_presence_map;
639 // cache of the client strings in use by each application
640 // dictionary of KIMIface_stub -> map of numeric presence -> string presence
641 // FIXME: remove for KDE4 - UNUSED but maintained for binary compatibility in KDE 3.4
642 TQPtrDict<int> m_client_presence_strings;
643 Private * d;
644 bool m_apps_available;
645 bool m_initialized;
649 KIMProxy( DCOPClient * client);
650 static KIMProxy * s_instance;
651};
652
653#endif
654
DCOPClient
KIMProxy::stubForProtocol
KIMIface_stub * stubForProtocol(const TQString &protocol)
Get the app stub for this protocol.
Definition tdeimproxy.cpp:624
KIMProxy::sigContactPresenceChanged
void sigContactPresenceChanged(const TQString &uid)
Indicates that the specified IM-contact's presence changed.
KIMProxy::presenceIcon
TQPixmap presenceIcon(const TQString &uid)
Obtain the icon representing the IM presence for the specified contact.
Definition tdeimproxy.cpp:373
KIMProxy::onlineContacts
TQStringList onlineContacts()
Obtain a list of IM-contacts that are currently online.
Definition tdeimproxy.cpp:415
KIMProxy::canReceiveFiles
bool canReceiveFiles(const TQString &uid)
Indicate if a given contact can receive files.
Definition tdeimproxy.cpp:459
KIMProxy::unregisteredFromDCOP
void unregisteredFromDCOP(const TQCString &appId)
Updates the proxy's data after an application unregistered with DCOP.
Definition tdeimproxy.cpp:301
KIMProxy::sigPresenceInfoExpired
void sigPresenceInfoExpired()
Indicates that presence information obtained earlier on might not be valid any longer.
KIMProxy::chatWithContact
void chatWithContact(const TQString &uid)
Start a chat session with the specified contact.
Definition tdeimproxy.cpp:489
KIMProxy::allContacts
TQStringList allContacts()
Obtain a list of IM-contacts known to IM-applications.
Definition tdeimproxy.cpp:394
KIMProxy::initialize
bool initialize()
Get the proxy ready to connect.
Definition tdeimproxy.cpp:215
KIMProxy::presenceNumeric
int presenceNumeric(const TQString &uid)
Obtain the IM presence as a number for the specified contact.
Definition tdeimproxy.cpp:346
KIMProxy::isPresent
bool isPresent(const TQString &uid)
Confirm if a given contact is known to the proxy.
Definition tdeimproxy.cpp:442
KIMProxy::messageContact
void messageContact(const TQString &uid, const TQString &message)
Send a single message to the specified contact.
Definition tdeimproxy.cpp:502
KIMProxy::fileTransferContacts
TQStringList fileTransferContacts()
Obtain a list of IM-contacts who may receive file transfers.
Definition tdeimproxy.cpp:427
KIMProxy::displayName
TQString displayName(const TQString &uid)
Obtain the proxy's idea of the contact's display name.
Definition tdeimproxy.cpp:447
KIMProxy::startPreferredApp
bool startPreferredApp()
Start the user's preferred IM application.
Definition tdeimproxy.cpp:558
KIMProxy::imAppsAvailable
bool imAppsAvailable()
Checks if there are any compatible instant messaging applications available.
Definition tdeimproxy.cpp:553
KIMProxy::canRespond
bool canRespond(const TQString &uid)
Indicate if a given contact will be able to respond.
Definition tdeimproxy.cpp:469
KIMProxy::updatePresence
bool updatePresence(const TQString &uid, const TQCString &appId, int presence)
Update our records with the given data.
KIMProxy::registeredToDCOP
void registeredToDCOP(const TQCString &appId)
Updates the proxy's data after a new application registered with DCOP.
Definition tdeimproxy.cpp:266
KIMProxy::contactPresenceChanged
void contactPresenceChanged(TQString uid, TQCString appId, int presence)
Just exists to let the IDL compiler make the DCOP signal for this.
Definition tdeimproxy.cpp:328
KIMProxy::reachableContacts
TQStringList reachableContacts()
Obtain a list of IM-contacts that are currently reachable.
Definition tdeimproxy.cpp:400
KIMProxy::pollAll
void pollAll(const TQString &uid)
Bootstrap our presence data by polling all known apps.
Definition tdeimproxy.cpp:576
KIMProxy::context
TQString context(const TQString &uid)
Obtain the given contact's current context (home, work, or any).
Definition tdeimproxy.cpp:479
KIMProxy::stubForUid
KIMIface_stub * stubForUid(const TQString &uid)
Get the app stub best able to reach this uid.
Definition tdeimproxy.cpp:616
KIMProxy::sendFile
void sendFile(const TQString &uid, const KURL &sourceURL, const TQString &altFileName=TQString::null, uint fileSize=0)
Send a file to the contact.
Definition tdeimproxy.cpp:515
KIMProxy::addContact
bool addContact(const TQString &contactId, const TQString &protocol)
Add a new contact given its protocol specific identifier.
Definition tdeimproxy.cpp:533
KIMProxy::instance
static KIMProxy * instance(DCOPClient *client)
Obtain an instance of KIMProxy.
Definition tdeimproxy.cpp:166
KIMProxy::pollApp
void pollApp(const TQCString &appId)
Bootstrap our presence data for a newly registered app.
Definition tdeimproxy.cpp:594
KIMProxy::preferredApp
TQString preferredApp()
Get the name of the user's IM application of choice.
Definition tdeimproxy.cpp:644
KIMProxy::presenceString
TQString presenceString(const TQString &uid)
Obtain the IM presence as a i18ned string for the specified contact.
Definition tdeimproxy.cpp:358
KURL
locate
TQString locate(const char *type, const TQString &filename, const TDEInstance *instance=TDEGlobal::instance())

interfaces

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

interfaces

Skip menu "interfaces"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for interfaces by doxygen 1.15.0
This website is maintained by Timothy Pearson.