gloox  1.0.1
Public Member Functions | List of all members
Manager Class Reference

#include <pubsubmanager.h>

Inheritance diagram for Manager:
Inheritance graph
[legend]

Public Member Functions

 Manager (ClientBase *parent)
virtual ~Manager ()
const std::string subscribe (const JID &service, const std::string &node, ResultHandler *handler, const JID &jid=JID(), SubscriptionObject type=SubscriptionNodes, int depth=1, const std::string &expire=EmptyString)
const std::string subscribe (const JID &service, const std::string &node, ResultHandler *handler, const JID &jid, DataForm *options)
const std::string unsubscribe (const JID &service, const std::string &node, const std::string &subid, ResultHandler *handler, const JID &jid=JID())
const std::string getSubscriptions (const JID &service, ResultHandler *handler)
const std::string getAffiliations (const JID &service, ResultHandler *handler)
const std::string getSubscriptionOptions (const JID &service, const JID &jid, const std::string &node, ResultHandler *handler, const std::string &subid=EmptyString)
const std::string setSubscriptionOptions (const JID &service, const JID &jid, const std::string &node, DataForm *df, ResultHandler *handler, const std::string &subid=EmptyString)
void getAffiliations (const JID &service, const std::string &node, ResultHandler *handler)
const std::string requestItems (const JID &service, const std::string &node, const std::string &subid, int maxItems, ResultHandler *handler)
const std::string requestItems (const JID &service, const std::string &node, const std::string &subid, const ItemList &items, ResultHandler *handler)
const std::string publishItem (const JID &service, const std::string &node, ItemList &items, DataForm *options, ResultHandler *handler)
const std::string deleteItem (const JID &service, const std::string &node, const ItemList &items, bool notify, ResultHandler *handler)
const std::string createNode (const JID &service, const std::string &node, DataForm *config, ResultHandler *handler)
const std::string deleteNode (const JID &service, const std::string &node, ResultHandler *handler)
const std::string getDefaultNodeConfig (const JID &service, NodeType type, ResultHandler *handler)
const std::string purgeNode (const JID &service, const std::string &node, ResultHandler *handler)
const std::string getSubscribers (const JID &service, const std::string &node, ResultHandler *handler)
const std::string setSubscribers (const JID &service, const std::string &node, const SubscriberList &list, ResultHandler *handler)
const std::string getAffiliates (const JID &service, const std::string &node, ResultHandler *handler)
const std::string setAffiliates (const JID &service, const std::string &node, const AffiliateList &list, ResultHandler *handler)
const std::string getNodeConfig (const JID &service, const std::string &node, ResultHandler *handler)
const std::string setNodeConfig (const JID &service, const std::string &node, DataForm *config, ResultHandler *handler)
bool removeID (const std::string &id)
virtual bool handleIq (const IQ &iq)
virtual void handleIqID (const IQ &iq, int context)
- Public Member Functions inherited from IqHandler
virtual ~IqHandler ()

Detailed Description

This manager is used to interact with PubSub services (XEP-0060).

Note
PubSub support in gloox is still relatively young and you are most welcome to ask questions, criticize the API and so on.

A ResultHandler is used to receive a request's result. Depending on the context, this can be a notification that an item has been succesfully deleted (or not), or the default node configuration for a service.

To receive PubSub events:

To interact with PubSub services, you will need to instantiate a PubSub::Manager and implement the ResultHandler virtual interfaces to be notified of the result of requests.

Note
A null ResultHandler to a query is not allowed and is a no-op.

XEP Version: 1.12

Author
Jakob Schroeter js@ca.nosp@m.maya.nosp@m..net
Vincent Thomasset vthom.nosp@m.asse.nosp@m.t@gma.nosp@m.il.c.nosp@m.om
Since
1.0

Definition at line 78 of file pubsubmanager.h.

Constructor & Destructor Documentation

Manager ( ClientBase parent)

Initialize the manager.

Parameters
parentClient to which this manager belongs.

Definition at line 570 of file pubsubmanager.cpp.

virtual ~Manager ( )
inlinevirtual

Default virtual destructor.

Definition at line 91 of file pubsubmanager.h.

Member Function Documentation

const std::string createNode ( const JID service,
const std::string &  node,
DataForm config,
ResultHandler handler 
)

Creates a new node.

Parameters
serviceService where to create the new node.
nodeThe ID of the new node.
configAn optional DataForm that holds the node configuration. The DataForm will be owned and deleted by the Manager.
handlerThe handler to handle the result.
Returns
The ID used in the request.
See Also
ResultHandler::handleNodeCreation

Definition at line 817 of file pubsubmanager.cpp.

const std::string deleteItem ( const JID service,
const std::string &  node,
const ItemList &  items,
bool  notify,
ResultHandler handler 
)

Delete an item from a node.

Parameters
serviceService hosting the node.
nodeID of the node to delete the item from.
itemsA list of items to delete (only ID filled in).
notifyWhether or not to notify subscribers about the deletion.
handlerThe handler to handle the result.
Returns
The ID used in the request.
See Also
ResultHandler::handleItemDeletation

