20 #include "iqhandler.h"
33 class DiscoNodeHandler;
74 const std::string&
node()
const {
return m_node; }
87 bool hasFeature(
const std::string& feature )
const;
111 virtual const std::string& filterString()
const;
116 return new Info( tag );
122 return new Info( *
this );
126 virtual Tag* tag()
const;
129 #ifdef DISCO_INFO_TEST
139 Info(
const std::string& node =
EmptyString,
bool defaultFeatures =
false );
163 void setNode(
const std::string& node ) { m_node = node; }
169 void setFeatures(
const StringList& features )
173 m_features.merge( fl );
182 void setIdentities(
const IdentityList& identities ) { m_identities = identities; }
186 IdentityList m_identities;
209 Identity(
const std::string& category,
210 const std::string& type,
211 const std::string& name );
228 const std::string&
category()
const {
return m_category; }
234 const std::string&
type()
const {
return m_type; }
240 const std::string&
name()
const {
return m_name; }
255 std::string m_category;
299 void setItems(
const ItemList& items );
305 const std::string&
node()
const {
return m_node; }
314 virtual const std::string& filterString()
const;
319 return new Items( tag );
323 virtual Tag* tag()
const;
328 return new Items( *
this );
332 #ifdef DISCO_ITEMS_TEST
364 const std::string& node,
365 const std::string& name )
366 : m_jid( jid ), m_node( node ), m_name( name ) {}
383 const std::string&
node()
const {
return m_node; }
389 const std::string&
name()
const {
return m_name; }
422 void addFeature(
const std::string& feature )
423 { m_features.push_back( feature ); }
430 void removeFeature(
const std::string& feature )
431 { m_features.remove( feature ); }
438 const StringList features(
bool defaultFeatures =
false )
const;
451 void getDiscoInfo(
const JID& to,
const std::string& node,
DiscoHandler* dh,
int context,
453 { getDisco( to, node, dh, context, GetDiscoInfo, tid ); }
466 void getDiscoItems(
const JID& to,
const std::string& node,
DiscoHandler* dh,
int context,
468 { getDisco( to, node, dh, context, GetDiscoItems, tid ); }
478 void setVersion(
const std::string& name,
const std::string& version,
485 const std::string&
name()
const {
return m_versionName; }
491 const std::string&
version()
const {
return m_versionVersion; }
497 const std::string&
os()
const {
return m_versionOs; }
512 void setIdentity(
const std::string& category,
const std::string& type,
521 void addIdentity(
const std::string& category,
const std::string& type,
523 { m_identities.push_back(
new Identity( category, type, name ) ); }
553 { m_discoHandlers.push_back( dh ); }
586 virtual bool handleIq(
const IQ& iq );
589 virtual void handleIqID(
const IQ& iq,
int context );
604 void getDisco(
const JID& to,
const std::string& node, DiscoHandler* dh,
605 int context, IdType idType,
const std::string& tid );
607 struct DiscoHandlerContext
613 ClientBase* m_parent;
615 typedef std::list<DiscoHandler*> DiscoHandlerList;
616 typedef std::list<DiscoNodeHandler*> DiscoNodeHandlerList;
617 typedef std::map<std::string, DiscoNodeHandlerList> DiscoNodeHandlerMap;
618 typedef std::map<std::string, DiscoHandlerContext> DiscoHandlerMap;
620 DiscoHandlerList m_discoHandlers;
621 DiscoNodeHandlerMap m_nodeHandlers;
622 DiscoHandlerMap m_track;
623 IdentityList m_identities;
628 std::string m_versionName;
629 std::string m_versionVersion;
630 std::string m_versionOs;