gloox
1.0.28
|
#include <stanzaextension.h>
Public Member Functions | |
StanzaExtension (int type) | |
virtual | ~StanzaExtension () |
virtual Stanza * | embeddedStanza () const |
virtual Tag * | embeddedTag () const |
virtual const std::string & | filterString () const =0 |
virtual StanzaExtension * | newInstance (const Tag *tag) const =0 |
virtual Tag * | tag () const =0 |
virtual StanzaExtension * | clone () const =0 |
int | extensionType () const |
This class abstracts a stanza extension, which is usually an XML child element in a specific namespace inside an XMPP stanza.
This class is the base class for almost all protocol extensions in gloox. As such, it should be used whenever an add-on to the core XMPP spec needs to be made. For simple protocols it may suffice to create a sub-class of StanzaExtension. For protocols which require keeping of state, an additional persistent object acting like a manager may be needed.
A Stanza can be extended by additional namespaced child elements. Obviously, it is not viable to include all the kinds of extensions possible. To avoid hard-coding of such extensions into gloox, StanzaExtension can be used to inform the core of gloox about additional supported extensions without it needing to know about the exact implementation.
Note that a StanzaExtension can be used for both sending and receiving of custom protocols. When receiving, gloox requires an appropriate implementation of the pure virtuals filterString() and newInstance(). To be able to properly use the encapsulation, some getters may be necessary. Note that the object you will be dealing with usually is const.
For sending StanzaExtensions, a custom constructor (as well as some setters, possibly) is needed. Additionally, an implementation of tag() is required.
Definition at line 203 of file stanzaextension.h.
|
inline |
Constructs an empty StanzaExtension.
type | Designates the extension's type. It should be one of StanzaExtensionType for built-in extensions, and it should be higher than ExtUser for custom types. |
Definition at line 211 of file stanzaextension.h.
|
inlinevirtual |
Virtual destructor.
Definition at line 216 of file stanzaextension.h.
|
pure virtual |
Returns an identical copy of the current StanzaExtension.
Implemented in XHtmlIM, VCardUpdate, VCard, SoftwareVersion, SHIM, Registration::Query, Receipt, Event, OOB, Nickname, MUCRoom::MUCUser, MUCRoom::MUC, MessageEvent, LastActivity::Query, Session::Jingle, IOData, GPGSigned, GPGEncrypted, Forward, FeatureNeg, Error, Disco::Items, Disco::Info, DelayedDelivery, DataForm, ChatState, Carbons, Capabilities, Attention, AMP, and Adhoc::Command.
|
inlinevirtual |
|
inlinevirtual |
This function returns the embedded Tag that the embedded Stanza is based on, if any. You only have to reimplement it if your protocol flow contains embedded Stanzas.
Reimplemented in Session::Jingle, Forward, and Carbons.
Definition at line 232 of file stanzaextension.h.
|
inline |
Returns the extension's type.
Definition at line 271 of file stanzaextension.h.
|
pure virtual |
Returns an XPath expression that describes a path to child elements of a stanza that an extension handles.
Implemented in XHtmlIM, VCardUpdate, VCard, SoftwareVersion, SHIM, Registration::Query, Receipt, Event, OOB, Nickname, MUCRoom::MUCUser, MUCRoom::MUC, MessageEvent, LastActivity::Query, Session::Jingle, IOData, GPGSigned, GPGEncrypted, Forward, FeatureNeg, Error, Disco::Items, Disco::Info, DelayedDelivery, DataForm, ChatState, Carbons, Capabilities, Attention, AMP, and Adhoc::Command.
|
pure virtual |
Returns a new Instance of the derived type. Usually, for a derived class FooExtension, the implementation of this function looks like:
Implemented in XHtmlIM, VCardUpdate, VCard, SoftwareVersion, SHIM, Registration::Query, Receipt, Event, OOB, Nickname, MUCRoom::MUCUser, MUCRoom::MUC, MessageEvent, LastActivity::Query, Session::Jingle, GPGSigned, GPGEncrypted, Forward, FeatureNeg, Error, Disco::Items, Disco::Info, DelayedDelivery, DataForm, ChatState, Carbons, Capabilities, AMP, Adhoc::Command, IOData, and Attention.
|
pure virtual |
Returns a Tag representation of the extension.
Implemented in XHtmlIM, VCardUpdate, VCard, SoftwareVersion, SHIM, Registration::Query, Receipt, Event, OOB, Nickname, MUCRoom::MUCUser, MUCRoom::MUC, MessageEvent, LastActivity::Query, Session::Jingle, IOData, GPGSigned, GPGEncrypted, Forward, FeatureNeg, Error, Disco::Items, Disco::Info, DelayedDelivery, DataForm, ChatState, Carbons, Capabilities, Attention, AMP, and Adhoc::Command.