gloox  0.9.9.12
Public Member Functions | List of all members
RosterManager Class Reference

#include <rostermanager.h>

Inheritance diagram for RosterManager:
Inheritance graph
[legend]
Collaboration diagram for RosterManager:
Collaboration graph
[legend]

Public Member Functions

 RosterManager (ClientBase *parent)
virtual ~RosterManager ()
void fill ()
Rosterroster ()
void subscribe (const JID &jid, const std::string &name="", const StringList &groups=StringList(), const std::string &msg="")
void synchronize ()
void add (const JID &jid, const std::string &name, const StringList &groups)
void unsubscribe (const JID &jid, const std::string &msg="")
void cancel (const JID &jid, const std::string &msg="")
void remove (const JID &jid)
void ackSubscriptionRequest (const JID &to, bool ack)
const std::string & delimiter () const
void setDelimiter (const std::string &delimiter)
RosterItemgetRosterItem (const JID &jid)
void registerRosterListener (RosterListener *rl, bool syncSubscribeReq=true)
void removeRosterListener ()
virtual bool handleIq (Stanza *stanza)
virtual bool handleIqID (Stanza *stanza, int context)
virtual void handlePresence (Stanza *stanza)
virtual void handleSubscription (Stanza *stanza)
virtual void handlePrivateXML (const std::string &tag, Tag *xml)
virtual void handlePrivateXMLResult (const std::string &uid, PrivateXMLResult pxResult)
- Public Member Functions inherited from IqHandler
virtual ~IqHandler ()
- Public Member Functions inherited from PresenceHandler
virtual ~PresenceHandler ()
- Public Member Functions inherited from SubscriptionHandler
virtual ~SubscriptionHandler ()
- Public Member Functions inherited from PrivateXMLHandler
virtual ~PrivateXMLHandler ()

Additional Inherited Members

- Public Types inherited from PrivateXMLHandler
enum  PrivateXMLResult { PxmlStoreOk, PxmlStoreError, PxmlRequestError }

Detailed Description

This class implements Jabber/XMPP roster handling in the jabber:iq:roster namespace.

It takes care of changing presence, subscriptions, etc. You can modify any number of RosterItems within the Roster at any time. These changes must be synchronized with the server by calling synchronize(). Note that incoming Roster pushes initiated by other resources may overwrite changed values. Additionally, XEP-0083 (Nested Roster Groups) is implemented herein.

Author
Jakob Schroeter js@ca.nosp@m.maya.nosp@m..net
Since
0.3

Definition at line 47 of file rostermanager.h.

Constructor & Destructor Documentation

RosterManager ( ClientBase parent)

Creates a new RosterManager.

Parameters
parentThe ClientBase which is used for communication.

Definition at line 25 of file rostermanager.cpp.

~RosterManager ( )
virtual

Virtual destructor.

Definition at line 41 of file rostermanager.cpp.

Member Function Documentation

void ackSubscriptionRequest ( const JID to,
bool  ack 
)

Use this function to acknowledge a subscription request if you requested asynchronous subscription request handling.

Parameters
toThe JID to authorize/decline.
ackWhether to authorize or decline the contact's request.

Definition at line 305 of file rostermanager.cpp.

void add ( const JID jid,
const std::string &  name,
const StringList groups 
)

Use this function to add a contact to the roster. No subscription request is sent.

Note
Use unsubscribe() to remove an item from the roster.
Parameters
jidThe JID to add.
nameThe displayed name of the contact.
groupsA list of groups the contact belongs to.

Definition at line 207 of file rostermanager.cpp.

void cancel ( const JID jid,
const std::string &  msg = "" 
)

Use this function to cancel the contact's subscription to your presence. The contact will no longer receive presence from you.

Parameters
jidThe contact's JID.
msgA message to send along with the request.
Since
0.9
Note
Use remove() to remove a contact from the roster and to cancel its subscriptions.

Definition at line 246 of file rostermanager.cpp.

const std::string& delimiter ( ) const
inline

Use this function to retrieve the delimiter of Nested Roster Groups (XEP-0083).

Returns
The group delimiter.
Since
0.7

Definition at line 140 of file rostermanager.h.

void fill ( )

