14 #include "rosterprovider.h"
15 #include "rostermanager.h"
16 #include "taghandler.h"
18 #include <gloox/tag.h>
27 :
Plugin( sm, router ), m_handler( rp )
37 static const std::string filter =
"/iq[/iq/query[@xmlns='" + gloox::XMLNS_ROSTER +
"']]"
38 "|/presence[@type='subscribe']"
39 "|/presence[@type='unsubscribe']"
40 "|/presence[@type='subscribed']"
41 "|/presence[@type='unsubscribed']";
45 const gloox::TagList RosterManager::getRoster(
const gloox::JID& jid )
51 Roster::const_iterator it = rm.begin();
52 for( ; it != rm.end(); ++it )
54 gloox::Tag* i =
new gloox::Tag(
"item" );
55 i->addAttribute(
"jid", (*it).first );
56 switch( (*it).second )
59 i->addAttribute(
"subscription",
"both" );
62 i->addAttribute(
"subscription",
"none" );
65 i->addAttribute(
"subscription",
"from" );
68 i->addAttribute(
"subscription",
"to" );
84 printf(
"received a roszter tag!!!!!!!!!! %s\n", tag->xml().c_str() );
86 if( tag->hasAttribute( gloox::TYPE,
"get" ) )
88 gloox::Tag* re =
new gloox::Tag(
"iq" );
89 re->addAttribute(
"id", tag->findAttribute(
"id" ) );
90 re->addAttribute(
"to", tag->findAttribute(
"from" ) );
91 re->addAttribute( gloox::TYPE,
"result" );
92 gloox::Tag* q =
new gloox::Tag( re,
"query" );
93 q->setXmlns( gloox::XMLNS_ROSTER );
94 const gloox::TagList& r = getRoster( tag->findAttribute(
"from" ) );
95 gloox::TagList::const_iterator it = r.begin();
96 for( ; it != r.end(); ++it )
99 m_router.handleIncomingTag( re );