20 #include "iqhandler.h"
33 class DiscoNodeHandler;
74 const std::string&
node()
const {
return m_node; }
87 bool hasFeature(
const std::string& feature )
const;
93 const IdentityList&
identities()
const {
return m_identities; }
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; }
311 const ItemList&
items()
const {
return m_items; }
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; }
423 { m_features.push_back( feature ); }
431 { m_features.remove( feature ); }
438 const StringList features(
bool defaultFeatures =
false )
const;
453 { getDisco( to, node, dh, context, GetDiscoInfo, tid ); }
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 ) ); }
529 const IdentityList&
identities()
const {
return m_identities; }
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;
const std::string & name() const
void addFeature(const std::string &feature)
An abstraction of a Disco query element (from Service Discovery, XEP-0030) in the disco::items namesp...
const std::string & node() const
std::list< Item * > ItemList
const ItemList & items() const
const std::string & name() const
std::list< std::string > StringList
const IdentityList & identities() const
An abstraction of an IQ stanza.
const DataForm * form() const
void getDiscoItems(const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString)
std::list< Identity * > IdentityList
const std::string & name() const
const std::string & node() const
virtual StanzaExtension * newInstance(const Tag *tag) const
Derived classes can be registered as NodeHandlers for certain nodes with the Disco object...
const std::string & version() const
Item(const JID &jid, const std::string &node, const std::string &name)
void registerDiscoHandler(DiscoHandler *dh)
const std::string & type() const
The namespace for the gloox library.
This class abstracts a stanza extension, which is usually an element in a specific namespace...
virtual StanzaExtension * clone() const
const StringList & features() const
std::map< std::string, std::string > StringMap
const std::string & os() const
const std::string & category() const
An abstraction of a Disco Info element (from Service Discovery, XEP-0030) as a StanzaExtension.
const DataForm * form() const
A virtual interface which can be reimplemented to receive IQ stanzas.
An abstraction of a Disco item (Service Discovery, XEP-0030).
A virtual interface that enables objects to receive Service Discovery (XEP-0030) events.
void getDiscoInfo(const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString)
This class implements XEP-0030 (Service Discovery) and XEP-0092 (Software Version).
void addIdentity(const std::string &category, const std::string &type, const std::string &name=EmptyString)
void removeFeature(const std::string &feature)
virtual StanzaExtension * clone() const
const IdentityList & identities() const
virtual StanzaExtension * newInstance(const Tag *tag) const
const std::string EmptyString
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
This is an abstraction of an XML element.
An abstraction of a Disco identity (Service Discovery, XEP-0030).
const std::string & node() const