Definition at line 793 of file pubsubmanager.cpp.

const std::string deleteNode ( const JID service,
const std::string &  node,
ResultHandler handler 
)

Deletes a node.

Parameters
serviceService where to create the new node.
nodeNode ID of the new node.
handlerThe handler to handle the result.
Returns
The ID used in the request.
See Also
ResultHandler::handleNodeDeletion

Definition at line 840 of file pubsubmanager.cpp.

const std::string getAffiliates ( const JID service,
const std::string &  node,
ResultHandler handler 
)
inline

Requests the affiliate list for a node.

Parameters
serviceService to query.
nodeNode ID of the node.
handlerResultHandler.
Returns
The ID used in the request.
See Also
ResultHandler::handleAffiliates

Definition at line 413 of file pubsubmanager.h.

const std::string getAffiliations ( const JID service,
ResultHandler handler 
)
inline

Requests the affiliation list from a service.

Parameters
serviceService to query.
handlerThe ResultHandler to handle the result.
Returns
The IQ ID used in the request.
See Also
ResultHandler::handleAffiliations

Definition at line 179 of file pubsubmanager.h.

void getAffiliations ( const JID service,
const std::string &  node,
ResultHandler handler 
)

Requests the affiliation list for a node.

Parameters
serviceService to query.
nodeNode ID of the node.
handlerThe AffiliationListHandler to handle the result.
See Also
ResultHandler::handleAffiliations
const std::string getDefaultNodeConfig ( const JID service,
NodeType  type,
ResultHandler handler 
)

Retrieves the default configuration for a specific NodeType.

Parameters
serviceThe queried service.
typeNodeType to get default configuration for.
handlerResultHandler.
Returns
The ID used in the request.
See Also
ResultHandler::handleDefaultNodeConfig

Definition at line 861 of file pubsubmanager.cpp.

const std::string getNodeConfig ( const JID service,
const std::string &  node,
ResultHandler handler 
)
inline

Retrieve the configuration (options) of a node.

Parameters
serviceService hosting the node.
nodeID of the node.
handlerResultHandler responsible to handle the request result.
Returns
The ID used in the request.
See Also
ResultHandler::handleNodeConfig

Definition at line 448 of file pubsubmanager.h.

const std::string getSubscribers ( const JID service,
const std::string &  node,
ResultHandler handler 
)
inline

Requests the subscriber list for a node.

Parameters
serviceService to query.
nodeNode ID of the node.
handlerResultHandler.
Returns
The ID used in the request.
See Also
ResultHandler::handleSubscribers

Definition at line 377 of file pubsubmanager.h.

const std::string getSubscriptionOptions ( const JID service,
const JID jid,
const std::string &  node,
ResultHandler handler,
const std::string &  subid = EmptyString 
)
inline

Requests subscription options.

Parameters
serviceService to query.
jidSubscribed entity.
nodeNode ID of the node.
handlerThe SubscriptionListHandler to handle the result.
subidAn optional subscription ID.
Returns
The IQ ID used in the request.
See Also
ResultHandler::handleSubscriptionOptions

Definition at line 199 of file pubsubmanager.h.

const std::string getSubscriptions ( const JID service,
ResultHandler handler 
)
inline

Requests the subscription list from a service.

Parameters
serviceService to query.
handlerThe ResultHandler to handle the result.
Returns
The IQ ID used in the request.
See Also
ResultHandler::handleSubscriptions

Definition at line 162 of file pubsubmanager.h.

virtual bool handleIq ( const IQ iq)
inlinevirtual

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

Parameters
iqThe complete IQ 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.
Since
1.0

Implements IqHandler.

Definition at line 490 of file pubsubmanager.h.

