gloox
1.0.9
|
#include <simanager.h>
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 () |
This class manages streams initiated using XEP-0095.
You need only one SIManager object per ClientBase instance.
Definition at line 34 of file simanager.h.
enum SIError |
SI error conditions.
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.
SIManager | ( | ClientBase * | parent, |
bool | advertise = true |
||
) |
Constructor.
parent | The ClientBase to use for communication. |
advertise | Whether to advertise SI capabilities by disco. Defaults to true. |
Definition at line 89 of file simanager.cpp.
|
virtual |
Virtual destructor.
Definition at line 101 of file simanager.cpp.
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().
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. |
from | An optional 'from' address to stamp outgoing stanzas with. Used in component scenario only. Defaults to empty JID. |
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().
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 147 of file simanager.cpp.
|
virtual |
Reimplement this function if you want to be notified about incoming IQs.
iq | The complete IQ stanza. |
Implements IqHandler.
Definition at line 193 of file simanager.cpp.
|
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 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).
profile | The complete profile namespace, e.g. http://jabber.org/protocol/si/profile/file-transfer. |
sih | The profile handler. |
Definition at line 171 of file simanager.cpp.
void removeProfile | ( | const std::string & | profile | ) |
Un-registers the given profile.
profile | The 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.
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'. |
from | An optional 'from' address to stamp outgoing requests with. Used in component scenario only. Defaults to empty JID. |
sid | Optionally specify a stream ID (SID). If empty, one will be generated. |
Definition at line 112 of file simanager.cpp.