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 SubscriptionList lst;
303 m_node = sl->findAttribute(
"node" );
304 m_subscriptionMap.insert( std::make_pair( m_node, lst ) );
305 TagList::const_iterator it = l.begin();
306 for( ; it != l.end(); ++it )
308 const std::string& sub = (*it)->findAttribute(
"subscription" );
309 const std::string& subid = (*it)->findAttribute(
"subid" );
311 si.jid.setJID( (*it)->findAttribute(
"jid" ) );
312 si.type = subscriptionType( sub );
319 ConstTagList l = tag->findTagList(
"pubsub/affiliations/affiliation" );
322 m_ctx = GetAffiliationList;
323 ConstTagList::const_iterator it = l.begin();
324 for( ; it != l.end(); ++it )
326 const std::string& node = (*it)->findAttribute(
"node" );
327 const std::string& aff = (*it)->findAttribute(
"affiliation" );
328 m_affiliationMap[node] = affiliationType( aff );
332 const Tag* s = tag->findTag(
"pubsub/subscribe" );
335 m_ctx = Subscription;
336 m_node = s->findAttribute(
"node" );
337 m_jid = s->findAttribute(
"jid" );
339 const Tag* u = tag->findTag(
"pubsub/unsubscribe" );
342 m_ctx = Unsubscription;
343 m_node = u->findAttribute(
"node" );
344 m_jid = u->findAttribute(
"jid" );
345 m_subid = u->findAttribute(
"subid" );
347 const Tag* o = tag->findTag(
"pubsub/options" );
350 if( m_ctx == InvalidContext )
352 Tag* parent = tag->parent();
353 if( parent && parent->findAttribute(
"type") ==
"set" )
354 m_ctx = SetSubscriptionOptions;
356 m_ctx = GetSubscriptionOptions;
358 if( m_ctx == SetSubscriptionOptions || m_ctx == GetSubscriptionOptions )
362 m_node = o->findAttribute(
"node" );
363 m_jid.setJID( o->findAttribute(
"jid" ) );
364 m_subid = o->findAttribute(
"subid" );
366 m_options.node = o->findAttribute(
"node" );
367 m_options.df =
new DataForm( o->findChild(
"x",
"xmlns",
XMLNS_X_DATA ) );
369 const Tag* su = tag->findTag(
"pubsub/subscription" );
373 si.jid.setJID( su->findAttribute(
"jid" ) );
374 si.subid = su->findAttribute(
"subid" );
375 si.type = subscriptionType( su->findAttribute(
"subscription" ) );
376 SubscriptionList& lst = m_subscriptionMap[su->findAttribute(
"node" )];
380 const Tag* i = tag->findTag(
"pubsub/items" );
383 m_ctx = RequestItems;
384 m_node = i->findAttribute(
"node" );
385 m_subid = i->findAttribute(
"subid" );
386 m_maxItems = atoi( i->findAttribute(
"max_items" ).c_str() );
387 const TagList& l = i->children();
388 TagList::const_iterator it = l.begin();
389 for( ; it != l.end(); ++it )
390 m_items.push_back(
new Item( (*it) ) );
393 const Tag* p = tag->findTag(
"pubsub/publish" );
397 m_node = p->findAttribute(
"node" );
398 const TagList& l = p->children();
399 TagList::const_iterator it = l.begin();
400 for( ; it != l.end(); ++it )
401 m_items.push_back(
new Item( (*it) ) );
404 const Tag* r = tag->findTag(
"pubsub/retract" );
408 m_node = r->findAttribute(
"node" );
409 m_notify = r->hasAttribute(
"notify",
"1" ) || r->hasAttribute(
"notify",
"true" );
410 const TagList& l = r->children();
411 TagList::const_iterator it = l.begin();
412 for( ; it != l.end(); ++it )
413 m_items.push_back(
new Item( (*it) ) );
416 const Tag* c = tag->findTag(
"pubsub/create" );
420 m_node = c->findAttribute(
"node" );
421 const Tag* config = tag->findTag(
"pubsub/configure" );
423 m_options.df =
new DataForm( config->findChild(
"x",
XMLNS_X_DATA ) );
427 Manager::PubSub::~PubSub()
433 const std::string& Manager::PubSub::filterString()
const
435 static const std::string filter =
"/iq/pubsub[@xmlns='" +
XMLNS_PUBSUB +
"']";
439 Tag* Manager::PubSub::tag()
const
441 if( m_ctx == InvalidContext )
444 Tag* t =
new Tag(
"pubsub" );
447 if( m_ctx == GetSubscriptionList )
449 Tag* sub =
new Tag( t,
"subscriptions" );
450 SubscriptionMap::const_iterator it = m_subscriptionMap.begin();
451 for( ; it != m_subscriptionMap.end(); ++it )
453 const SubscriptionList& lst = (*it).second;
454 SubscriptionList::const_iterator it2 = lst.begin();
455 for( ; it2 != lst.end(); ++it2 )
457 Tag* s =
new Tag( sub,
"subscription" );
458 s->addAttribute(
"node", (*it).first );
459 s->addAttribute(
"jid", (*it2).jid );
460 s->addAttribute(
"subscription", subscriptionValue( (*it2).type ) );
461 s->addAttribute(
"sid", (*it2).subid );
465 else if( m_ctx == GetAffiliationList )
468 Tag* aff =
new Tag( t,
"affiliations" );
469 AffiliationMap::const_iterator it = m_affiliationMap.begin();
470 for( ; it != m_affiliationMap.end(); ++it )
472 Tag* a =
new Tag( aff,
"affiliation" );
473 a->addAttribute(
"node", (*it).first );
474 a->addAttribute(
"affiliation", affiliationValue( (*it).second ) );
477 else if( m_ctx == Subscription )
479 Tag* s =
new Tag( t,
"subscribe" );
480 s->addAttribute(
"node", m_node );
481 s->addAttribute(
"jid", m_jid.full() );
484 Tag* o =
new Tag( t,
"options" );
485 o->addChild( m_options.df->tag() );
488 else if( m_ctx == Unsubscription )
490 Tag* u =
new Tag( t,
"unsubscribe" );
491 u->addAttribute(
"node", m_node );
492 u->addAttribute(
"jid", m_jid.full() );
493 u->addAttribute(
"subid", m_subid );
495 else if( m_ctx == GetSubscriptionOptions
496 || m_ctx == SetSubscriptionOptions )
498 Tag* o =
new Tag( t,
"options" );
499 o->addAttribute(
"node", m_options.node );
500 o->addAttribute(
"jid", m_jid.full() );
501 if( !m_subid.empty() )
502 o->addAttribute(
"subid", m_subid );
504 o->addChild( m_options.df->tag() );
506 else if( m_ctx == RequestItems )
508 Tag* i =
new Tag( t,
"items" );
509 i->addAttribute(
"node", m_node );
511 i->addAttribute(
"max_items", m_maxItems );
512 i->addAttribute(
"subid", m_subid );
513 ItemList::const_iterator it = m_items.begin();
514 for( ; it != m_items.end(); ++it )
515 i->addChild( (*it)->tag() );
517 else if( m_ctx == PublishItem )
519 Tag* p =
new Tag( t,
"publish" );
520 p->addAttribute(
"node", m_node );
521 ItemList::const_iterator it = m_items.begin();
522 for( ; it != m_items.end(); ++it )
523 p->addChild( (*it)->tag() );
526 Tag* po =
new Tag(
"publish-options" );
527 po->addChild( m_options.df->tag() );
530 else if( m_ctx == DeleteItem )
532 Tag* r =
new Tag( t,
"retract" );
533 r->addAttribute(
"node", m_node );
535 r->addAttribute(
"notify",
"true" );
536 ItemList::const_iterator it = m_items.begin();
537 for( ; it != m_items.end(); ++it )
538 r->addChild( (*it)->tag() );
540 else if( m_ctx == CreateNode )
542 Tag* c =
new Tag( t,
"create" );
543 c->addAttribute(
"node", m_node );
544 Tag* config =
new Tag( t,
"configure" );
546 config->addChild( m_options.df->tag() );
551 StanzaExtension* Manager::PubSub::clone()
const
553 PubSub* p =
new PubSub();
554 p->m_affiliationMap = m_affiliationMap;
555 p->m_subscriptionMap = m_subscriptionMap;
558 p->m_options.node = m_options.node;
559 p->m_options.df = m_options.df ?
new DataForm( *(m_options.df) ) : 0;
563 p->m_subid = m_subid;
564 ItemList::const_iterator it = m_items.begin();
565 for( ; it != m_items.end(); ++it )
566 p->m_items.push_back(
new Item( *(*it) ) );
568 p->m_maxItems = m_maxItems;
569 p->m_notify = m_notify;
586 const std::string Manager::getSubscriptionsOrAffiliations(
const JID& service,
588 TrackContext context )
590 if( !m_parent || !handler || !service || context == InvalidContext )
593 const std::string&
id = m_parent->
getID();
595 iq.addExtension(
new PubSub( context ) );
597 m_trackMapMutex.
lock();
598 m_resultHandlerTrackMap[id] = handler;
600 m_parent->
send( iq,
this, context );
605 const std::string& node,
610 const std::string& expire
613 if( !m_parent || !handler || !service || node.empty() )
631 field->
setValue( util::int2string( depth ) );
634 if( !expire.empty() )
641 return subscribe( service, node, handler, jid, options );
645 const std::string& node,
651 if( !m_parent || !handler || !service || node.empty() )
654 const std::string&
id = m_parent->
getID();
657 ps->setJID( jid ? jid : m_parent->
jid() );
659 if( options != NULL )
660 ps->setOptions( node, options );
663 m_trackMapMutex.
lock();
664 m_resultHandlerTrackMap[id] = handler;
665 m_nopTrackMap[id] = node;
672 const std::string& node,
673 const std::string& subid,
677 if( !m_parent || !handler || !service )
680 const std::string&
id = m_parent->
getID();
682 PubSub* ps =
new PubSub( Unsubscription );
684 ps->setJID( jid ? jid : m_parent->
jid() );
685 ps->setSubscriptionID( subid );
688 m_trackMapMutex.
lock();
689 m_resultHandlerTrackMap[id] = handler;
692 m_parent->
send( iq,
this, Unsubscription );
696 const std::string Manager::subscriptionOptions( TrackContext context,
699 const std::string& node,
702 const std::string& subid )
704 if( !m_parent || !handler || !service )
707 const std::string&
id = m_parent->
getID();
709 PubSub* ps =
new PubSub( context );
710 ps->setJID( jid ? jid : m_parent->
jid() );
712 ps->setSubscriptionID( subid );
713 ps->setOptions( node, df );
714 iq.addExtension( ps );
716 m_trackMapMutex.
lock();
717 m_resultHandlerTrackMap[id] = handler;
719 m_parent->
send( iq,
this, context );
724 const std::string& node,
725 const std::string& subid,
729 if( !m_parent || !service || !handler )
732 const std::string&
id = m_parent->
getID();
734 PubSub* ps =
new PubSub( RequestItems );
736 ps->setSubscriptionID( subid );
737 ps->setMaxItems( maxItems );
740 m_trackMapMutex.
lock();
741 m_resultHandlerTrackMap[id] = handler;
743 m_parent->
send( iq,
this, RequestItems );
748 const std::string& node,
749 const std::string& subid,
750 const ItemList& items,
753 if( !m_parent || !service || !handler )
756 const std::string&
id = m_parent->
getID();
758 PubSub* ps =
new PubSub( RequestItems );
760 ps->setSubscriptionID( subid );
761 ps->setItems( items );
764 m_trackMapMutex.
lock();
765 m_resultHandlerTrackMap[id] = handler;
767 m_parent->
send( iq,
this, RequestItems );
772 const std::string& node,
777 if( !m_parent || !handler )
783 const std::string&
id = m_parent->
getID();
785 PubSub* ps =
new PubSub( PublishItem );
787 ps->setItems( items );
791 m_trackMapMutex.
lock();
792 m_resultHandlerTrackMap[id] = handler;
794 m_parent->
send( iq,
this, PublishItem );
799 const std::string& node,
800 const ItemList& items,
804 if( !m_parent || !handler || !service )
807 const std::string&
id = m_parent->
getID();
809 PubSub* ps =
new PubSub( DeleteItem );
811 ps->setItems( items );
812 ps->setNotify( notify );
815 m_trackMapMutex.
lock();
816 m_resultHandlerTrackMap[id] = handler;
818 m_parent->
send( iq,
this, DeleteItem );
823 const std::string& node,
827 if( !m_parent || !handler || !service || node.empty() )
830 const std::string&
id = m_parent->
getID();
832 PubSub* ps =
new PubSub( CreateNode );
837 m_trackMapMutex.
lock();
838 m_nopTrackMap[id] = node;
839 m_resultHandlerTrackMap[id] = handler;
841 m_parent->
send( iq,
this, CreateNode );
846 const std::string& node,
849 if( !m_parent || !handler || !service || node.empty() )
852 const std::string&
id = m_parent->
getID();
854 PubSubOwner* pso =
new PubSubOwner( DeleteNode );
855 pso->setNode( node );
858 m_trackMapMutex.
lock();
859 m_nopTrackMap[id] = node;
860 m_resultHandlerTrackMap[id] = handler;
862 m_parent->
send( iq,
this, DeleteNode );
870 if( !m_parent || !handler || !service )
873 const std::string&
id = m_parent->
getID();
875 PubSubOwner* pso =
new PubSubOwner( DefaultNodeConfig );
881 pso->setConfig( df );
885 m_trackMapMutex.
lock();
886 m_resultHandlerTrackMap[id] = handler;
888 m_parent->
send( iq,
this, DefaultNodeConfig );
892 const std::string Manager::nodeConfig(
const JID& service,
893 const std::string& node,
897 if( !m_parent || !handler || !service || node.empty() )
900 const std::string&
id = m_parent->
getID();
902 PubSubOwner* pso =
new PubSubOwner( config ? SetNodeConfig : GetNodeConfig );
903 pso->setNode( node );
905 pso->setConfig( config );
906 iq.addExtension( pso );
908 m_trackMapMutex.
lock();
909 m_nopTrackMap[id] = node;
910 m_resultHandlerTrackMap[id] = handler;
912 m_parent->
send( iq,
this, config ? SetNodeConfig : GetNodeConfig );
916 const std::string Manager::subscriberList( TrackContext ctx,
918 const std::string& node,
919 const SubscriberList& subList,
920 ResultHandler* handler )
922 if( !m_parent || !handler || !service || node.empty() )
925 const std::string&
id = m_parent->
getID();
927 PubSubOwner* pso =
new PubSubOwner( ctx );
928 pso->setNode( node );
929 pso->setSubscriberList( subList );
930 iq.addExtension( pso );
932 m_trackMapMutex.
lock();
933 m_nopTrackMap[id] = node;
934 m_resultHandlerTrackMap[id] = handler;
936 m_parent->
send( iq,
this, ctx );
940 const std::string Manager::affiliateList( TrackContext ctx,
942 const std::string& node,
943 const AffiliateList& affList,
944 ResultHandler* handler )
946 if( !m_parent || !handler || !service || node.empty() )
949 const std::string&
id = m_parent->
getID();
950 IQ iq( ctx == SetAffiliateList ?
IQ::Set :
IQ::Get, service,
id );
951 PubSubOwner* pso =
new PubSubOwner( ctx );
952 pso->setNode( node );
953 pso->setAffiliateList( affList );
954 iq.addExtension( pso );
956 m_trackMapMutex.
lock();
957 m_nopTrackMap[id] = node;
958 m_resultHandlerTrackMap[id] = handler;
960 m_parent->
send( iq,
this, ctx );
965 const std::string& node,
968 if( !m_parent || !handler || !service || node.empty() )
971 const std::string&
id = m_parent->
getID();
973 PubSubOwner* pso =
new PubSubOwner( PurgeNodeItems );
974 pso->setNode( node );
977 m_trackMapMutex.
lock();
978 m_nopTrackMap[id] = node;
979 m_resultHandlerTrackMap[id] = handler;
981 m_parent->
send( iq,
this, PurgeNodeItems );
987 m_trackMapMutex.
lock();
988 ResultHandlerTrackMap::iterator ith = m_resultHandlerTrackMap.find(
id );
989 if( ith == m_resultHandlerTrackMap.end() )
994 m_resultHandlerTrackMap.erase( ith );
1001 const JID& service = iq.
from();
1002 const std::string&
id = iq.
id();
1004 m_trackMapMutex.
lock();
1005 ResultHandlerTrackMap::iterator ith = m_resultHandlerTrackMap.find(
id );
1006 if( ith == m_resultHandlerTrackMap.end() )
1008 m_trackMapMutex.
unlock();
1012 m_resultHandlerTrackMap.erase( ith );
1013 m_trackMapMutex.
unlock();
1028 SubscriptionMap sm = ps->subscriptions();
1031 SubscriptionMap::const_iterator it = sm.begin();
1032 const SubscriptionList& lst = (*it).second;
1033 if( lst.size() == 1 )
1035 SubscriptionList::const_iterator it2 = lst.begin();
1037 (*it2).type, error );
1042 case Unsubscription:
1047 case GetSubscriptionList:
1054 ps->subscriptions(),
1058 case GetAffiliationList:
1076 ps->items(), error );
1083 ps ? ps->items() : ItemList(),
1099 case DefaultNodeConfig:
1110 case GetSubscriptionOptions:
1111 case GetSubscriberList:
1112 case SetSubscriberList:
1113 case GetAffiliateList:
1114 case SetAffiliateList:
1119 case PurgeNodeItems:
1123 case GetSubscriptionOptions:
1132 ps->subscriptionID(),
1137 case GetSubscriberList:
1142 const SubscriptionMap& sm = ps->subscriptions();
1143 SubscriptionMap::const_iterator itsm = sm.find( ps->node() );
1144 if( itsm != sm.end() )
1149 case SetSubscriptionOptions:
1150 case SetSubscriberList:
1151 case SetAffiliateList:
1155 case PurgeNodeItems:
1157 m_trackMapMutex.
lock();
1158 NodeOperationTrackMap::iterator it = m_nopTrackMap.find(
id );
1159 if( it != m_nopTrackMap.end() )
1161 const std::string& node = (*it).second;
1164 case SetSubscriptionOptions:
1172 ps->subscriptionID(),
1181 case SetSubscriberList:
1184 case SetAffiliateList:
1196 case PurgeNodeItems:
1200 m_nopTrackMap.erase( it );
1202 m_trackMapMutex.
unlock();
1205 case GetAffiliateList:
1210 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