14 #include "messagemanager.h"
15 #include "taghandler.h"
16 #include "rosterprovider.h"
19 #include <gloox/tag.h>
28 :
Plugin( sm, router ), m_handler( rp )
38 static const std::string filter =
"/message";
42 void MessageManager::getRoster(
const gloox::JID& jid )
47 Roster::const_iterator it = rm.begin();
48 for( ; it != rm.end(); ++it )
50 switch( (*it).second )
69 if( !tag || !m_handler )
73 printf(
"received a message tag!!!!!!!!!! %s\n", tag->xml().c_str() );
78 gloox::Tag* m =
new gloox::Tag(
"message" );
79 m->setXmlns( gloox::XMLNS_CLIENT );
80 m->addAttribute(
"type",
"error" );
81 m->addAttribute(
"to", tag->findAttribute(
"from" ) );
82 m->addAttribute(
"from", tag->findAttribute(
"to" ) );
83 m->addAttribute(
"id", tag->findAttribute(
"id" ) );
84 gloox::Tag* b =
new gloox::Tag( m,
"body" );
85 gloox::Tag* t = tag->findChild(
"body" );
86 b->setCData(
"The following message could not be delivered."
87 " The recipient is offline and offline storage is"
88 " not enabled (or not implemented...)."
89 + ( ( t ) ?
" Your message:\n" + t->cdata() : gloox::EmptyString ) );
90 m_router.handleIncomingTag( m );