SIManager Class Reference

This class manages streams initiated using XEP-0095. More...

#include <simanager.h>

Inheritance diagram for SIManager:

Inheritance graph
[legend]
Collaboration diagram for SIManager:

Collaboration graph
[legend]

List of all members.

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)


Detailed Description

This class manages streams initiated using XEP-0095.

You need only one SIManager object per ClientBase instance.

Author:
Jakob Schroeter <js@camaya.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:
parent The ClientBase to use for communication.
advertise Whether 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

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:
sih The SIHandler to handle the result of this request.
to The entity to talk to.
profile The SI profile to use. See XEP-0095 for more info.
child1 The first of the two allowed children of the SI offer. See XEP-0095 for more info.
child2 The second of the two allowed children of the SI offer. See XEP-0095 for more info. Defaults to 0.
mimetype The 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.

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:
to The requestor.
id The request's id, as passed to SIProfileHandler::handleSIRequest().
child1 The <feature/> child of the SI request. See XEP-0095 for details.
child2 The 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:
to The requestor.
id The request's id, as passed to SIProfileHandler::handleSIRequest().
reason The reason for the reject.
text An optional human-readable text explaining the decline.

Definition at line 97 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:
profile The complete profile namespace, e.g. http://jabber.org/protocol/si/profile/file-transfer.
sih The profile handler.

Definition at line 129 of file simanager.cpp.

void removeProfile ( const std::string &  profile  ) 

Un-registers the given profile.

Parameters:
profile The profile's namespace to un-register.

Definition at line 140 of file simanager.cpp.

bool handleIq ( Stanza stanza  )  [virtual]

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

Parameters:
stanza The 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:
stanza The complete Stanza.
context A 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.


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

Generated on Fri Oct 10 15:26:23 2008 for gloox by  doxygen 1.5.6