gloox
1.0.16
|
#include <pubsubmanager.h>
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 () |
This manager is used to interact with PubSub services (XEP-0060).
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.
XEP Version: 1.12
Definition at line 78 of file pubsubmanager.h.
Manager | ( | ClientBase * | parent | ) |
Initialize the manager.
parent | Client to which this manager belongs. |
Definition at line 581 of file pubsubmanager.cpp.
|
inlinevirtual |
Default virtual destructor.
Definition at line 91 of file pubsubmanager.h.
const std::string createNode | ( | const JID & | service, |
const std::string & | node, | ||
DataForm * | config, | ||
ResultHandler * | handler | ||
) |
Creates a new node.
service | Service where to create the new node. |
node | The ID of the new node. |
config | An optional DataForm that holds the node configuration. The DataForm will be owned and deleted by the Manager. |
handler | The handler to handle the result. |
Definition at line 828 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.
service | Service hosting the node. |
node | ID of the node to delete the item from. |
items | A list of items to delete (only ID filled in). |
notify | Whether or not to notify subscribers about the deletion. |
handler | The handler to handle the result. |
Definition at line 804 of file pubsubmanager.cpp.
const std::string deleteNode | ( | const JID & | service, |
const std::string & | node, | ||
ResultHandler * | handler | ||
) |
Deletes a node.
service | Service where to create the new node. |
node | Node ID of the new node. |
handler | The handler to handle the result. |
Definition at line 851 of file pubsubmanager.cpp.
|
inline |
Requests the affiliate list for a node.
service | Service to query. |
node | Node ID of the node. |
handler | ResultHandler. |
Definition at line 413 of file pubsubmanager.h.
|
inline |
Requests the affiliation list from a service.
service | Service to query. |
handler | The ResultHandler to handle the result. |
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.
service | Service to query. |
node | Node ID of the node. |
handler | The AffiliationListHandler to handle the result. |
const std::string getDefaultNodeConfig | ( | const JID & | service, |
NodeType | type, | ||
ResultHandler * | handler | ||
) |
Retrieves the default configuration for a specific NodeType.
service | The queried service. |
type | NodeType to get default configuration for. |
handler | ResultHandler. |
Definition at line 872 of file pubsubmanager.cpp.
|
inline |
Retrieve the configuration (options) of a node.
service | Service hosting the node. |
node | ID of the node. |
handler | ResultHandler responsible to handle the request result. |
Definition at line 448 of file pubsubmanager.h.
|
inline |
Requests the subscriber list for a node.
service | Service to query. |
node | Node ID of the node. |
handler | ResultHandler. |
Definition at line 377 of file pubsubmanager.h.
|
inline |
Requests subscription options.
service | Service to query. |
jid | Subscribed entity. |
node | Node ID of the node. |
handler | The SubscriptionListHandler to handle the result. |
subid | An optional subscription ID. |
Definition at line 199 of file pubsubmanager.h.
|
inline |
Requests the subscription list from a service.
service | Service to query. |
handler | The ResultHandler to handle the result. |
Definition at line 162 of file pubsubmanager.h.
|
inlinevirtual |
Reimplement this function if you want to be notified about incoming IQs.
iq | The complete IQ stanza. |
Implements IqHandler.
Definition at line 490 of file pubsubmanager.h.
|
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.
Definition at line 1005 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.
service | Service hosting the node. |
node | ID of the node to delete the item from. |
items | One or more items to publish. The items will be owned and deleted by the Manager, even in the error case (empty string returned). |
options | An optional DataForm containing publish options. The DataForm will be owned and deleted by the Manager. |
handler | The handler to handle the result. |
Definition at line 777 of file pubsubmanager.cpp.
const std::string purgeNode | ( | const JID & | service, |
const std::string & | node, | ||
ResultHandler * | handler | ||
) |
Removes all the items from a node.
service | Service to query. |
node | Node ID of the node. |
handler | ResultHandler. |
Definition at line 970 of file pubsubmanager.cpp.
bool removeID | ( | const std::string & | id | ) |
Removes an ID from our tracking lists.
id | The ID to remove. |
Definition at line 991 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.
service | Service to query. |
node | Node ID of the node. |
subid | An optional subscription ID. |
maxItems | The optional maximum number of items to return. |
handler | The handler to handle the result. |
Definition at line 729 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.
service | Service to query. |
node | Node ID of the node. |
subid | An optional subscription ID. |
items | The list of item IDs to request. |
handler | The handler to handle the result. |
Definition at line 753 of file pubsubmanager.cpp.
|
inline |
Modifies the affiliate list for a node.
service | Service to query. |
node | Node ID of the node. |
list | ResultHandler. |
handler | ResultHandler. |
Definition at line 431 of file pubsubmanager.h.
|
inline |
Changes a node's configuration (options).
service | Service to query. |
node | Node ID of the node. |
config | The node's configuration DataForm. |
handler | ResultHandler responsible to handle the request result. |
Definition at line 464 of file pubsubmanager.h.
|
inline |
Modifies the subscriber list for a node. This function SHOULD only set the subscriber list to those which needs modification.
service | Service to query. |
node | Node ID of the node. |
list | The subscriber list. |
handler | The ResultHandler. |
Definition at line 396 of file pubsubmanager.h.
|
inline |
Modifies subscription options.
service | Service to query. |
jid | Subscribed entity. |
node | Node ID of the node. |
df | New configuration. The DataForm will be owned and deleted by the Manager. |
handler | The handler to handle the result. |
subid | An optional subscription ID. |
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.
service | Service hosting the node. |
node | ID of the node to subscribe to. |
handler | The ResultHandler. |
jid | JID to subscribe. If empty, the client's JID will be used (ie. self subscription). |
type | SubscriptionType of the subscription (Collections only). |
depth | Subscription depth. For 'all', use 0 (Collections only). |
expire | Subscription expiry. Defaults to the empty string. |
Definition at line 610 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.
service | Service hosting the node. |
node | ID of the node to subscribe to. |
handler | The ResultHandler. |
jid | JID to subscribe. If empty, the client's JID will be used (ie. self subscription). |
options | The 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. |
Definition at line 650 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.
service | Service hosting the node. |
node | ID of the node to unsubscribe from. |
subid | An optional, additional subscription ID. |
handler | ResultHandler receiving the result notification. |
jid | JID to unsubscribe. If empty, the client's JID will be used (ie self unsubscription). |
Definition at line 677 of file pubsubmanager.cpp.