Adhoc Class Reference

This class implements a provider for JEP-0050 (Ad-hoc Commands). More...

#include <adhoc.h>

Inherits DiscoNodeHandler, and IqHandler.

Inheritance diagram for Adhoc:

Inheritance graph
[legend]
Collaboration diagram for Adhoc:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Adhoc (ClientBase *parent, Disco *disco)
virtual ~Adhoc ()
virtual StringList handleDiscoNodeFeatures (const std::string &node)
virtual StringMap handleDiscoNodeIdentities (const std::string &node, std::string &name)
virtual StringMap handleDiscoNodeItems (const std::string &node)
virtual bool handleIq (Stanza *stanza)
virtual bool handleIqID (Stanza *, int)
void registerAdhocCommandProvider (AdhocCommandProvider *acp, const std::string &command, const std::string &name)

Detailed Description

This class implements a provider for JEP-0050 (Ad-hoc Commands).

Author:
Jakob Schroeter <js@camaya.net>

Definition at line 38 of file adhoc.h.


Constructor & Destructor Documentation

Adhoc ClientBase parent,
Disco disco
 

Constructor. Creates a new Adhoc client that registers as IqHandler with a ClientBase.

Parameters:
parent The ClientBase used for XMPP communication.
disco The Disco object used to announce available commands.

Definition at line 23 of file adhoc.cpp.

References Disco::addFeature(), ClientBase::registerIqHandler(), and Disco::registerNodeHandler().

~Adhoc  )  [virtual]
 

Virtual destructor.

Definition at line 34 of file adhoc.cpp.

References ClientBase::removeIqHandler(), and Disco::removeNodeHandler().


Member Function Documentation

StringList handleDiscoNodeFeatures const std::string &  node  )  [virtual]
 

In addition to handleDiscoNodeIdentities, this function is used to gather more information on a specific node. It is called when a disco::info query arrives with a node attribute that matches the one registered for this handler.

Parameters:
node The node this handler is supposed to handle.
Returns:
A list of features supported by this node.

Implements DiscoNodeHandler.

Definition at line 43 of file adhoc.cpp.

StringMap handleDiscoNodeIdentities const std::string &  node,
std::string &  name
[virtual]
 

In addition to handleDiscoNodeFeatures, this function is used to gather more information on a specific node. It is called when a disco::info query arrives with a node attribute that matches the one registered for this handler.

Parameters:
node The node this handler is supposed to handle.
name This parameter is currently used as additional return value. Just fill in the name of the node.
Returns:
A map of identities for the given node. The first string is the category specifier, the second string is the type specifier.

Implements DiscoNodeHandler.

Definition at line 69 of file adhoc.cpp.

StringMap handleDiscoNodeItems const std::string &  node  )  [virtual]
 

This function is used to gather more information on a specific node. It is called when a disco::items query arrives with a node attribute that matches the one registered for this handler. If node is empty, items for the root node (no node) shall be returned.

Parameters:
node The node this handler is supposed to handle.
Returns:
A map of items supported by this node. The first string is the item's node specifier, the second string is the items natural-language name.

Implements DiscoNodeHandler.

Definition at line 50 of file adhoc.cpp.

bool handleIq Stanza stanza  )  [virtual]
 

Reimplement this function if you want to be notified about incoming IQs.

Parameters:
stanza The complete Stanza.
Returns:
Indicates whether a request of type 'get' or 'set' has been handled. This includes the obligatory 'result' answer. If you return false, a 'error' will be sent.

Implements IqHandler.

Definition at line 86 of file adhoc.cpp.

References Tag::findAttribute(), Tag::findChild(), and Tag::hasChild().

virtual bool handleIqID Stanza ,
int 
[inline, 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.

Parameters:
stanza The complete Stanza.
context A value to restore context, stored with ClientBase::trackID().
Returns:
Indicates whether a request of type 'get' or 'set' has been handled. This includes the obligatory 'result' answer. If you return false, a 'error' will be sent.

Implements IqHandler.

Definition at line 67 of file adhoc.h.

void registerAdhocCommandProvider AdhocCommandProvider acp,
const std::string &  command,
const std::string &  name
 

Using this function, you can register a AdhocCommandProvider -derived object as handler for a specific Ad-hoc Command as defined in JEP-0050.

Parameters:
acp The obejct to register as handler for the specified command.
command The node name of the command. Will be announced in disco::items.
name The natural-language name of the command. Will be announced in disco::items.

Definition at line 102 of file adhoc.cpp.

References Disco::registerNodeHandler().


The documentation for this class was generated from the following files:
Generated on Mon Jan 16 16:19:55 2006 for gloox by  doxygen 1.4.6