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 )
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 )
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" );
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" );
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" );
429 m_options.df =
new DataForm( config->findChild(
"x",
XMLNS_X_DATA ) );
433 Manager::PubSub::~PubSub()
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" );
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 c->addAttribute(
"node", m_node );
550 Tag* config =
new Tag( t,
"configure" );
552 config->addChild( m_options.df->tag() );
557 StanzaExtension* Manager::PubSub::clone()
const
559 PubSub* p =
new PubSub();
560 p->m_affiliationMap = m_affiliationMap;
561 p->m_subscriptionMap = m_subscriptionMap;
564 p->m_options.node = m_options.node;
565 p->m_options.df = m_options.df ?
new DataForm( *(m_options.df) ) : 0;
569 p->m_subid = m_subid;
570 ItemList::const_iterator it = m_items.begin();
571 for( ; it != m_items.end(); ++it )
572 p->m_items.push_back(
new Item( *(*it) ) );
574 p->m_maxItems = m_maxItems;
575 p->m_notify = m_notify;
592 const std::string Manager::getSubscriptionsOrAffiliations(
const JID& service,
594 TrackContext context )
596 if( !m_parent || !handler || !service || context == InvalidContext )
599 const std::string&
id = m_parent->
getID();
601 iq.addExtension(
new PubSub( context ) );
603 m_trackMapMutex.
lock();
604 m_resultHandlerTrackMap[id] = handler;
606 m_parent->
send( iq,
this, context );
611 const std::string& node,
616 const std::string& expire
619 if( !m_parent || !handler || !service || node.empty() )
637 field->
setValue( util::int2string( depth ) );
640 if( !expire.empty() )
647 return subscribe( service, node, handler, jid, options );
651 const std::string& node,
657 if( !m_parent || !handler || !service || node.empty() )
660 const std::string&
id = m_parent->
getID();
663 ps->setJID( jid ? jid : m_parent->
jid() );
665 if( options != NULL )
666 ps->setOptions( node, options );
669 m_trackMapMutex.
lock();
670 m_resultHandlerTrackMap[id] = handler;
671 m_nopTrackMap[id] = node;
678 const std::string& node,
679 const std::string& subid,
683 if( !m_parent || !handler || !service )
686 const std::string&
id = m_parent->
getID();
688 PubSub* ps =
new PubSub( Unsubscription );
690 ps->setJID( jid ? jid : m_parent->
jid() );
691 ps->setSubscriptionID( subid );
694 m_trackMapMutex.
lock();
695 m_resultHandlerTrackMap[id] = handler;
698 m_parent->
send( iq,
this, Unsubscription );
702 const std::string Manager::subscriptionOptions( TrackContext context,
705 const std::string& node,
708 const std::string& subid )
710 if( !m_parent || !handler || !service )
713 const std::string&
id = m_parent->
getID();
715 PubSub* ps =
new PubSub( context );
716 ps->setJID( jid ? jid : m_parent->
jid() );
718 ps->setSubscriptionID( subid );
719 ps->setOptions( node, df );
720 iq.addExtension( ps );
722 m_trackMapMutex.
lock();
723 m_resultHandlerTrackMap[id] = handler;
725 m_parent->
send( iq,
this, context );
730 const std::string& node,
731 const std::string& subid,
735 if( !m_parent || !service || !handler )
738 const std::string&
id = m_parent->
getID();
740 PubSub* ps =
new PubSub( RequestItems );
742 ps->setSubscriptionID( subid );
743 ps->setMaxItems( maxItems );
746 m_trackMapMutex.
lock();
747 m_resultHandlerTrackMap[id] = handler;
749 m_parent->
send( iq,
this, RequestItems );
754 const std::string& node,
755 const std::string& subid,
756 const ItemList& items,
759 if( !m_parent || !service || !handler )
762 const std::string&
id = m_parent->
getID();
764 PubSub* ps =
new PubSub( RequestItems );
766 ps->setSubscriptionID( subid );
767 ps->setItems( items );
770 m_trackMapMutex.
lock();
771 m_resultHandlerTrackMap[id] = handler;
773 m_parent->
send( iq,
this, RequestItems );
778 const std::string& node,
783 if( !m_parent || !handler )
789 const std::string&
id = m_parent->
getID();
791 PubSub* ps =
new PubSub( PublishItem );
793 ps->setItems( items );
797 m_trackMapMutex.
lock();
798 m_resultHandlerTrackMap[id] = handler;
800 m_parent->
send( iq,
this, PublishItem );
805 const std::string& node,
806 const ItemList& items,
810 if( !m_parent || !handler || !service )
813 const std::string&
id = m_parent->
getID();
815 PubSub* ps =
new PubSub( DeleteItem );
817 ps->setItems( items );
818 ps->setNotify( notify );
821 m_trackMapMutex.
lock();
822 m_resultHandlerTrackMap[id] = handler;
824 m_parent->
send( iq,
this, DeleteItem );
829 const std::string& node,
833 if( !m_parent || !handler || !service || node.empty() )
836 const std::string&
id = m_parent->
getID();
838 PubSub* ps =
new PubSub( CreateNode );
843 m_trackMapMutex.
lock();
844 m_nopTrackMap[id] = node;
845 m_resultHandlerTrackMap[id] = handler;
847 m_parent->
send( iq,
this, CreateNode );
852 const std::string& node,
855 if( !m_parent || !handler || !service || node.empty() )
858 const std::string&
id = m_parent->
getID();
860 PubSubOwner* pso =
new PubSubOwner( DeleteNode );
861 pso->setNode( node );
864 m_trackMapMutex.
lock();
865 m_nopTrackMap[id] = node;
866 m_resultHandlerTrackMap[id] = handler;
868 m_parent->
send( iq,
this, DeleteNode );
876 if( !m_parent || !handler || !service )
879 const std::string&
id = m_parent->
getID();
881 PubSubOwner* pso =
new PubSubOwner( DefaultNodeConfig );
887 pso->setConfig( df );
891 m_trackMapMutex.
lock();
892 m_resultHandlerTrackMap[id] = handler;
894 m_parent->
send( iq,
this, DefaultNodeConfig );
898 const std::string Manager::nodeConfig(
const JID& service,
899 const std::string& node,
903 if( !m_parent || !handler || !service || node.empty() )
906 const std::string&
id = m_parent->
getID();
908 PubSubOwner* pso =
new PubSubOwner( config ? SetNodeConfig : GetNodeConfig );
909 pso->setNode( node );
911 pso->setConfig( config );
912 iq.addExtension( pso );
914 m_trackMapMutex.
lock();
915 m_nopTrackMap[id] = node;
916 m_resultHandlerTrackMap[id] = handler;
918 m_parent->
send( iq,
this, config ? SetNodeConfig : GetNodeConfig );
922 const std::string Manager::subscriberList( TrackContext ctx,
924 const std::string& node,
925 const SubscriberList& subList,
926 ResultHandler* handler )
928 if( !m_parent || !handler || !service || node.empty() )
931 const std::string&
id = m_parent->
getID();
933 PubSubOwner* pso =
new PubSubOwner( ctx );
934 pso->setNode( node );
935 pso->setSubscriberList( subList );
936 iq.addExtension( pso );
938 m_trackMapMutex.
lock();
939 m_nopTrackMap[id] = node;
940 m_resultHandlerTrackMap[id] = handler;
942 m_parent->
send( iq,
this, ctx );
946 const std::string Manager::affiliateList( TrackContext ctx,
948 const std::string& node,
949 const AffiliateList& affList,
950 ResultHandler* handler )
952 if( !m_parent || !handler || !service || node.empty() )
955 const std::string&
id = m_parent->
getID();
956 IQ iq( ctx == SetAffiliateList ?
IQ::Set :
IQ::Get, service,
id );
957 PubSubOwner* pso =
new PubSubOwner( ctx );
958 pso->setNode( node );
959 pso->setAffiliateList( affList );
960 iq.addExtension( pso );
962 m_trackMapMutex.
lock();
963 m_nopTrackMap[id] = node;
964 m_resultHandlerTrackMap[id] = handler;
966 m_parent->
send( iq,
this, ctx );
971 const std::string& node,
974 if( !m_parent || !handler || !service || node.empty() )
977 const std::string&
id = m_parent->
getID();
979 PubSubOwner* pso =
new PubSubOwner( PurgeNodeItems );
980 pso->setNode( node );
983 m_trackMapMutex.
lock();
984 m_nopTrackMap[id] = node;
985 m_resultHandlerTrackMap[id] = handler;
987 m_parent->
send( iq,
this, PurgeNodeItems );
993 m_trackMapMutex.
lock();
994 ResultHandlerTrackMap::iterator ith = m_resultHandlerTrackMap.find(
id );
995 if( ith == m_resultHandlerTrackMap.end() )
1000 m_resultHandlerTrackMap.erase( ith );
1001 m_trackMapMutex.
unlock();
1007 const JID& service = iq.
from();
1008 const std::string&
id = iq.
id();
1010 m_trackMapMutex.
lock();
1011 ResultHandlerTrackMap::iterator ith = m_resultHandlerTrackMap.find(
id );
1012 if( ith == m_resultHandlerTrackMap.end() )
1014 m_trackMapMutex.
unlock();
1018 m_resultHandlerTrackMap.erase( ith );
1019 m_trackMapMutex.
unlock();
1034 SubscriptionMap sm = ps->subscriptions();
1037 SubscriptionMap::const_iterator it = sm.begin();
1038 const SubscriptionList& lst = (*it).second;
1039 if( lst.size() == 1 )
1041 SubscriptionList::const_iterator it2 = lst.begin();
1043 (*it2).type, error );
1048 case Unsubscription:
1053 case GetSubscriptionList:
1060 ps->subscriptions(),
1064 case GetAffiliationList:
1082 ps->items(), error );
1089 ps ? ps->items() : ItemList(),
1105 case DefaultNodeConfig:
1116 case GetSubscriptionOptions:
1117 case GetSubscriberList:
1118 case SetSubscriberList:
1119 case GetAffiliateList:
1120 case SetAffiliateList:
1125 case PurgeNodeItems:
1129 case GetSubscriptionOptions:
1138 ps->subscriptionID(),
1143 case GetSubscriberList:
1148 const SubscriptionMap& sm = ps->subscriptions();
1149 SubscriptionMap::const_iterator itsm = sm.find( ps->node() );
1150 if( itsm != sm.end() )
1155 case SetSubscriptionOptions:
1156 case SetSubscriberList:
1157 case SetAffiliateList:
1161 case PurgeNodeItems:
1163 m_trackMapMutex.
lock();
1164 NodeOperationTrackMap::iterator it = m_nopTrackMap.find(
id );
1165 if( it != m_nopTrackMap.end() )
1167 const std::string& node = (*it).second;
1170 case SetSubscriptionOptions:
1178 ps->subscriptionID(),
1187 case SetSubscriberList:
1190 case SetAffiliateList:
1202 case PurgeNodeItems:
1206 m_nopTrackMap.erase( it );
1208 m_trackMapMutex.
unlock();
1211 case GetAffiliateList:
1216 rh->
handleAffiliates(
id, service, pso->node(), pso->affiliateList(), error );
virtual void handleItemPublication(const std::string &id, const JID &service, const std::string &node, const ItemList &itemList, 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
const std::string purgeNode(const JID &service, const std::string &node, ResultHandler *handler)
virtual void handleNodeConfigResult(const std::string &id, const JID &service, const std::string &node, const Error *error=0)=0
const std::string deleteNode(const JID &service, const std::string &node, ResultHandler *handler)
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
void clearList(std::list< T * > &L)
An abstraction of an IQ stanza.
const std::string getDefaultNodeConfig(const JID &service, NodeType type, ResultHandler *handler)
void addExtension(const StanzaExtension *se)
virtual void handleNodeConfig(const std::string &id, const JID &service, const std::string &node, const DataForm *config, const Error *error=0)=0
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)
void registerStanzaExtension(StanzaExtension *ext)
virtual void handleSubscribers(const std::string &id, const JID &service, const std::string &node, const SubscriptionList &list, const Error *error=0)=0
std::list< Tag * > TagList
virtual void handleUnsubscriptionResult(const std::string &id, const JID &service, 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 handleAffiliatesResult(const std::string &id, const JID &service, const std::string &node, const AffiliateList *list, const Error *error=0)=0
std::list< const Tag * > ConstTagList
virtual void handleIqID(const IQ &iq, int context)
const std::string XMLNS_PUBSUB_OWNER
const std::string publishItem(const JID &service, const std::string &node, ItemList &items, DataForm *options, ResultHandler *handler)
A stanza error abstraction implemented as a StanzaExtension.
const std::string unsubscribe(const JID &service, const std::string &node, const std::string &subid, ResultHandler *handler, const JID &jid=JID())
virtual void handleNodePurge(const std::string &id, const JID &service, const std::string &node, const Error *error=0)=0
virtual void handleNodeDeletion(const std::string &id, const JID &service, const std::string &node, const Error *error=0)=0
const std::string XMLNS_X_DATA
virtual void handleItems(const std::string &id, const JID &service, const std::string &node, const ItemList &itemList, 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
bool removeID(const std::string &id)
The namespace for the gloox library.
virtual void handleSubscribersResult(const std::string &id, const JID &service, const std::string &node, const SubscriberList *list, const Error *error=0)=0
virtual void handleNodeCreation(const std::string &id, const JID &service, const std::string &node, const Error *error=0)=0
A virtual interface to receive item related requests results.
const std::string XMLNS_PUBSUB
virtual void handleItemDeletion(const std::string &id, const JID &service, const std::string &node, const ItemList &itemList, const Error *error=0)=0
Manager(ClientBase *parent)
const std::string requestItems(const JID &service, const std::string &node, const std::string &subid, int maxItems, ResultHandler *handler)
const std::string getID()
const Error * error() const
An abstraction of a subscription stanza.
An implementation/abstraction of Stanza Headers and Internet Metadata (SHIM, XEP-0131).
virtual void handleDefaultNodeConfig(const std::string &id, const JID &service, const DataForm *config, const Error *error=0)=0
const std::string & id() const
virtual void handleAffiliations(const std::string &id, const JID &service, const AffiliationMap &affMap, const Error *error=0)=0
const std::string EmptyString
const std::string deleteItem(const JID &service, const std::string &node, const ItemList &items, bool notify, ResultHandler *handler)
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
const StanzaExtension * findExtension(int type) const