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 (
StanzaError)util::lookup( type, stanzaErrValues );
71 if( !tag || tag->
name() !=
"error" )
76 TagList::const_iterator it = tag->
children().begin();
77 for( ; it != tag->
children().end(); ++it )
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 )
120 Tag* txt =
new Tag( error,
"text" );
134 StringMap::const_iterator it = m_text.find( lang );
135 return it != m_text.end() ? (*it).second :
EmptyString;
const TagList & children() const
StanzaError error() const
bool setXmlns(const std::string &xmlns, const std::string &prefix=EmptyString)
const std::string XMLNS_XMPP_STANZAS
const Tag * appError() const
virtual Tag * tag() const
A stanza error abstraction implemented as a StanzaExtension.
bool setCData(const std::string &cdata)
void addChild(Tag *child)
The namespace for the gloox library.
This class abstracts a stanza extension, which is usually an element in a specific namespace...
const std::string & findAttribute(const std::string &name) const
void setAppError(Tag *appError)
const std::string & text(const std::string &lang=EmptyString) const
virtual const std::string & filterString() const
bool addAttribute(Attribute *attr)
const std::string & name() const
const std::string EmptyString
This is an abstraction of an XML element.