14 #include "capabilities.h"
27 m_hash(
"sha-1" ), m_valid( false )
68 Disco::IdentityList::const_iterator it = il.begin();
69 for( ; it != il.end(); ++it )
71 std::string
id = (*it)->category();
83 StringList::const_iterator it2 = sl.begin();
84 for( ; it2 != sl.end(); ++it2 )
93 for( ; it2 != f.end(); ++it2 )
101 DataForm::FieldList::const_iterator it3 = form->
fields().begin();
102 typedef std::map<std::string, StringList> MapSSL;
105 for( ; it3 != form->
fields().end(); ++it3 )
107 if( (*it3)->name() ==
"FORM_TYPE" )
109 s += (*it3)->value();
113 m.insert( std::make_pair( (*it3)->name(), (*it3)->values() ) );
116 MapSSL::iterator it4 = m.begin();
117 for( ; it4 != m.end(); ++it4 )
121 it2 = it4->second.begin();
122 for( ; it2 != it4->second.end(); ++it2 )
132 std::string Capabilities::generate(
const Disco::Info* info )
134 return info ? generate( info->identities(), info->features(), info->form() ) :
EmptyString;
137 std::string Capabilities::generate(
const Disco* disco )
139 return disco ? generate( disco->identities(), disco->features(), disco->form() ) :
EmptyString;
144 static const std::string filter =
"/presence/c[@xmlns='" +
XMLNS_CAPS +
"']";
150 if( !m_valid || m_node.empty() )
170 Disco::IdentityList::const_iterator it = il.begin();
171 for( ; it != il.end(); ++it )
This is an implementation of XEP-0115 (Entity Capabilities).
Capabilities(Disco *disco)
const std::string ver() const
virtual const std::string & filterString() const
virtual Disco::ItemList handleDiscoNodeItems(const JID &from, const JID &to, const std::string &node=EmptyString)
virtual Disco::IdentityList handleDiscoNodeIdentities(const JID &from, const std::string &node)
virtual StringList handleDiscoNodeFeatures(const JID &from, const std::string &node)
virtual Tag * tag() const
An abstraction of a Disco identity (Service Discovery, XEP-0030).
This class implements XEP-0030 (Service Discovery) and XEP-0092 (Software Version).
const DataForm * form() const
void removeNodeHandlers(DiscoNodeHandler *nh)
void registerNodeHandler(DiscoNodeHandler *nh, const std::string &node)
const StringList features(bool defaultFeatures=false) const
std::list< Identity * > IdentityList
const IdentityList & identities() const
std::list< Item * > ItemList
An implementation of SHA1.
void feed(const unsigned char *data, unsigned length)
const std::string binary()
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.
bool addAttribute(Attribute *attr)
bool hasAttribute(const std::string &name, const std::string &value=EmptyString) const
const std::string & findAttribute(const std::string &name) const
const std::string & name() const
bool setXmlns(const std::string &xmlns, const std::string &prefix=EmptyString)
const std::string encode64(const std::string &input)
The namespace for the gloox library.
std::list< std::string > StringList
const std::string GLOOX_CAPS_NODE
const std::string EmptyString
const std::string XMLNS_CAPS