void handleIqID ( const IQ iq,
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.

Parameters
iqThe complete IQ stanza.
contextA value to restore context, stored with ClientBase::trackID().
Note
Only IQ stanzas of type 'result' or 'error' can arrive here.
Since
1.0

Implements IqHandler.

Definition at line 993 of file pubsubmanager.cpp.

const std::string publishItem ( const JID service,
const std::string &  node,
ItemList &  items,
DataForm options,
ResultHandler handler 
)

Publish an item to a node. The Tag to publish is destroyed by the function before returning.

Parameters
serviceService hosting the node.
nodeID of the node to delete the item from.
itemsOne or more items to publish. The items will be owned and deleted by the Manager, even in the error case (empty string returned).
optionsAn optional DataForm containing publish options. The DataForm will be owned and deleted by the Manager.
handlerThe handler to handle the result.
Returns
The ID used in the request.
See Also
ResultHandler::handleItemPublication

Definition at line 766 of file pubsubmanager.cpp.

const std::string purgeNode ( const JID service,
const std::string &  node,
ResultHandler handler 
)

Removes all the items from a node.

Parameters
serviceService to query.
nodeNode ID of the node.
handlerResultHandler.
Returns
The ID used in the request.
See Also
ResultHandler::handleNodePurge

Definition at line 958 of file pubsubmanager.cpp.

bool removeID ( const std::string &  id)

Removes an ID from our tracking lists.

Parameters
idThe ID to remove.
Returns
True if the ID was found and removed, false otherwise.

Definition at line 979 of file pubsubmanager.cpp.

const std::string requestItems ( const JID service,
const std::string &  node,
const std::string &  subid,
int  maxItems,
ResultHandler handler 
)

Requests items from a node.

Parameters
serviceService to query.
nodeNode ID of the node.
subidAn optional subscription ID.
maxItemsThe optional maximum number of items to return.
handlerThe handler to handle the result.
Returns
The ID used in the request.

Definition at line 718 of file pubsubmanager.cpp.

const std::string requestItems ( const JID service,
const std::string &  node,
const std::string &  subid,
const ItemList &  items,
ResultHandler handler 
)

Requests specific items from a node.

Parameters
serviceService to query.
nodeNode ID of the node.
subidAn optional subscription ID.
itemsThe list of item IDs to request.
handlerThe handler to handle the result.
Returns
The ID used in the request.

Definition at line 742 of file pubsubmanager.cpp.

const std::string setAffiliates ( const JID service,
const std::string &  node,
const AffiliateList &  list,
ResultHandler handler 
)
inline

Modifies the affiliate list for a node.

Parameters
serviceService to query.
nodeNode ID of the node.
listResultHandler.
handlerResultHandler.
Returns
The ID used in the request.
See Also
ResultHandler::handleAffiliatesResult

Definition at line 431 of file pubsubmanager.h.

const std::string setNodeConfig ( const JID service,
const std::string &  node,
DataForm config,
ResultHandler handler 
)
inline

Changes a node's configuration (options).

Parameters
serviceService to query.
nodeNode ID of the node.
configThe node's configuration DataForm.
handlerResultHandler responsible to handle the request result.
Returns
The ID used in the request.
See Also
ResultHandler::handleNodeConfigResult

Definition at line 464 of file pubsubmanager.h.

const std::string setSubscribers ( const JID service,
const std::string &  node,
const SubscriberList &  list,
ResultHandler handler 
)
inline

Modifies the subscriber list for a node. This function SHOULD only set the subscriber list to those which needs modification.

Parameters
serviceService to query.
nodeNode ID of the node.
listThe subscriber list.
handlerThe ResultHandler.
Returns
The ID used in the request.
See Also
ResultHandler::handleSubscribers

Definition at line 396 of file pubsubmanager.h.

const std::string setSubscriptionOptions ( const JID service,
const JID jid,
const std::string &  node,
DataForm df,
ResultHandler handler,
const std::string &  subid = EmptyString 
)
inline

Modifies subscription options.

Parameters
serviceService to query.
jidSubscribed entity.
nodeNode ID of the node.
dfNew configuration. The DataForm will be owned and deleted by the Manager.
handlerThe handler to handle the result.
subidAn optional subscription ID.
Returns
The IQ ID used in the request.
See Also
ResultHandler::handleSubscriptionOptionsResult

Definition at line 219 of file pubsubmanager.h.

const std::string subscribe ( const JID service,
const std::string &  node,
ResultHandler handler,
const JID jid = JID(),
SubscriptionObject  type = SubscriptionNodes,
int  depth = 1,
const std::string &  expire = EmptyString 
)

Subscribe to a node.

Parameters
serviceService hosting the node.
nodeID of the node to subscribe to.
handlerThe ResultHandler.
jidJID to subscribe. If empty, the client's JID will be used (ie. self subscription).
typeSubscriptionType of the subscription (Collections only).
depthSubscription depth. For 'all', use 0 (Collections only).
expireSubscription expiry. Defaults to the empty string.
Returns
The IQ ID used in the request.
See Also
ResultHandler::handleSubscriptionResult

Definition at line 599 of file pubsubmanager.cpp.

const std::string subscribe ( const JID service,
const std::string &  node,
ResultHandler handler,
const JID jid,
DataForm options 
)

Subscribe to a node and configure options.

Parameters
serviceService hosting the node.
nodeID of the node to subscribe to.
handlerThe ResultHandler.
jidJID to subscribe. If empty, the client's JID will be used (ie. self subscription).
optionsThe options to configure while subscribing. Should be a TypeSubmit form, with a field named FORM_TYPE having the value http://jabber.org/protocol/pubsub#subscribe_options See XEP-0060, "Subscribe and Configure". Will be owned and deleted by the PubSub object.
Returns
The IQ ID used in the request.
See Also
ResultHandler::handleSubscriptionResult

Definition at line 639 of file pubsubmanager.cpp.

const std::string unsubscribe ( const JID service,
const std::string &  node,
const std::string &  subid,
ResultHandler handler,
const JID jid = JID() 
)

Unsubscribe from a node.

Parameters
serviceService hosting the node.
nodeID of the node to unsubscribe from.
subidAn optional, additional subscription ID.
handlerResultHandler receiving the result notification.
jidJID to unsubscribe. If empty, the client's JID will be used (ie self unsubscription).
Returns
The IQ ID used in the request.
See Also
ResultHandler::handleUnsubscriptionResult

Definition at line 666 of file pubsubmanager.cpp.


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