#include <disco.h>
Inherits IqHandler.
Inheritance diagram for Disco:
Public Member Functions | |
void | addFeature (const std::string &feature) |
const StringList & | features () const |
void | getDiscoInfo (const std::string &to, const std::string &node, DiscoHandler *dh, int context) |
void | getDiscoItems (const std::string &to, const std::string &node, DiscoHandler *dh, int context) |
void | setVersion (const std::string &name, const std::string &version, const std::string &os="") |
void | setIdentity (const std::string &category, const std::string &type) |
void | registerDiscoHandler (DiscoHandler *dh) |
void | removeDiscoHandler (DiscoHandler *dh) |
void | registerNodeHandler (DiscoNodeHandler *nh, const std::string &node) |
void | removeNodeHandler (const std::string &node) |
virtual bool | handleIq (Stanza *stanza) |
virtual bool | handleIqID (Stanza *stanza, int context) |
Friends | |
class | Client |
class | Component |
Client and Component will automatically instantiate a Disco obejct. It can be used to announce special features of your client, or its version, or...
Definition at line 43 of file disco.h.
void addFeature | ( | const std::string & | feature | ) |
Adds a feature to the list of supported Jabber features. The list will be posted as an answer to IQ queries in the "http://jabber.org/protocol/disco#info" namespace. These IQ packets will also be forwarded to the application's IqHandler, if it listens to the disco#info namespace. You can call Client::disableDisco() to disable automatic disco entirely. By default, disco(very) queries are handled by the library. By default, all supported, not disabled features are announced.
feature | A feature (namespace) the host app supports. |
Definition at line 222 of file disco.cpp.
Referenced by Adhoc::Adhoc(), InBandBytestreamManager::InBandBytestreamManager(), LastActivity::LastActivity(), and VCardManager::VCardManager().
const StringList& features | ( | ) | const [inline] |
Lets you retrieve the features this Disco instance supports.
Definition at line 68 of file disco.h.
Referenced by Disco::handleIq().
void getDiscoInfo | ( | const std::string & | to, | |
const std::string & | node, | |||
DiscoHandler * | dh, | |||
int | context | |||
) |
Queries the given JID for general infomation according to JEP-0030 (Service Discovery). To receive the results inherit from DiscoHandler and register with the Disco object.
to | The destination-JID of the query. | |
node | An optional node to query. Not inserted if empty. | |
dh | The DiscoHandler to notify about results. | |
context | A context identifier. |
Definition at line 227 of file disco.cpp.
Referenced by FlexibleOffline::checkSupport(), and FlexibleOffline::getMsgCount().
void getDiscoItems | ( | const std::string & | to, | |
const std::string & | node, | |||
DiscoHandler * | dh, | |||
int | context | |||
) |
Queries the given JID for its items according to JEP-0030 (Service Discovery). To receive the results inherit from DiscoHandler and register with the Disco object.
to | The destination-JID of the query. | |
node | An optional node to query. Not inserted if empty. | |
dh | The DiscoHandler to notify about results. | |
context | A context identifier. |
Definition at line 249 of file disco.cpp.
Referenced by FlexibleOffline::fetchHeaders().
void setVersion | ( | const std::string & | name, | |
const std::string & | version, | |||
const std::string & | os = "" | |||
) |
Sets the version of the host application using this library. The library takes care of jabber:iq:version requests. These IQ packets will not be forwarded to the IqHandlers.
name | The name to be returned to inquireing clients. | |
version | The version to be returned to inquireing clients. | |
os | The operating system to announce. Default: don't include. |
Definition at line 271 of file disco.cpp.
Referenced by Component::Component().
void setIdentity | ( | const std::string & | category, | |
const std::string & | type | |||
) |
Sets the identity of this entity. The library uses this information to answer disco::info requests with a correct identity. JEP-0030 requires an entity to have at least one identity. See JEP-0030 for more information on categories and types.
category | The entity category of this client. Default: client | |
type | The type of this entity. Default: bot |
Definition at line 278 of file disco.cpp.
Referenced by Component::Component().
void registerDiscoHandler | ( | DiscoHandler * | dh | ) |
Use this function to register an DiscoHandler with the Disco object. This is only necessary if you want to receive Disco-set requests. Else a one-time registration happens when calling getDiscoInfo() and getDiscoItems(), respectively.
dh | The DiscoHandler-derived object to register. |
void removeDiscoHandler | ( | DiscoHandler * | dh | ) |
Unregisters the given DiscoHandler.
dh | The DiscoHandler to unregister. |
void registerNodeHandler | ( | DiscoNodeHandler * | nh, | |
const std::string & | node | |||
) |
Use this function to register an DiscoNodeHandler with the Disco object. The DiscoNodeHandler will receive disco::items queries which are directed to the corresponding node registered for the handler. Only one handler per node is possible.
nh | The NodeHandler-derived object to register. | |
node | The node name to associate with this handler. |
Definition at line 294 of file disco.cpp.
Referenced by Adhoc::Adhoc(), and Adhoc::registerAdhocCommandProvider().
void removeNodeHandler | ( | const std::string & | node | ) |
Removes the node handler.
node | The node for which the handler shall be removed. |
Definition at line 299 of file disco.cpp.
Referenced by Adhoc::removeAdhocCommandProvider(), and Adhoc::~Adhoc().
bool handleIq | ( | Stanza * | stanza | ) | [virtual] |
Reimplement this function if you want to be notified about incoming IQs.
stanza | The complete Stanza. |
Implements IqHandler.
bool handleIqID | ( | Stanza * | stanza, | |
int | context | |||
) | [virtual] |
Reimplement this function if you want to be notified about incoming IQs with a specific value of the id
attribute. You have to enable tracking of those IDs using Client::trackID()
. This is usually useful for IDs that generate a positive reply, i.e. <iq type='result' id='reg'/> where a namespace filter wouldn't work.
stanza | The complete Stanza. | |
context | A value to restore context, stored with ClientBase::trackID(). |
Implements IqHandler.