21 static const char* errValues [] = {
30 static const char* stanzaErrValues [] = {
33 "feature-not-implemented",
36 "internal-server-error",
44 "recipient-unavailable",
46 "registration-required",
47 "remote-server-not-found",
48 "remote-server-timeout",
49 "resource-constraint",
50 "service-unavailable",
51 "subscription-required",
52 "undefined-condition",
57 static inline StanzaErrorType stanzaErrorType(
const std::string& type )
62 static inline StanzaError stanzaError(
const std::string& type )
64 return static_cast<StanzaError>( util::lookup( type, stanzaErrValues ) );
76 TagList::const_iterator it =
tag->
children().begin();
79 StanzaError srt = gloox::stanzaError( (*it)->name() );
82 else if( (*it)->name() ==
"text" )
83 m_text[(*it)->findAttribute(
"xml:lang")] = (*it)->cdata();
85 m_appError = (*it)->
clone();
91 m_error( error.m_error ), m_appError( error.m_appError ? error.m_appError->clone() : 0 )
101 static const std::string filter =
"/iq/error"
104 "|/subscription/error";
114 Tag*
error =
new Tag(
"error",
TYPE, util::lookup( m_type, errValues ) );
117 StringMap::const_iterator it = m_text.begin();
118 for( ; it != m_text.end(); ++it )
134 StringMap::const_iterator it = m_text.find( lang );
135 return it != m_text.end() ? (*it).second :
EmptyString;
A stanza error abstraction implemented as a StanzaExtension.
void setAppError(Tag *appError)
const Tag * appError() const
virtual const std::string & filterString() const
const std::string & text(const std::string &lang=EmptyString) const
StanzaError error() const
virtual Tag * tag() const
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
This is an abstraction of an XML element.
bool setCData(const std::string &cdata)
bool addAttribute(Attribute *attr)
const std::string & findAttribute(const std::string &name) const
const std::string & name() const
const TagList & children() const
bool setXmlns(const std::string &xmlns, const std::string &prefix=EmptyString)
The namespace for the gloox library.
const std::string XMLNS_XMPP_STANZAS
const std::string EmptyString
@ StanzaErrorTypeUndefined