gloox
1.0
|
#include <disco.h>
Classes | |
class | Identity |
An abstraction of a Disco identity (Service Discovery, XEP-0030). More... | |
class | Info |
An abstraction of a Disco Info element (from Service Discovery, XEP-0030) as a StanzaExtension. More... | |
class | Item |
An abstraction of a Disco item (Service Discovery, XEP-0030). More... | |
class | Items |
An abstraction of a Disco query element (from Service Discovery, XEP-0030) in the disco::items namespace, implemented as a StanzaExtension. More... |
Public Types | |
typedef std::list< Identity * > | IdentityList |
typedef std::list< Item * > | ItemList |
Public Member Functions | |
void | addFeature (const std::string &feature) |
void | removeFeature (const std::string &feature) |
const StringList | features (bool defaultFeatures=false) const |
void | getDiscoInfo (const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString) |
void | getDiscoItems (const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString) |
void | setVersion (const std::string &name, const std::string &version, const std::string &os=EmptyString) |
const std::string & | name () const |
const std::string & | version () const |
const std::string & | os () const |
void | setIdentity (const std::string &category, const std::string &type, const std::string &name=EmptyString) |
void | addIdentity (const std::string &category, const std::string &type, const std::string &name=EmptyString) |
const IdentityList & | identities () const |
void | setForm (DataForm *form) |
const DataForm * | form () const |
void | registerDiscoHandler (DiscoHandler *dh) |
void | removeDiscoHandler (DiscoHandler *dh) |
void | registerNodeHandler (DiscoNodeHandler *nh, const std::string &node) |
void | removeNodeHandler (DiscoNodeHandler *nh, const std::string &node) |
void | removeNodeHandlers (DiscoNodeHandler *nh) |
virtual bool | handleIq (const IQ &iq) |
virtual void | handleIqID (const IQ &iq, int context) |
Public Member Functions inherited from IqHandler | |
virtual | ~IqHandler () |
This class implements XEP-0030 (Service Discovery) and XEP-0092 (Software Version).
ClientBase will automatically instantiate a Disco object. It can be used to announce special features of your client, or its version, or...
XEP version: 2.2
typedef std::list<Identity*> IdentityList |
A list of pointers to Identity objects. Used with Disco::Info.
A list of pointers to Item objects. Used with Disco::Items.
|
inline |
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. 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. |
disco#info
queries, use registerNodeHandler().
|
inline |
const StringList features | ( | bool | defaultFeatures = false | ) | const |
|
inline |
|
inline |
Queries the given JID for general infomation according to XEP-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. |
tid | An optional id that is going to be used as the IQ request's id. Only necessary if you need to know the request's id. |
|
inline |
Queries the given JID for its items according to XEP-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. |
tid | An optional id that is going to be used as the IQ request's id. Only necessary if you need to know the request's id. |
|
virtual |
Reimplement this function if you want to be notified about incoming IQs.
iq | The complete IQ stanza. |
Implements IqHandler.
|
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.
iq | The complete IQ stanza. |
context | A value to restore context, stored with ClientBase::trackID(). |
Implements IqHandler.
|
inline |
|
inline |
|
inline |
|
inline |
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 registerNodeHandler | ( | DiscoNodeHandler * | nh, |
const std::string & | node | ||
) |
Use this function to register a DiscoNodeHandler with the Disco object. The DiscoNodeHandler will receive disco::items queries which are directed to the corresponding node registered for the handler.
nh | The NodeHandler-derived object to register. |
node | The node name to associate with this handler. Use an empty string to register for the root node. |
void removeDiscoHandler | ( | DiscoHandler * | dh | ) |
Unregisters the given DiscoHandler.
dh | The DiscoHandler to unregister. |
|
inline |
void removeNodeHandler | ( | DiscoNodeHandler * | nh, |
const std::string & | node | ||
) |
void removeNodeHandlers | ( | DiscoNodeHandler * | nh | ) |
void setForm | ( | DataForm * | form | ) |
Adds an optional DataForm to Disco:Info replies, e.g. for XEP-0232. Only one form can be added at this point.
form | An optional DataForm to include in the Info reply. The form will be owned by and deleted on destruction of the Disco object. |
void setIdentity | ( | const std::string & | category, |
const std::string & | type, | ||
const std::string & | name = EmptyString |
||
) |
Sets the identity of this entity. The library uses this information to answer disco::info requests with a correct identity. XEP-0030 requires an entity to have at least one identity. See XEP-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. |
name | The name of the entity. Default: empty. |
void setVersion | ( | const std::string & | name, |
const std::string & | version, | ||
const std::string & | os = EmptyString |
||
) |
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. |
|
inline |