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

#include <simanager.h>

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

Public Types

enum  SIError { NoValidStreams, BadProfile, RequestRejected }

Public Member Functions

 SIManager (ClientBase *parent, bool advertise=true)
virtual ~SIManager ()
const std::string requestSI (SIHandler *sih, const JID &to, const std::string &profile, Tag *child1, Tag *child2=0, const std::string &mimetype="binary/octet-stream")
void acceptSI (const JID &to, const std::string &id, Tag *child1, Tag *child2=0)
void declineSI (const JID &to, const std::string &id, SIError reason, const std::string &text="")
void registerProfile (const std::string &profile, SIProfileHandler *sih)
void removeProfile (const std::string &profile)
virtual bool handleIq (Stanza *stanza)
virtual bool handleIqID (Stanza *stanza, int context)
- Public Member Functions inherited from IqHandler
virtual ~IqHandler ()

Detailed Description

This class manages streams initiated using XEP-0095.

You need only one SIManager object per ClientBase instance.

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

Definition at line 34 of file simanager.h.

Member Enumeration Documentation

enum SIError

SI error conditions.

Enumerator:
NoValidStreams 

None of the stream types are acceptable

BadProfile 

Profile is not understood.

RequestRejected 

SI request was rejected.

Definition at line 41 of file simanager.h.

Constructor & Destructor Documentation

SIManager ( ClientBase parent,
bool  advertise = true 
)

Constructor.

Parameters
parentThe ClientBase to use for communication.
advertiseWhether to advertise SI capabilities by disco. Defaults to true.

Definition at line 24 of file simanager.cpp.

~SIManager ( )
virtual

Virtual destructor.

Definition at line 35 of file simanager.cpp.

Member Function Documentation

void acceptSI ( const JID to,
const std::string &  id,
Tag child1,
Tag child2 = 0 
)

Call this function to accept an SI request previously announced by means of SIProfileHandler::handleSIRequest().

Parameters
toThe requestor.
idThe request's id, as passed to SIProfileHandler::handleSIRequest().
child1The <feature/> child of the SI request. See XEP-0095 for details.
child2The profile-specific child of the SI request. May be 0. See XEP-0095 for details.
Note
The SIManager claims ownership of the Tags supplied to this function, and will delete them after use.

Definition at line 82 of file simanager.cpp.

void declineSI ( const JID to,
const std::string &  id,
SIError  reason,
const std::string &  text = "" 
)

Call this function to decline an SI request previously announced by means of SIProfileHandler::handleSIRequest().

Parameters
toThe requestor.
idThe request's id, as passed to SIProfileHandler::handleSIRequest().
reasonThe reason for the reject.
textAn optional human-readable text explaining the decline.

Definition at line 97 of file simanager.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 151 of file simanager.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 174 of file simanager.cpp.

void registerProfile ( const std::string &  profile,
SIProfileHandler sih 
)

Registers the given SIProfileHandler to handle requests for the given SI profile namespace. The profile will be advertised by disco (unless disabled in the ctor).

Parameters
profileThe complete profile namespace, e.g. http://jabber.org/protocol/si/profile/file-transfer.
sihThe profile handler.

Definition at line 129 of file simanager.cpp.

void removeProfile ( const std::string &  profile)

Un-registers the given profile.

Parameters
profileThe profile's namespace to un-register.

Definition at line 140 of file simanager.cpp.

const std::string requestSI ( SIHandler sih,
const JID to,
const std::string &  profile,
Tag child1,
Tag child2 = 0,
const std::string &  mimetype = "binary/octet-stream" 
)

Starts negotiating a stream with a remote entity.

Parameters
sihThe SIHandler to handle the result of this request.
toThe entity to talk to.
profileThe SI profile to use. See XEP-0095 for more info.
child1The first of the two allowed children of the SI offer. See XEP-0095 for more info.
child2The second of the two allowed children of the SI offer. See XEP-0095 for more info. Defaults to 0.
mimetypeThe stream's/file's mime-type. Defaults to 'binary/octet-stream'.
Returns
The requested stream's ID (SID). Empty if SIHandler or ClientBase are invalid.
Note
The SIManager claims ownership of the Tags supplied to this function, and will delete them after use.

Definition at line 46 of file simanager.cpp.


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