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; }
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 ) ); }
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;
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
A virtual interface that enables objects to receive Service Discovery (XEP-0030) events.
Derived classes can be registered as NodeHandlers for certain nodes with the Disco object.
An abstraction of a Disco identity (Service Discovery, XEP-0030).
const std::string & category() const
const std::string & name() const
const std::string & type() const
An abstraction of a Disco Info element (from Service Discovery, XEP-0030) as a StanzaExtension.
const std::string & node() const
const StringList & features() const
const DataForm * form() const
virtual StanzaExtension * newInstance(const Tag *tag) const
virtual StanzaExtension * clone() const
const IdentityList & identities() const
An abstraction of a Disco item (Service Discovery, XEP-0030).
const std::string & node() const
Item(const JID &jid, const std::string &node, const std::string &name)
const std::string & name() const
An abstraction of a Disco query element (from Service Discovery, XEP-0030) in the disco::items namesp...
const std::string & node() const
virtual StanzaExtension * newInstance(const Tag *tag) const
const ItemList & items() const
virtual StanzaExtension * clone() const
This class implements XEP-0030 (Service Discovery) and XEP-0092 (Software Version).
const std::string & version() const
const DataForm * form() const
void getDiscoInfo(const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString)
void removeFeature(const std::string &feature)
void registerDiscoHandler(DiscoHandler *dh)
void addFeature(const std::string &feature)
std::list< Identity * > IdentityList
const std::string & name() const
const IdentityList & identities() const
void addIdentity(const std::string &category, const std::string &type, const std::string &name=EmptyString)
void getDiscoItems(const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString)
const std::string & os() const
std::list< Item * > ItemList
An abstraction of an IQ stanza.
A virtual interface which can be reimplemented to receive IQ stanzas.
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
This is an abstraction of an XML element.
The namespace for the gloox library.
std::list< std::string > StringList
const std::string EmptyString
std::map< std::string, std::string > StringMap