#include <stanza.h>
Inherits Tag.
Inheritance diagram for Stanza:
Public Member Functions | |
Stanza (const Tag *tag) | |
Stanza (const std::string &name, const std::string &cdata="", const std::string &xmllang="default", bool incoming=false) | |
virtual | ~Stanza () |
virtual StanzaSubType | subtype () const |
virtual const JID & | from () const |
virtual const JID & | to () const |
virtual const std::string | id () const |
virtual const std::string & | xmlns () const |
virtual Presence | show () const |
virtual const std::string | status (const std::string &lang="default") const |
virtual int | priority () const |
virtual const std::string | body (const std::string &lang="default") const |
virtual const std::string | subject (const std::string &lang="default") const |
virtual const std::string | errorText (const std::string &lang="default") const |
virtual StanzaError | error () const |
Tag * | errorAppCondition () |
virtual const std::string | thread () const |
const std::string & | xmlLang () const |
void | finalize () |
virtual Stanza * | clone () const |
Static Public Member Functions | |
static Stanza * | createIqStanza (const JID &to, const std::string &id, StanzaSubType subtype=StanzaIqGet, const std::string &xmlns="", Tag *tag=0) |
static Stanza * | createPresenceStanza (const JID &to, const std::string &msg="", Presence status=PresenceAvailable, const std::string &xmllang="") |
static Stanza * | createMessageStanza (const JID &to, const std::string &body, StanzaSubType subtype=StanzaMessageChat, const std::string &subject="", const std::string &thread="", const std::string &xmllang="") |
static Stanza * | createSubscriptionStanza (const JID &to, const std::string &msg="", StanzaSubType subtype=StanzaS10nSubscribe, const std::string &xmllang="") |
Protected Member Functions | |
void | init () |
Protected Attributes | |
StanzaSubType | m_subtype |
Presence | m_show |
StanzaError | m_stanzaError |
StanzaErrorType | m_stanzaErrorType |
Tag * | m_stanzaErrorAppCondition |
StringMap | m_errorText |
StringMap | m_body |
StringMap | m_subject |
StringMap | m_status |
JID | m_from |
JID | m_to |
std::string | m_xmlns |
std::string | m_id |
std::string | m_thread |
std::string | m_xmllang |
int | m_priority |
You can create a new Stanza from an existing Tag (or another stanza).
Definition at line 32 of file stanza.h.
Creates a new Stanza from a deep copy of the given Tag.
Definition at line 28 of file stanza.cpp.
Referenced by Stanza::clone(), Stanza::createIqStanza(), Stanza::createMessageStanza(), Stanza::createPresenceStanza(), and Stanza::createSubscriptionStanza().
Stanza | ( | const std::string & | name, | |
const std::string & | cdata = "" , |
|||
const std::string & | xmllang = "default" , |
|||
bool | incoming = false | |||
) |
Creates a new Stanza with given name and optional CData.
name | The name of the root tag. | |
cdata | Initial XML character data for the tag. | |
xmllang | The value of the xmllang attribute. The stanza's primary language. |
Definition at line 21 of file stanza.cpp.
virtual StanzaSubType subtype | ( | ) | const [inline, virtual] |
Returns the sub-type of the stanza.
Definition at line 64 of file stanza.h.
Referenced by InBandBytestream::filter(), RosterManager::handleIq(), Registration::handleIq(), PrivacyManager::handleIq(), LastActivity::handleIq(), InBandBytestreamManager::handleIq(), Disco::handleIq(), VCardManager::handleIqID(), Search::handleIqID(), Registration::handleIqID(), PrivateXML::handleIqID(), PrivacyManager::handleIqID(), NonSaslAuth::handleIqID(), LastActivity::handleIqID(), InBandBytestreamManager::handleIqID(), FlexibleOffline::handleIqID(), Disco::handleIqID(), RosterManager::handlePresence(), and RosterManager::handleSubscription().
virtual const JID& from | ( | ) | const [inline, virtual] |
Returns the JID the stanza comes from.
Definition at line 70 of file stanza.h.
Referenced by MessageEventFilter::filter(), InBandBytestream::filter(), ChatStateFilter::filter(), Registration::handleIq(), LastActivity::handleIq(), InBandBytestreamManager::handleIq(), Disco::handleIq(), Adhoc::handleIq(), VCardManager::handleIqID(), Search::handleIqID(), Registration::handleIqID(), LastActivity::handleIqID(), InBandBytestreamManager::handleIqID(), MessageSession::handleMessage(), RosterManager::handlePresence(), and RosterManager::handleSubscription().
virtual const JID& to | ( | ) | const [inline, virtual] |
Returns the receiver of the stanza.
Definition at line 76 of file stanza.h.
Referenced by Stanza::createIqStanza(), Stanza::createMessageStanza(), Stanza::createPresenceStanza(), and Stanza::createSubscriptionStanza().
virtual const std::string id | ( | ) | const [inline, virtual] |
Returns the id of the stanza, if set.
Definition at line 82 of file stanza.h.
Referenced by RosterManager::handleIq(), PrivacyManager::handleIq(), LastActivity::handleIq(), InBandBytestreamManager::handleIq(), Disco::handleIq(), Adhoc::handleIq(), VCardManager::handleIqID(), Search::handleIqID(), PrivateXML::handleIqID(), PrivacyManager::handleIqID(), InBandBytestreamManager::handleIqID(), and Disco::handleIqID().
virtual const std::string& xmlns | ( | ) | const [inline, virtual] |
Returns the value of the xmlns attribute of the first child node.
Definition at line 88 of file stanza.h.
Referenced by Disco::handleIq().
virtual Presence show | ( | ) | const [inline, virtual] |
Returns the presence 'show' type of a presence stanza.
Definition at line 94 of file stanza.h.
Referenced by RosterManager::handlePresence().
const std::string status | ( | const std::string & | lang = "default" |
) | const [virtual] |
Returns the status text of a presence stanza for the given language if available. If the requested language is not available, the default status text (without a xml:lang attribute) will be returned.
lang | The language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066. If empty, the default body will be returned, if any. |
Definition at line 312 of file stanza.cpp.
Referenced by RosterManager::handlePresence(), and RosterManager::handleSubscription().
virtual int priority | ( | ) | const [inline, virtual] |
Returns the remote entity resource's presence priority if the stanza is a presence stanza. If the stanza is not a presence stanza or if no priority information was included, a value below -128 is returned, which is an illegal value for the priority. Legal range is between -128 and +127.
Definition at line 114 of file stanza.h.
Referenced by RosterManager::handlePresence().
const std::string body | ( | const std::string & | lang = "default" |
) | const [virtual] |
Returns the body of a message stanza for the given language if available. If the requested language is not available, the default body (without a xml:lang attribute) will be returned.
lang | The language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066. If empty, the default body will be returned, if any. |
Definition at line 294 of file stanza.cpp.
Referenced by MessageEventFilter::filter(), ChatStateFilter::filter(), and MessageSession::handleMessage().
const std::string subject | ( | const std::string & | lang = "default" |
) | const [virtual] |
Returns the subject of a message stanza for the given language if available. If the requested language is not available, the default subject (without a xml:lang attribute) will be returned.
lang | The language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066. If empty, the default subject will be returned, if any. |
Definition at line 303 of file stanza.cpp.
const std::string errorText | ( | const std::string & | lang = "default" |
) | const [virtual] |
Returns the text of a error stanza for the given language if available. If the requested language is not available, the default text (without a xml:lang attribute) will be returned.
lang | The language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066. If empty, the default subject will be returned, if any. |
Definition at line 321 of file stanza.cpp.
virtual StanzaError error | ( | ) | const [inline, virtual] |
Returnes the stanza error condition, if any.
Definition at line 153 of file stanza.h.
Referenced by InBandBytestream::filter(), VCardManager::handleIqID(), LastActivity::handleIqID(), InBandBytestreamManager::handleIqID(), and FlexibleOffline::handleIqID().
Tag* errorAppCondition | ( | ) | [inline] |
virtual const std::string thread | ( | ) | const [inline, virtual] |
const std::string& xmlLang | ( | ) | const [inline] |
void finalize | ( | ) | [inline] |
Use this function to parse the content of the Tag and determine type, etc. of the Stanza. This feels kind of hackish... You only need to call this if you are constructing a bare Stanza from scratch. Stanzas provided by gloox are fully parsed.
Definition at line 181 of file stanza.h.
Referenced by Stanza::createIqStanza(), Stanza::createPresenceStanza(), Stanza::createSubscriptionStanza(), and gloox::tagHook().
Stanza * clone | ( | ) | const [virtual] |
This function creates a deep copy of this Stanza.
Reimplemented from Tag.
Definition at line 330 of file stanza.cpp.
Stanza * createIqStanza | ( | const JID & | to, | |
const std::string & | id, | |||
StanzaSubType | subtype = StanzaIqGet , |
|||
const std::string & | xmlns = "" , |
|||
Tag * | tag = 0 | |||
) | [static] |
Creates a new IQ stanza.
to | The receiver of the stanza. | |
id | An ID for the stanza. Best is to use ClientBase::getID() as input. | |
subtype | The IQ type. Only StanzaIq* types are valid. | |
xmlns | If this is non-empty, a child element named 'query' will be included, with this value as value of the 'xmlns' attribute. | |
tag | If this if not NULL, and xmlns is not empty, this Tag will be included as child tag of the 'query' element. |
Definition at line 336 of file stanza.cpp.
Stanza * createPresenceStanza | ( | const JID & | to, | |
const std::string & | msg = "" , |
|||
Presence | status = PresenceAvailable , |
|||
const std::string & | xmllang = "" | |||
) | [static] |
Creates a new presence stanza. to
can be an empty JID. This makes the created stanza a broadcast stanza sent to all contacts in the roster.
to | The receiver of the stanza. | |
msg | An optional message. | |
status | The status. | |
xmllang | The status message's language. |
Definition at line 372 of file stanza.cpp.
Stanza * createMessageStanza | ( | const JID & | to, | |
const std::string & | body, | |||
StanzaSubType | subtype = StanzaMessageChat , |
|||
const std::string & | subject = "" , |
|||
const std::string & | thread = "" , |
|||
const std::string & | xmllang = "" | |||
) | [static] |
Creates a new message stanza.
to | The receiver of the message. | |
body | The message's body. | |
subtype | The message type. Only StanzaMessage* types are valid. | |
subject | The message's subject. | |
thread | The message's conversation thread id. | |
xmllang | The message's language. |
Definition at line 411 of file stanza.cpp.
Stanza * createSubscriptionStanza | ( | const JID & | to, | |
const std::string & | msg = "" , |
|||
StanzaSubType | subtype = StanzaS10nSubscribe , |
|||
const std::string & | xmllang = "" | |||
) | [static] |
Creates a new subscription stanza.
to | The recipient of the subscription stanza. | |
msg | An optional message. | |
subtype | The subscription type. Only StanzaS10n* types are vaild. | |
xmllang | The message's language. |
Definition at line 456 of file stanza.cpp.