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

#include <simanager.h>

Inheritance diagram for SIManager:
Inheritance 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", const JID &from=JID(), const std::string &sid=EmptyString)
void acceptSI (const JID &to, const std::string &id, Tag *child1, Tag *child2=0, const JID &from=JID())
void declineSI (const JID &to, const std::string &id, SIError reason, const std::string &text=EmptyString)
void registerProfile (const std::string &profile, SIProfileHandler *sih)
void removeProfile (const std::string &profile)
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 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 89 of file simanager.cpp.

~SIManager ( )
virtual

Virtual destructor.

Definition at line 101 of file simanager.cpp.

Member Function Documentation

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

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.
fromAn optional 'from' address to stamp outgoing stanzas with. Used in component scenario only. Defaults to empty JID.
Note
The SIManager claims ownership of the Tags supplied to this function, and will delete them after use.

Definition at line 137 of file simanager.cpp.

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

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 147 of file simanager.cpp.

bool handleIq ( const IQ iq)
virtual

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, an 'error' will be sent.
Since
1.0

Implements IqHandler.

Definition at line 193 of file simanager.cpp.

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 213 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 171 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 182 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",
const JID from = JID(),
const std::string &  sid = EmptyString 
)

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'.
fromAn optional 'from' address to stamp outgoing requests with. Used in component scenario only. Defaults to empty JID.
sidOptionally specify a stream ID (SID). If empty, one will be generated.
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 112 of file simanager.cpp.


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