16 #include <gloox/error.h>
18 #include <gloox/message.h>
19 #include <gloox/presence.h>
20 #include <gloox/tag.h>
33 gloox::Tag*
returnError(
const gloox::Tag* tag, gloox::StanzaError se, gloox::StanzaErrorType type )
40 const std::string& name = tag->name();
41 const std::string& from = tag->findAttribute(
"from" );
42 const std::string& to = tag->hasAttribute(
"to" ) ? tag->findAttribute(
"to" ) : from;
43 if( name ==
"message" )
45 gloox::Message msg( gloox::Message::Error, from );
47 msg.addExtension(
new gloox::Error( type, se ) );
50 else if( name ==
"iq" )
52 gloox::IQ iq( gloox::IQ::Error, from,
53 tag->findAttribute(
"id" ) );
55 iq.addExtension(
new gloox::Error( type, se ) );
58 else if( name ==
"presence" )
60 gloox::Presence p(gloox::Presence::Error, from );
62 p.addExtension(
new gloox::Error( type, se ) );
71 const char* glooxd_version()