13 #include "pubsubmanager.h"
14 #include "clientbase.h"
18 #include "pubsubresulthandler.h"
19 #include "pubsubitem.h"
30 static const std::string
31 XMLNS_PUBSUB_NODE_CONFIG =
"http://jabber.org/protocol/pubsub#node_config",
32 XMLNS_PUBSUB_SUBSCRIBE_OPTIONS =
"http://jabber.org/protocol/pubsub#subscribe_options";
79 static const char* subscriptionValues[] = {
80 "none",
"subscribed",
"pending",
"unconfigured"
83 static inline SubscriptionType subscriptionType(
const std::string& subscription )
85 return static_cast<SubscriptionType>( util::lookup( subscription, subscriptionValues ) );
88 static inline const std::string subscriptionValue(
SubscriptionType subscription )
90 return util::lookup( subscription, subscriptionValues );
93 static const char* affiliationValues[] = {
94 "none",
"publisher",
"owner",
"outcast"
97 static inline AffiliationType affiliationType(
const std::string& affiliation )
99 return static_cast<AffiliationType>( util::lookup( affiliation, affiliationValues ) );
102 static inline const std::string affiliationValue(
AffiliationType affiliation )
104 return util::lookup( affiliation, affiliationValues );
108 Manager::PubSubOwner::PubSubOwner( TrackContext context )
109 : StanzaExtension(
ExtPubSubOwner ), m_ctx( context ), m_form( 0 )
113 Manager::PubSubOwner::PubSubOwner(
const Tag* tag )
114 : StanzaExtension(
ExtPubSubOwner ), m_ctx( InvalidContext ), m_form( 0 )
116 const Tag* d = tag->findTag(
"pubsub/delete" );
120 m_node = d->findAttribute(
"node" );
123 const Tag* p = tag->findTag(
"pubsub/purge" );
126 m_ctx = PurgeNodeItems;
127 m_node = p->findAttribute(
"node" );
130 const Tag* c = tag->findTag(
"pubsub/configure" );
133 m_ctx = SetNodeConfig;
134 m_node = c->findAttribute(
"node" );
135 if( c->hasChild(
"x",
"xmlns", XMLNS_X_DATA ) )
137 m_ctx = GetNodeConfig;
138 m_form =
new DataForm( c->findChild(
"x",
"xmlns", XMLNS_X_DATA ) );
142 const Tag* de = tag->findTag(
"pubsub/default" );
145 m_ctx = DefaultNodeConfig;
148 const Tag* s = tag->findTag(
"pubsub/subscriptions" );
151 m_ctx = GetSubscriberList;
152 m_node = s->findAttribute(
"node" );
153 const TagList& l = s->children();
154 TagList::const_iterator it =l.begin();
155 for( ; it != l.end(); ++it )
157 if( (*it)->name() ==
"subscription" )
159 Subscriber sub( (*it)->findAttribute(
"jid" ),
160 subscriptionType( (*it)->findAttribute(
"subscription" ) ),
161 (*it)->findAttribute(
"subid" ) );
162 m_subList.push_back( sub );
167 const Tag* a = tag->findTag(
"pubsub/affiliations" );
170 m_ctx = GetAffiliateList;
171 m_node = a->findAttribute(
"node" );
172 const TagList& l = a->children();
173 TagList::const_iterator it = l.begin();
174 for( ; it != l.end(); ++it )
176 if( (*it)->name() ==
"affiliation" )
178 Affiliate aff( (*it)->findAttribute(
"jid" ),
179 affiliationType( (*it)->findAttribute(
"affiliation" ) ) );
180 m_affList.push_back( aff );
187 Manager::PubSubOwner::~PubSubOwner()
192 const std::string& Manager::PubSubOwner::filterString()
const
198 Tag* Manager::PubSubOwner::tag()
const
200 if( m_ctx == InvalidContext )
203 Tag* t =
new Tag(
"pubsub" );
204 t->setXmlns( XMLNS_PUBSUB_OWNER );
211 c =
new Tag( t,
"delete",
"node", m_node );
216 c =
new Tag( t,
"purge",
"node", m_node );
222 c =
new Tag( t,
"configure" );
223 c->addAttribute(
"node", m_node );
225 c->addChild( m_form->tag() );
228 case GetSubscriberList:
229 case SetSubscriberList:
232 c =
new Tag( t,
"subscriptions" );
233 c->addAttribute(
"node", m_node );
234 if( m_subList.size() )
237 SubscriberList::const_iterator it = m_subList.begin();
238 for( ; it != m_subList.end(); ++it )
240 s =
new Tag( c,
"subscription" );
241 s->addAttribute(
"jid", (*it).jid.full() );
242 s->addAttribute(
"subscription", util::lookup( (*it).type, subscriptionValues ) );
243 if( !(*it).subid.empty() )
244 s->addAttribute(
"subid", (*it).subid );
249 case GetAffiliateList:
250 case SetAffiliateList:
252 c =
new Tag( t,
"affiliations" );
253 c->addAttribute(
"node", m_node );
254 if( m_affList.size() )
257 AffiliateList::const_iterator it = m_affList.begin();
258 for( ; it != m_affList.end(); ++it )
260 a =
new Tag( c,
"affiliation",
"jid", (*it).jid.full() );
261 a->addAttribute(
"affiliation", util::lookup( (*it).type, affiliationValues ) );
266 case DefaultNodeConfig:
268 c =
new Tag( t,
"default" );
280 Manager::PubSub::PubSub( TrackContext context )
281 : StanzaExtension(
ExtPubSub ), m_ctx( context ), m_maxItems( 0 ),
287 Manager::PubSub::PubSub(
const Tag* tag )
288 : StanzaExtension(
ExtPubSub ), m_ctx( InvalidContext ),
289 m_maxItems( 0 ), m_notify( false )
295 const Tag* sl = tag->findTag(
"pubsub/subscriptions" );
301 m_ctx = GetSubscriptionList;
302 TagList::const_iterator it = l.begin();
303 for( ; it != l.end(); ++it )
305 const std::string& node = (*it)->findAttribute(
"node" );
306 const std::string& sub = (*it)->findAttribute(
"subscription" );
307 const std::string& subid = (*it)->findAttribute(
"subid" );
309 si.jid.setJID( (*it)->findAttribute(
"jid" ) );
310 si.type = subscriptionType( sub );
313 SubscriptionMap::iterator iter = m_subscriptionMap.find( node );
314 if( iter == m_subscriptionMap.end() )
316 iter = m_subscriptionMap.insert( std::make_pair( node, SubscriptionList() ) ).first;
319 SubscriptionList& lst = iter->second;
325 ConstTagList l = tag->findTagList(
"pubsub/affiliations/affiliation" );
328 m_ctx = GetAffiliationList;
329 ConstTagList::const_iterator it = l.begin();
330 for( ; it != l.end(); ++it )
332 const std::string& node = (*it)->findAttribute(
"node" );
333 const std::string& aff = (*it)->findAttribute(
"affiliation" );
334 m_affiliationMap[node] = affiliationType( aff );
338 const Tag* s = tag->findTag(
"pubsub/subscribe" );
341 m_ctx = Subscription;
342 m_node = s->findAttribute(
"node" );
343 m_jid = s->findAttribute(
"jid" );
345 const Tag* u = tag->findTag(
"pubsub/unsubscribe" );
348 m_ctx = Unsubscription;
349 m_node = u->findAttribute(
"node" );
350 m_jid = u->findAttribute(
"jid" );
351 m_subid = u->findAttribute(
"subid" );
353 const Tag* o = tag->findTag(
"pubsub/options" );
356 if( m_ctx == InvalidContext )
358 Tag* parent = tag->parent();
359 if( parent && parent->findAttribute(
"type") ==
"set" )
360 m_ctx = SetSubscriptionOptions;
362 m_ctx = GetSubscriptionOptions;
364 if( m_ctx == SetSubscriptionOptions || m_ctx == GetSubscriptionOptions )
368 m_node = o->findAttribute(
"node" );
369 m_jid.setJID( o->findAttribute(
"jid" ) );
370 m_subid = o->findAttribute(
"subid" );
372 m_options.node = o->findAttribute(
"node" );
373 m_options.df =
new DataForm( o->findChild(
"x",
"xmlns", XMLNS_X_DATA ) );
375 const Tag* su = tag->findTag(
"pubsub/subscription" );
379 si.jid.setJID( su->findAttribute(
"jid" ) );
380 si.subid = su->findAttribute(
"subid" );
381 si.type = subscriptionType( su->findAttribute(
"subscription" ) );
382 SubscriptionList& lst = m_subscriptionMap[su->findAttribute(
"node" )];
386 const Tag* i = tag->findTag(
"pubsub/items" );
389 m_ctx = RequestItems;
390 m_node = i->findAttribute(
"node" );
391 m_subid = i->findAttribute(
"subid" );
392 m_maxItems = atoi( i->findAttribute(
"max_items" ).c_str() );
393 const TagList& l = i->children();
394 TagList::const_iterator it = l.begin();
395 for( ; it != l.end(); ++it )
396 m_items.push_back(
new Item( (*it) ) );
399 const Tag* p = tag->findTag(
"pubsub/publish" );
403 m_node = p->findAttribute(
"node" );
404 const TagList& l = p->children();
405 TagList::const_iterator it = l.begin();
406 for( ; it != l.end(); ++it )
407 m_items.push_back(
new Item( (*it) ) );
410 const Tag* r = tag->findTag(
"pubsub/retract" );
414 m_node = r->findAttribute(
"node" );
415 m_notify = r->hasAttribute(
"notify",
"1" ) || r->hasAttribute(
"notify",
"true" );
416 const TagList& l = r->children();
417 TagList::const_iterator it = l.begin();
418 for( ; it != l.end(); ++it )
419 m_items.push_back(
new Item( (*it) ) );
422 const Tag* c = tag->findTag(
"pubsub/create" );
426 m_node = c->findAttribute(
"node" );
427 const Tag* config = tag->findTag(
"pubsub/configure" );
428 if( config && config->hasChild(
"x", XMLNS_X_DATA ) )
429 m_options.df =
new DataForm( config->findChild(
"x", XMLNS_X_DATA ) );
433 Manager::PubSub::~PubSub()
436 util::clearList( m_items );
439 const std::string& Manager::PubSub::filterString()
const
441 static const std::string filter =
"/iq/pubsub[@xmlns='" +
XMLNS_PUBSUB +
"']";
445 Tag* Manager::PubSub::tag()
const
447 if( m_ctx == InvalidContext )
450 Tag* t =
new Tag(
"pubsub" );
451 t->setXmlns( XMLNS_PUBSUB );
453 if( m_ctx == GetSubscriptionList )
455 Tag* sub =
new Tag( t,
"subscriptions" );
456 SubscriptionMap::const_iterator it = m_subscriptionMap.begin();
457 for( ; it != m_subscriptionMap.end(); ++it )
459 const SubscriptionList& lst = (*it).second;
460 SubscriptionList::const_iterator it2 = lst.begin();
461 for( ; it2 != lst.end(); ++it2 )
463 Tag* s =
new Tag( sub,
"subscription" );
464 s->addAttribute(
"node", (*it).first );
465 s->addAttribute(
"jid", (*it2).jid );
466 s->addAttribute(
"subscription", subscriptionValue( (*it2).type ) );
467 s->addAttribute(
"sid", (*it2).subid );
471 else if( m_ctx == GetAffiliationList )
474 Tag* aff =
new Tag( t,
"affiliations" );
475 AffiliationMap::const_iterator it = m_affiliationMap.begin();
476 for( ; it != m_affiliationMap.end(); ++it )
478 Tag* a =
new Tag( aff,
"affiliation" );
479 a->addAttribute(
"node", (*it).first );
480 a->addAttribute(
"affiliation", affiliationValue( (*it).second ) );
483 else if( m_ctx == Subscription )
485 Tag* s =
new Tag( t,
"subscribe" );
486 s->addAttribute(
"node", m_node );
487 s->addAttribute(
"jid", m_jid.full() );
490 Tag* o =
new Tag( t,
"options" );
491 o->addChild( m_options.df->tag() );
494 else if( m_ctx == Unsubscription )
496 Tag* u =
new Tag( t,
"unsubscribe" );
497 u->addAttribute(
"node", m_node );
498 u->addAttribute(
"jid", m_jid.full() );
499 u->addAttribute(
"subid", m_subid );
501 else if( m_ctx == GetSubscriptionOptions
502 || m_ctx == SetSubscriptionOptions )
504 Tag* o =
new Tag( t,
"options" );
505 o->addAttribute(
"node", m_options.node );
506 o->addAttribute(
"jid", m_jid.full() );
507 if( !m_subid.empty() )
508 o->addAttribute(
"subid", m_subid );
510 o->addChild( m_options.df->tag() );
512 else if( m_ctx == RequestItems )
514 Tag* i =
new Tag( t,
"items" );
515 i->addAttribute(
"node", m_node );
517 i->addAttribute(
"max_items", m_maxItems );
518 i->addAttribute(
"subid", m_subid );
519 ItemList::const_iterator it = m_items.begin();
520 for( ; it != m_items.end(); ++it )
521 i->addChild( (*it)->tag() );
523 else if( m_ctx == PublishItem )
525 Tag* p =
new Tag( t,
"publish" );
526 p->addAttribute(
"node", m_node );
527 ItemList::const_iterator it = m_items.begin();
528 for( ; it != m_items.end(); ++it )
529 p->addChild( (*it)->tag() );
532 Tag* po =
new Tag( p,
"publish-options" );
533 po->addChild( m_options.df->tag() );
536 else if( m_ctx == DeleteItem )
538 Tag* r =
new Tag( t,
"retract" );
539 r->addAttribute(
"node", m_node );
541 r->addAttribute(
"notify",
"true" );
542 ItemList::const_iterator it = m_items.begin();
543 for( ; it != m_items.end(); ++it )
544 r->addChild( (*it)->tag() );
546 else if( m_ctx == CreateNode )
548 Tag* c =
new Tag( t,
"create" );
549 if( !m_node.empty() )
550 c->addAttribute(
"node", m_node );
551 Tag* config =
new Tag( t,
"configure" );
553 config->addChild( m_options.df->tag() );
558 StanzaExtension* Manager::PubSub::clone()
const
560 PubSub* p =
new PubSub();
561 p->m_affiliationMap = m_affiliationMap;
562 p->m_subscriptionMap = m_subscriptionMap;
565 p->m_options.node = m_options.node;
566 p->m_options.df = m_options.df ?
new DataForm( *(m_options.df) ) : 0;
570 p->m_subid = m_subid;
571 ItemList::const_iterator it = m_items.begin();
572 for( ; it != m_items.end(); ++it )
573 p->m_items.push_back(
new Item( *(*it) ) );
575 p->m_maxItems = m_maxItems;
576 p->m_notify = m_notify;
593 const std::string Manager::getSubscriptionsOrAffiliations(
const JID& service,
595 TrackContext context )
597 if( !m_parent || !handler || !service || context == InvalidContext )
600 const std::string&
id = m_parent->
getID();
602 iq.addExtension(
new PubSub( context ) );
604 m_trackMapMutex.
lock();
605 m_resultHandlerTrackMap[id] = handler;
607 m_parent->
send( iq,
this, context );
612 const std::string& node,
617 const std::string& expire
620 if( !m_parent || !handler || !service || node.empty() )
638 field->
setValue( util::int2string( depth ) );
641 if( !expire.empty() )
648 return subscribe( service, node, handler, jid, options );
652 const std::string& node,
658 if( !m_parent || !handler || !service || node.empty() )
661 const std::string&
id = m_parent->
getID();
664 ps->setJID( jid ? jid : m_parent->
jid() );
666 if( options != NULL )
667 ps->setOptions( node, options );
670 m_trackMapMutex.
lock();
671 m_resultHandlerTrackMap[id] = handler;
672 m_nopTrackMap[id] = node;
679 const std::string& node,
680 const std::string& subid,
684 if( !m_parent || !handler || !service )
687 const std::string&
id = m_parent->
getID();
689 PubSub* ps =
new PubSub( Unsubscription );
691 ps->setJID( jid ? jid : m_parent->
jid() );
692 ps->setSubscriptionID( subid );
695 m_trackMapMutex.
lock();
696 m_resultHandlerTrackMap[id] = handler;
699 m_parent->
send( iq,
this, Unsubscription );
703 const std::string Manager::subscriptionOptions( TrackContext context,
706 const std::string& node,
709 const std::string& subid )
711 if( !m_parent || !handler || !service )
714 const std::string&
id = m_parent->
getID();
716 PubSub* ps =
new PubSub( context );
717 ps->setJID( jid ? jid : m_parent->
jid() );
719 ps->setSubscriptionID( subid );
720 ps->setOptions( node, df );
721 iq.addExtension( ps );
723 m_trackMapMutex.
lock();
724 m_resultHandlerTrackMap[id] = handler;
726 m_parent->
send( iq,
this, context );
731 const std::string& node,
732 const std::string& subid,
736 if( !m_parent || !service || !handler )
739 const std::string&
id = m_parent->
getID();
741 PubSub* ps =
new PubSub( RequestItems );
743 ps->setSubscriptionID( subid );
744 ps->setMaxItems( maxItems );
747 m_trackMapMutex.
lock();
748 m_resultHandlerTrackMap[id] = handler;
750 m_parent->
send( iq,
this, RequestItems );
755 const std::string& node,
756 const std::string& subid,
757 const ItemList& items,
760 if( !m_parent || !service || !handler )
763 const std::string&
id = m_parent->
getID();
765 PubSub* ps =
new PubSub( RequestItems );
767 ps->setSubscriptionID( subid );
768 ps->setItems( items );
771 m_trackMapMutex.
lock();
772 m_resultHandlerTrackMap[id] = handler;
774 m_parent->
send( iq,
this, RequestItems );
779 const std::string& node,
784 if( !m_parent || !handler )
790 const std::string&
id = m_parent->
getID();
792 PubSub* ps =
new PubSub( PublishItem );
794 ps->setItems( items );
798 m_trackMapMutex.
lock();
799 m_resultHandlerTrackMap[id] = handler;
801 m_parent->
send( iq,
this, PublishItem );
806 const std::string& node,
807 const ItemList& items,
811 if( !m_parent || !handler || !service )
814 const std::string&
id = m_parent->
getID();
816 PubSub* ps =
new PubSub( DeleteItem );
818 ps->setItems( items );
819 ps->setNotify( notify );
822 m_trackMapMutex.
lock();
823 m_resultHandlerTrackMap[id] = handler;
825 m_parent->
send( iq,
this, DeleteItem );
830 const std::string& node,
834 if( !m_parent || !handler || !service )
837 const std::string&
id = m_parent->
getID();
839 PubSub* ps =
new PubSub( CreateNode );
845 m_trackMapMutex.
lock();
846 m_nopTrackMap[id] = node;
847 m_resultHandlerTrackMap[id] = handler;
849 m_parent->
send( iq,
this, CreateNode );
854 const std::string& node,
857 if( !m_parent || !handler || !service || node.empty() )
860 const std::string&
id = m_parent->
getID();
862 PubSubOwner* pso =
new PubSubOwner( DeleteNode );
863 pso->setNode( node );
866 m_trackMapMutex.
lock();
867 m_nopTrackMap[id] = node;
868 m_resultHandlerTrackMap[id] = handler;
870 m_parent->
send( iq,
this, DeleteNode );
878 if( !m_parent || !handler || !service )
881 const std::string&
id = m_parent->
getID();
883 PubSubOwner* pso =
new PubSubOwner( DefaultNodeConfig );
889 pso->setConfig( df );
893 m_trackMapMutex.
lock();
894 m_resultHandlerTrackMap[id] = handler;
896 m_parent->
send( iq,
this, DefaultNodeConfig );
900 const std::string Manager::nodeConfig(
const JID& service,
901 const std::string& node,
905 if( !m_parent || !handler || !service || node.empty() )
908 const std::string&
id = m_parent->
getID();
910 PubSubOwner* pso =
new PubSubOwner( config ? SetNodeConfig : GetNodeConfig );
911 pso->setNode( node );
913 pso->setConfig( config );
914 iq.addExtension( pso );
916 m_trackMapMutex.
lock();
917 m_nopTrackMap[id] = node;
918 m_resultHandlerTrackMap[id] = handler;
920 m_parent->
send( iq,
this, config ? SetNodeConfig : GetNodeConfig );
924 const std::string Manager::subscriberList( TrackContext ctx,
926 const std::string& node,
927 const SubscriberList& subList,
928 ResultHandler* handler )
930 if( !m_parent || !handler || !service || node.empty() )
933 const std::string&
id = m_parent->
getID();
935 PubSubOwner* pso =
new PubSubOwner( ctx );
936 pso->setNode( node );
937 pso->setSubscriberList( subList );
938 iq.addExtension( pso );
940 m_trackMapMutex.
lock();
941 m_nopTrackMap[id] = node;
942 m_resultHandlerTrackMap[id] = handler;
944 m_parent->
send( iq,
this, ctx );
948 const std::string Manager::affiliateList( TrackContext ctx,
950 const std::string& node,
951 const AffiliateList& affList,
952 ResultHandler* handler )
954 if( !m_parent || !handler || !service || node.empty() )
957 const std::string&
id = m_parent->
getID();
958 IQ iq( ctx == SetAffiliateList ?
IQ::Set :
IQ::Get, service,
id );
959 PubSubOwner* pso =
new PubSubOwner( ctx );
960 pso->setNode( node );
961 pso->setAffiliateList( affList );
962 iq.addExtension( pso );
964 m_trackMapMutex.
lock();
965 m_nopTrackMap[id] = node;
966 m_resultHandlerTrackMap[id] = handler;
968 m_parent->
send( iq,
this, ctx );
973 const std::string& node,
976 if( !m_parent || !handler || !service || node.empty() )
979 const std::string&
id = m_parent->
getID();
981 PubSubOwner* pso =
new PubSubOwner( PurgeNodeItems );
982 pso->setNode( node );
985 m_trackMapMutex.
lock();
986 m_nopTrackMap[id] = node;
987 m_resultHandlerTrackMap[id] = handler;
989 m_parent->
send( iq,
this, PurgeNodeItems );
995 m_trackMapMutex.
lock();
996 ResultHandlerTrackMap::iterator ith = m_resultHandlerTrackMap.find(
id );
997 if( ith == m_resultHandlerTrackMap.end() )
1002 m_resultHandlerTrackMap.erase( ith );
1003 m_trackMapMutex.
unlock();
1009 const JID& service = iq.
from();
1010 const std::string&
id = iq.
id();
1012 m_trackMapMutex.
lock();
1013 ResultHandlerTrackMap::iterator ith = m_resultHandlerTrackMap.find(
id );
1014 if( ith == m_resultHandlerTrackMap.end() )
1016 m_trackMapMutex.
unlock();
1020 m_resultHandlerTrackMap.erase( ith );
1021 m_trackMapMutex.
unlock();
1036 SubscriptionMap sm = ps->subscriptions();
1050 SubscriptionMap::const_iterator it = sm.begin();
1051 const SubscriptionList& lst = (*it).second;
1052 if( lst.size() == 1 )
1054 SubscriptionList::const_iterator it2 = lst.begin();
1056 (*it2).type, error );
1061 case Unsubscription:
1066 case GetSubscriptionList:
1073 ps->subscriptions(),
1077 case GetAffiliationList:
1095 ps->items(), error );
1102 ps ? ps->items() : ItemList(),
1118 case DefaultNodeConfig:
1129 case GetSubscriptionOptions:
1130 case GetSubscriberList:
1131 case SetSubscriberList:
1132 case GetAffiliateList:
1133 case SetAffiliateList:
1138 case PurgeNodeItems:
1142 case GetSubscriptionOptions:
1151 ps->subscriptionID(),
1156 case GetSubscriberList:
1161 const SubscriptionMap& sm = ps->subscriptions();
1162 SubscriptionMap::const_iterator itsm = sm.find( ps->node() );
1163 if( itsm != sm.end() )
1168 case SetSubscriptionOptions:
1169 case SetSubscriberList:
1170 case SetAffiliateList:
1174 case PurgeNodeItems:
1176 m_trackMapMutex.
lock();
1177 NodeOperationTrackMap::iterator it = m_nopTrackMap.find(
id );
1178 if( it != m_nopTrackMap.end() )
1180 const std::string& node = (*it).second;
1184 case SetSubscriptionOptions:
1191 ps->subscriptionID(),
1200 case SetSubscriberList:
1203 case SetAffiliateList:
1218 case PurgeNodeItems:
1222 m_nopTrackMap.erase( it );
1224 m_trackMapMutex.
unlock();
1227 case GetAffiliateList:
1232 rh->
handleAffiliates(
id, service, pso->node(), pso->affiliateList(), error );
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
const std::string getID()
void registerStanzaExtension(StanzaExtension *ext)
A stanza error abstraction implemented as a StanzaExtension.
An abstraction of an IQ stanza.
const std::string subscribe(const JID &service, const std::string &node, ResultHandler *handler, const JID &jid=JID(), SubscriptionObject type=SubscriptionNodes, int depth=1, const std::string &expire=EmptyString)
const std::string createNode(const JID &service, const std::string &node, DataForm *config, ResultHandler *handler)
bool removeID(const std::string &id)
const std::string requestItems(const JID &service, const std::string &node, const std::string &subid, int maxItems, ResultHandler *handler)
const std::string unsubscribe(const JID &service, const std::string &node, const std::string &subid, ResultHandler *handler, const JID &jid=JID())
virtual void handleIqID(const IQ &iq, int context)
const std::string deleteItem(const JID &service, const std::string &node, const ItemList &items, bool notify, ResultHandler *handler)
const std::string getDefaultNodeConfig(const JID &service, NodeType type, ResultHandler *handler)
const std::string purgeNode(const JID &service, const std::string &node, ResultHandler *handler)
const std::string publishItem(const JID &service, const std::string &node, ItemList &items, DataForm *options, ResultHandler *handler)
const std::string deleteNode(const JID &service, const std::string &node, ResultHandler *handler)
A virtual interface to receive item related requests results.
virtual void handleItems(const std::string &id, const JID &service, const std::string &node, const ItemList &itemList, const Error *error=0)=0
virtual void handleSubscriptionOptionsResult(const std::string &id, const JID &service, const JID &jid, const std::string &node, const std::string &sid=EmptyString, const Error *error=0)=0
virtual void handleAffiliations(const std::string &id, const JID &service, const AffiliationMap &affMap, const Error *error=0)=0
virtual void handleDefaultNodeConfig(const std::string &id, const JID &service, const DataForm *config, const Error *error=0)=0
virtual void handleNodeDeletion(const std::string &id, const JID &service, const std::string &node, const Error *error=0)=0
virtual void handleNodeConfigResult(const std::string &id, const JID &service, const std::string &node, const Error *error=0)=0
virtual void handleSubscriptionOptions(const std::string &id, const JID &service, const JID &jid, const std::string &node, const DataForm *options, const std::string &sid=EmptyString, const Error *error=0)=0
virtual void handleSubscriptions(const std::string &id, const JID &service, const SubscriptionMap &subMap, const Error *error=0)=0
virtual void handleUnsubscriptionResult(const std::string &id, const JID &service, const Error *error=0)=0
virtual void handleSubscribers(const std::string &id, const JID &service, const std::string &node, const SubscriptionList &list, const Error *error=0)=0
virtual void handleItemPublication(const std::string &id, const JID &service, const std::string &node, const ItemList &itemList, const Error *error=0)=0
virtual void handleSubscriptionResult(const std::string &id, const JID &service, const std::string &node, const std::string &sid, const JID &jid, const SubscriptionType subType, const Error *error=0)=0
virtual void handleAffiliatesResult(const std::string &id, const JID &service, const std::string &node, const AffiliateList *list, const Error *error=0)=0
virtual void handleAffiliates(const std::string &id, const JID &service, const std::string &node, const AffiliateList *list, const Error *error=0)=0
virtual void handleNodePurge(const std::string &id, const JID &service, const std::string &node, const Error *error=0)=0
virtual void handleItemDeletion(const std::string &id, const JID &service, const std::string &node, const ItemList &itemList, const Error *error=0)=0
virtual void handleNodeCreation(const std::string &id, const JID &service, const std::string &node, const Error *error=0)=0
virtual void handleNodeConfig(const std::string &id, const JID &service, const std::string &node, const DataForm *config, const Error *error=0)=0
virtual void handleSubscribersResult(const std::string &id, const JID &service, const std::string &node, const SubscriberList *list, const Error *error=0)=0
An implementation/abstraction of Stanza Headers and Internet Metadata (SHIM, XEP-0131).
void addExtension(const StanzaExtension *se)
const Error * error() const
const std::string & id() const
const StanzaExtension * findExtension(int type) const
An abstraction of a subscription stanza.
void clearList(std::list< T * > &L)
The namespace for the gloox library.
std::list< Tag * > TagList
const std::string EmptyString
std::list< const Tag * > ConstTagList
const std::string XMLNS_PUBSUB_OWNER
const std::string XMLNS_PUBSUB