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 )
const std::string ver() const
void removeNodeHandlers(DiscoNodeHandler *nh)
bool setXmlns(const std::string &xmlns, const std::string &prefix=EmptyString)
std::list< Item * > ItemList
virtual const std::string & filterString() const
std::list< std::string > StringList
const DataForm * form() const
const std::string GLOOX_CAPS_NODE
std::list< Identity * > IdentityList
const std::string XMLNS_CAPS
const StringList features(bool defaultFeatures=false) const
void registerNodeHandler(DiscoNodeHandler *nh, const std::string &node)
The namespace for the gloox library.
const std::string encode64(const std::string &input)
This class abstracts a stanza extension, which is usually an element in a specific namespace...
Capabilities(Disco *disco)
const std::string & findAttribute(const std::string &name) const
bool hasAttribute(const std::string &name, const std::string &value=EmptyString) const
void feed(const unsigned char *data, unsigned length)
An implementation of SHA1.
bool addAttribute(Attribute *attr)
virtual Disco::IdentityList handleDiscoNodeIdentities(const JID &from, const std::string &node)
virtual Disco::ItemList handleDiscoNodeItems(const JID &from, const JID &to, const std::string &node=EmptyString)
const std::string & name() const
virtual Tag * tag() const
This class implements XEP-0030 (Service Discovery) and XEP-0092 (Software Version).
const IdentityList & identities() const
const std::string binary()
const std::string EmptyString
This is an abstraction of an XML element.
An abstraction of a Disco identity (Service Discovery, XEP-0030).
virtual StringList handleDiscoNodeFeatures(const JID &from, const std::string &node)