KIMIface Class Referenceabstract

`#include <kimiface.h>`

Inheritance diagram for KIMIface:

## Public Attributes

k_dcop_signals | __pad0__: void contactPresenceChanged( QString uid
k_dcop_signals QCString | appId
k_dcop_signals QCString int | presence

## Additional Inherited Members

Public Member Functions inherited from DCOPObject
| DCOPObject (QObject *obj)
| DCOPObject (const QCString &objId)
QCString | objId () const
bool | setObjId (const QCString &objId)
virtual bool | process (const QCString &fun, const QByteArray &data, QCString &replyType, QByteArray &replyData)
virtual bool | processDynamic (const QCString &fun, const QByteArray &data, QCString &replyType, QByteArray &replyData)
virtual QCStringList | functionsDynamic ()
virtual QCStringList | interfacesDynamic ()
virtual QCStringList | interfaces ()
virtual QCStringList | functions ()
void | emitDCOPSignal (const QCString &signal, const QByteArray &data)
bool | connectDCOPSignal (const QCString &sender, const QCString &senderObj, const QCString &signal, const QCString &slot, bool Volatile)
bool | disconnectDCOPSignal (const QCString &sender, const QCString &senderObj, const QCString &signal, const QCString &slot)
DCOPClient * | callingDcopClient ()
Static Public Member Functions inherited from DCOPObject
static bool | hasObject (const QCString &objId)
static DCOPObject * | find (const QCString &objId)
static QPtrList< DCOPObject > | match (const QCString &partialId)
static QCString | objectName (QObject *obj)

## Detailed Description

Generic DCOP interface for KDE instant messenger applications.

The interface has two parts:

- methods to get information about IM-contacts, such as their reachability or their presence status (if the are online or away, etc)
- methods to initiate communication with IM-contacts, e.g. sending messages

Note
  If you are looking for a information about accessing application's that implement this interface, have a look at the KIMProxy class.

Contacts are identified using unique identifier strings (UID) used by KABC, the KDE address book library. The UID generation is handled by KABC::Addressee so the your application will either have to access the address book or provide a possibility for associating a contact of your application with an entry of the address book.

Note
  one omission of this interface is the lack of control over the range of values used for protocols' names.

If you are implementing this interface, note that your application must have the following information in its desktop file, so that it can be identified as providing KIMIface at runtime:

X-DCOP-ServiceName=<application-name>
ServiceTypes=DCOP/InstantMessenger

and the class implementing KIMIface must pass "KIMIface" to the DCOPObject constructor:

// just need QObject inheritance and Q_OBJECT if you want signals and slots
// no need to use K_DCOP macro again
class MyIMIface : public QObject, public KIMIface
{
Q_OBJECT
public:
MyIMIface(QObject* parent = 0, const char* name) :
DCOPObject("KIMIface"), // <-- passing the interface name as required
QObject(parent, name) {}
};

The DCOP part of the interface needs to be processed by the DCOP IDL compiler. The KDE autotools framework will do this automatically, all you have to do is add kimiface.skel and kimiface.stub to the `SOURCES` list in your `Makefile.am`

See also
  KIMProxy
  KABC::AddressBook
  KABC::Addressee

Since
  3.3

Author
  Will Stephenson lists.nosp@m.@ste.nosp@m.vello.nosp@m..fre.nosp@m.e-onl.nosp@m.ine..nosp@m.co.uk

Definition at line 85 of file kimiface.h.

## Member Function Documentation

virtual bool KIMIface::addContact | ( | const QString & | contactId,
|  | const QString & | protocol
| ) |  |

pure virtual

Add a new contact given its protocol specific identifier.

Implementations might add the contact silently, including sending an authorization request if necessary, ask the user for confirmation or just prefill the usual contact addingGUI.

Parameters

  contactId | the protocol specific identifier for the contact e.g. UIN for ICQ, screenname for AIM, nick for IRC
  protocol | the IM protocol/service to use. See protocols()

Returns
  whether the add succeeded. `false` may signal already present, protocol not supported, or add operation not supported.

See also
  locate()
  protocols()
  messageNewContact()

virtual QStringList KIMIface::allContacts | ( |  | ) |

pure virtual

Obtain a list of IM-contacts that are known to the application.

Return a list of KABC UIDs of all the contacts you have such IDs for.

Returns
  a list of KABC UIDs known to the application

See also
  reachableContacts()
  onlineContacts()
  fileTransferContacts()
  isPresent()
  KABC::Addressee::uid()

virtual bool KIMIface::canReceiveFiles | ( | const QString & | uid | ) |

pure virtual

Indicate if a given contact can receive files.

Parameters

  uid | the KABC UID you want to the file transfer capability for

Returns
  whether the specified contact can receive files

See also
  fileTransferContacts()
  KABC::Addressee::uid()

virtual bool KIMIface::canRespond | ( | const QString & | uid | ) |

pure virtual

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.

Parameters

  uid | the KABC UID you are interested in

Returns
  whether the specified contact can respond

See also
  isPresent()
  KABC::Addressee::uid()

virtual void KIMIface::chatWithContact | ( | const QString & | uid | ) |

pure virtual

Start a chat session with the specified contact.

Applications that do not support a chat mode or when the IM-service of the given contact does not support it, this can also open a normal message input GUI.

Parameters

  uid | the KABC UID you want to chat with

See also
  messageContact()
  messageNewContact()
  sendFile()
  isPresent()
  reachableContacts()
  KABC::Addressee::uid()

virtual QString KIMIface::context | ( | const QString & | uid | ) |

pure virtual

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, just return `QString::null`

Parameters

  uid | the KABC UID you want the context for

Returns
  a string describing the context, or `QString::null` if not supported or if the contact is unknown

See also
  isPresent()
  KABC::Addressee::uid()

virtual QString KIMIface::displayName | ( | const QString & | uid | ) |

pure virtual

Obtain the IM app's idea of the contact's display name.

Useful if KABC lookups may be too slow. Should return whatever the application uses in its contact list or similar GUI, e.g. a nick name, a user configured name string, etc.

Parameters

  uid | the KABC UID you are interested in

Returns
  the corresponding display name or QString:null if the UID is unknown

See also
  isPresent()
  presenceString()
  presenceStatus()
  KABC::Addressee::uid()

virtual QStringList KIMIface::fileTransferContacts | ( |  | ) |

pure virtual

Obtain a list of IM-contacts who may receive file transfers.

Return a list of KABC UIDs of the contacts that are capable of receiving file transfers based on the IM-service they are associated with, i.e. if it is technically able to provide this, on their online state, i.e. can likely not receive files while offline, and perhaps even information your application has additionally, e.g. a user config that tells you that the contact is behind a firewall.

The simplest implementation is to return the same list as onlineContacts(), provided all the IM-services that are currently used support it.

Returns
  a list of KABC UIDs capable of file transfer

See also
  allContacts()
  reachableContacts()
  onlineContacts()
  canReceiveFiles()
  sendFile()
  KABC::Addressee::uid()

virtual QPixmap KIMIface::icon | ( | const QString & | uid | ) |

pure virtual

Obtain the icon representing the IM presence for the specified contact.

Return the image the application would use to display a contact's presence. The size and other properties of the image are currently unspecified.

Parameters

  uid | the KABC UID you want the presence icon for

Returns
  a pixmap representing the contact's presence or a null pixmap if the contact is unknown. See QPixmap::isNull()

See also
  isPresent()
  presenceString()
  presenceStatus()
  KABC::Addressee::uid()

virtual bool KIMIface::isPresent | ( | const QString & | uid | ) |

pure virtual

Confirm if a given contact is known to the IM application.

Check if you can map the given KABC UID to one if the IM-contacts, e.g. the would be part of the list returned by allContacts()

Parameters

  uid | the KABC UID you are interested in

Returns
  whether the program knows of this KABC UID

See also
  allContacts()
  presenceString()
  presenceStatus()
  KABC::Addressee::uid()

virtual QString KIMIface::locate | ( | const QString & | contactId,
|  | const QString & | protocol
| ) |  |

pure virtual

Obtain the KABC UID corresponding to the given IM address.

Parameters

  contactId | the protocol specific identifier for the contact, e.g. UIN for ICQ, screenname for AIM, nick for IRC
  protocol | the IM protocol/service to check. See protocols()

Returns
  the KABC UID for the given contact or `QString::null` if not found or either input stream was empty or the protocol is not supported

See also
  protocols()
  addContact()
  isPresent()
  KABC::Addressee::uid()

virtual void KIMIface::messageContact | ( | const QString & | uid,
|  | const QString & | message
| ) |  |

pure virtual

Send a single message to the specified contact.

Any response will be handled by the IM client as a normal conversation.

Implementations might send the message silently, ask the user for permission or just prefill the usual message input GUI.

Note
  As sending any text could potentially be a breach of the user's privacy it is recommended to let the user know about it.

Parameters

  uid | the KABC UID you want to send the message to
  message | the message text to send to the contact

See also
  messageNewContact()
  chatWithContact()
  sendFile()
  isPresent()
  reachableContacts()
  KABC::Addressee::uid()

virtual void KIMIface::messageNewContact | ( | const QString & | contactId,
|  | const QString & | protocol
| ) |  |

pure virtual

Send a single message to a contact given only its protocol specific identifier.

This could be used to send a message without having to know the KABC UID of the contact or without having to add it first.

Parameters

  contactId | the protocol specific identifier for the contact, e.g. UIN for ICQ, screenname for AIM, nick for IRC
  protocol | the IM protocol/service to check. See protocols()

See also
  messageContact()
  chatWithContact()
  sendFile()
  locate()
  protocols()
  addContact()

virtual QStringList KIMIface::onlineContacts | ( |  | ) |

pure virtual

Obtain a list of IM-contacts that are currently online.

Return a list of KABC UIDs of the contacts you have any presence information for that indicates that they are connected to the IM-service they are associated with.

Returns
  a list of KABC UIDs who are online with unspecified presence

See also
  allContacts()
  reachableContacts()
  fileTransferContacts()
  messageContact()
  chatWithContact()
  KABC::Addressee::uid()

virtual int KIMIface::presenceStatus | ( | const QString & | uid | ) |

pure virtual

Obtain the IM presence as a number for the specified contact.

Return one of the following values depending on the given contact's presence:

- 0 - `Unknown:` for contacts where you can not use any of the other values
- 1 - `Offline:` for contacts that are offline, i.e. not connected to their IM-service. If the application itself or the IM-service for the given contact is offline return `Unknown` instead
- 2 - `Connecting`
- 3 - `Away:` for contacts that are connected to their IM-service but not `Online`
- 4 - `Online`

Parameters

  uid | the KABC UID you want the presence for

Returns
  a numeric representation of presence - currently one of 0 (Unknown), 1 (Offline), 2 (Connecting), 3 (Away), 4 (Online). Returns 0 if the given UID is unknown

See also
  isPresent()
  presenceString()
  KABC::Addressee::uid()

virtual QString KIMIface::presenceString | ( | const QString & | uid | ) |

pure virtual

Obtain the IM presence as a i18ned string for the specified contact.

Return a translated string your application would use when displaying the contact's presence, e.g. i18n("Online"), i18n("Away")

Parameters

  uid | the KABC UID you want the presence for

Returns
  the i18ned string describing the contact's presence or QString::null if the UID is unknown

See also
  isPresent()
  presenceStatus()
  KABC::Addressee::uid()

virtual QStringList KIMIface::protocols | ( |  | ) |

pure virtual

Obtain a list of supported IM services/protocols.

Protocol names are currently of the form "protocol name" + "Protocol" for example:

- AIMProtocol: AOL instant messenger protocol
- MSNProtocol: Microsoft messanger protocol
- ICQProtocol: AOL (Mirabilis) ICQ protocol
- ....

The string is currently just an identifier to use with methods such as locate(), addContact() or messageNewContact()

Returns
  the set of protocols that the application supports

See also
  locate()
  addContact()
  messageNewContact

virtual QStringList KIMIface::reachableContacts | ( |  | ) |

pure virtual

Obtain a list of IM-contacts that are currently reachable.

Return a list of KABC UIDs of the contacts that are reachable in the sense that you are connected to the IM-service they are associated with.

For example if your application supports ICQ and AIM and the ICQ account is active but the AIM account isn't, return just the ICQ contacts.

Returns
  a list of KABC UIDs who can receive a message, even if offline

See also
  allContacts()
  onlineContacts()
  fileTransferContacts()
  messageContact()
  KABC::Addressee::uid()

virtual void KIMIface::sendFile | ( | const QString & | uid,
|  | const KURL & | sourceURL,
|  | const QString & | altFileName = `QString::null`,
|  | uint | fileSize = `0`
| ) |  |

pure virtual

Send a file to the contact.

Initiates a file transfer with the given contact if possible.

Implementations might start the transfer right away, ask the user's permission or just prefill the usual file transfer GUI.

Note
  As sending any file could potentially be a breach of the user's privacy it is recommended to let the user know about it.

Parameters

  uid | the KABC UID you want to send to
  sourceURL | a KURL pointing to the file to send
  altFileName | an alternate filename describing the file or a description or title
  fileSize | file size in bytes

See also
  messageContact()
  messageNewContact()
  chatWithContact()
  isPresent()
  fileTransferContacts()
  KABC::Addressee::uid()

The documentation for this class was generated from the following file:

- kimiface.h

KDE Home | KDE Accessibility Home | Description of Access Keys