This function does the initial filling of the roster with the current server-side roster.

Definition at line 64 of file rostermanager.cpp.

RosterItem * getRosterItem ( const JID jid)

Lets you retrieve the RosterItem that belongs to the given JID.

Parameters
jidThe JID to return the RosterItem for.

Definition at line 480 of file rostermanager.cpp.

bool handleIq ( Stanza stanza)
virtual

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

Parameters
stanzaThe 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 85 of file rostermanager.cpp.

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.

Parameters
stanzaThe complete Stanza.
contextA 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 118 of file rostermanager.cpp.

void handlePresence ( Stanza stanza)
virtual

Reimplement this function if you want to be updated on incoming presence notifications.

Parameters
stanzaThe complete stanza.

Implements PresenceHandler.

Definition at line 123 of file rostermanager.cpp.

void handlePrivateXML ( const std::string &  tag,
Tag xml 
)
virtual

Reimplement this function to receive the private XML that was requested earlier using PrivateXML::requestXML().

Parameters
tagThe tag of the storage packet.
xmlThe private xml, i.e. the first child of the <query> tag.

Implements PrivateXMLHandler.

Definition at line 471 of file rostermanager.cpp.

void handlePrivateXMLResult ( const std::string &  uid,
PrivateXMLResult  pxResult 
)
virtual

This function is called to notify about the result of a 'store' or 'request' operation (successful requests are announced by means of handlePrivateXML()).

Parameters
uidThe ID of the query.
pxResultThe result of the operation.
Since
0.7

Implements PrivateXMLHandler.

Definition at line 476 of file rostermanager.cpp.

void handleSubscription ( Stanza stanza)
virtual

Reimplement this function if you want to be notified about incoming subscriptions/subscription requests.

Parameters
stanzaThe complete Stanza.

Implements SubscriptionHandler.

Definition at line 317 of file rostermanager.cpp.

void registerRosterListener ( RosterListener rl,
bool  syncSubscribeReq = true 
)

Register rl as object that receives updates on roster operations. For GUI applications it may be necessary to display a dialog or whatever to the user without blocking. If you want that, use asynchronous subscription requests. If you want to answer a request right away, make it synchronous.

Parameters
rlThe object that receives roster updates.
syncSubscribeReqIndicates whether (Un)SubscriptionRequests shall be handled synchronous (true) or asynchronous (false). Default: synchronous.

Definition at line 373 of file rostermanager.cpp.

void remove ( const JID jid)

Use this function to remove a contact from the roster. Subscription is implicitely cancelled.

Parameters
jidThe contact's JID.
Since
0.9

Definition at line 258 of file rostermanager.cpp.

void removeRosterListener ( )

Complementary function to registerRosterListener. Removes the current RosterListener. Roster events will not be delivered anywhere.

Definition at line 379 of file rostermanager.cpp.

Roster * roster ( )

This function returns the roster.

Returns
Returns a map of JIDs with their current presence.

Definition at line 59 of file rostermanager.cpp.

void setDelimiter ( const std::string &  delimiter)

Use this function to set the group delimiter (XEP-0083).

Parameters
delimiterThe group delimiter.
Since
0.7

Definition at line 463 of file rostermanager.cpp.

void subscribe ( const JID jid,
const std::string &  name = "",
const StringList groups = StringList(),
const std::string &  msg = "" 
)

Use this function to subscribe to a new JID. The contact is added to the roster automatically (by compliant servers, as required by RFC 3921).

Parameters
jidThe address to subscribe to.
nameThe displayed name of the contact.
groupsA list of groups the contact belongs to.
msgA message sent along with the request.

Definition at line 188 of file rostermanager.cpp.

void synchronize ( )

Synchronizes locally modified RosterItems back to the server.

Definition at line 274 of file rostermanager.cpp.

void unsubscribe ( const JID jid,
const std::string &  msg = "" 
)

Use this function to unsubscribe from a contact's presence. You will no longer receive presence from this contact.

Parameters
jidThe address to unsubscribe from.
msgA message to send along with the request.
Since
0.9
Note
Use remove() to remove a contact from the roster and to cancel its subscriptions.

Definition at line 234 of file rostermanager.cpp.


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