KIMProxy Class Reference
#include <kimproxy.h>
Inheritance diagram for KIMProxy:

Detailed Description
Provides access to instant messenger programs which implement KDE's instant messanger interface KIMIface.This class provides an easy-to-use interface to all running instant messengers or chat programs that implement KIMIface.
It works simultaneously with any running programs that implement the ServiceType DCOP/InstantMessenger
.
IM-contacts are identified using unique identifier strings (UID) used by KDE's address book framework KABC. However the use of the address book API is optional, KIMProxy provides methods to fetch lists of available contact UIDs from the applications. If a UID is reachable with more than one program, KIMProxy aggregates the available information and presents the 'best' presence. For example, for a contact who can be seen to be Away
in IRC
on program A but Online
using ICQ
on program B, the information from program B will be used.
KIMProxy is designed for simple information in a wide number of cases, not for detailed messaging.
The class is implemented as a singleton, so whenever you need access to one of its methods, just retrieve the single instance using instance(). The following code snippet demonstrated how to send a message to all reachable IM-contacts:
// get proxy instance KIMProxy* proxy = KIMProxy::instance(); // check if there are suitable applications reachable if (!proxy->initialize()) return; QString message = "Hi!\nHow are you on this wonderful day?"; // iterate over the list of reachable contacts QStringList reachableContacts = proxy->reachableContacts(); for (QStringList::const_iterator it = reachableContacts.begin(); it != reachableContacts.end(); ++it) { proxy->messageContact(*it, message); }
- Note:
- While it is possible to communicate with each of those application's by DCOP using KIMProxy has the advantage of communicating with all applications simultaneously and thus getting an augmented view of availability, capability and presence (online status) of IM-contacts.
- See also:
- KIMIface
KABC::AddressBook
KABC::Addressee
- Since:
- 3.3
- Author:
- Will Stephenson <lists@stevello.free-online.co.uk>
Definition at line 107 of file kimproxy.h.
Public Slots | |
void | registeredToDCOP (const QCString &appId) |
void | unregisteredFromDCOP (const QCString &appId) |
Signals | |
void | sigContactPresenceChanged (const QString &uid) |
void | sigPresenceInfoExpired () |
Public Member Functions | |
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) |
Static Public Member Functions | |
static KIMProxy * | instance (DCOPClient *client) |
Protected Member Functions | |
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) |
Friends | |
class | KStaticDeleter |
Member Function Documentation
|
Add a new contact given its protocol specific identifier.
Definition at line 533 of file kimproxy.cpp. |
|
Obtain a list of IM-contacts known to IM-applications. Returns a list of KABC UIDs gathered by merging the lists of each application the proxy can communicate with. The method uses cached information to make it fast and not require actually communicating with the applications every time it is called.
Definition at line 394 of file kimproxy.cpp. |
|
Indicate if a given contact can receive files.
If the given KABC UID is known to more than one IM-application the result of the application which has the best presence for the contact is taken. For example if a contact is
Definition at line 459 of file kimproxy.cpp. |
|
Indicate if a given contact will be able to respond. Some media are unidirectional (e.g., sending SMS via a web interface). This refers to the contact's ability to respond as defined by the medium, not by their presence. Someone may appear offline (SMS has no presence) to you but in fact be able to respond.
If the given KABC UID is known to more than one IM-application the result of the application which has the best presence for the contact is taken. For example if a contact is
Definition at line 469 of file kimproxy.cpp. |
|
Start a chat session with the specified contact.
Definition at line 489 of file kimproxy.cpp. |
|
Just exists to let the IDL compiler make the DCOP signal for this.
Definition at line 328 of file kimproxy.cpp. |
|
Obtain the given contact's current context (home, work, or any).
Not all IM services/protocols support the concept of contexts. If the given UID maps to such a service,
If the given KABC UID is known to more than one IM-application the result of the application which has the best presence for the contact is taken. For example if a contact is
Definition at line 479 of file kimproxy.cpp. |
|
Obtain the proxy's idea of the contact's display name.
If the given KABC UID is known to more than one IM-application the result of the application which has the best presence for the contact is taken. For example if a contact is Useful if KABC lookups may be too slow.
Definition at line 447 of file kimproxy.cpp. |
|
Obtain a list of IM-contacts who may receive file transfers. Returned IM-contacts might not be capable of receiving file tranfers due to limitations of their clients or because they are behind a firewall. KIMProxy doesn't have the possibilities to discover this and will list them as well. Returns a list of KABC UIDs gathered by merging the lists of each application the proxy can communicate with.
Definition at line 427 of file kimproxy.cpp. |
|
Checks if there are any compatible instant messaging applications available. Available means that they are started and registered with DCOP and implementing the correct DCOP service. This information will be updated on the first call to initialize() and whenever an application registers or unregisters with DCOP, i.e. the information will be kept up to date.
Definition at line 553 of file kimproxy.cpp. |
|
Get the proxy ready to connect. Discover any running IM clients and setup communication handlers for them. The list of available clients is updated automatically through notification about added or removed DCOP applications as provided by DCOPClient. It is safe to call this method more than once, initialization only occurs at the first time.
Definition at line 215 of file kimproxy.cpp. |
|
Obtain an instance of KIMProxy. Creates a new instance if it is called for the first time. Call initialize() to check if there are applications available for communication.
Definition at line 166 of file kimproxy.cpp. |
|
Confirm if a given contact is known to the proxy. A contact is known to the proxy if it is know to at least one IM-application the proxy is communicating with. The method uses cached information to make it fast and not require actually communicating with the applications every time it is called.
Definition at line 442 of file kimproxy.cpp. |
|
Obtain the KABC UID corresponding to the given IM address.
Definition at line 543 of file kimproxy.cpp. |
|
Send a single message to the specified contact. Any response will be handled by the IM client as a normal conversation.
Definition at line 502 of file kimproxy.cpp. |
|
Obtain a list of IM-contacts that are currently online. Returns a list of KABC UIDs gathered by merging the lists of each application the proxy can communicate with. The method uses cached information to make it fast and not require actually communicating with the applications every time it is called.
Definition at line 415 of file kimproxy.cpp. |
|
Bootstrap our presence data by polling all known apps.
Definition at line 576 of file kimproxy.cpp. |
|
Bootstrap our presence data for a newly registered app.
Definition at line 594 of file kimproxy.cpp. |
|
Get the name of the user's IM application of choice.
Definition at line 644 of file kimproxy.cpp. |
|
Obtain the icon representing the IM presence for the specified contact.
If the given KABC UID is known to more than one IM-application the result of the application which has the best presence for the contact is taken. For example if a contact is
Definition at line 373 of file kimproxy.cpp. |
|
Obtain the IM presence as a number for the specified contact. Returns one of the following values depending on the given contact's presence:
If the given KABC UID is known to more than one IM-application the result of the application which has the best presence for the contact is taken. For example if a contact is The method uses cached information to make it fast and not require actually communicating with the applications every time it is called.
Definition at line 346 of file kimproxy.cpp. |
|
Obtain the IM presence as a i18ned string for the specified contact. The presence string is one of the following:
If the given KABC UID is known to more than one IM-application the result of the application which has the best presence for the contact is taken. For example if a contact is
Definition at line 358 of file kimproxy.cpp. |
|
Obtain a list of IM-contacts that are currently reachable. Returns a list of KABC UIDs gathered by merging the lists of each application the proxy can communicate with.
Definition at line 400 of file kimproxy.cpp. |
|
Updates the proxy's data after a new application registered with DCOP. Checks if the application specified by the given DCOP application identifier implements the instant messenger service.
Definition at line 266 of file kimproxy.cpp. |
|
Send a file to the contact. Initiates a file transfer with the given contact if possible.
Definition at line 515 of file kimproxy.cpp. |
|
Indicates that the specified IM-contact's presence changed.
|
|
Indicates that presence information obtained earlier on might not be valid any longer. After the sources of presence information have changed so any previously supplied presence info is invalid. |
|
Start the user's preferred IM application.
Definition at line 558 of file kimproxy.cpp. |
|
Get the app stub for this protocol. Take the preferred app first, then any other. Definition at line 624 of file kimproxy.cpp. |
|
Get the app stub best able to reach this uid.
Definition at line 616 of file kimproxy.cpp. |
|
Updates the proxy's data after an application unregistered with DCOP. If the application specified by the given DCOP application identifier is one of the instant messenger applications of the proxy, it will remove the presence information it gathered from it earlier on. Emits sigPresenceInfoExpired() to let the using applcation know its presence related information might need updating.
Definition at line 301 of file kimproxy.cpp. |
|
Update our records with the given data.
|
The documentation for this class was generated from the following files: