virtual Disco::IdentityList handleDiscoNodeIdentities( const JID&, const std::string& ) { Disco::IdentityList dil; if( m_test == 6 ) dil.push_back( new Disco::Identity( "6cat", "6type", "6name" ) ); return dil; }
Disco::IdentityList Adhoc::handleDiscoNodeIdentities( const JID& /*from*/, const std::string& node ) { Disco::IdentityList l; StringMap::const_iterator it = m_items.find( node ); l.push_back( new Disco::Identity( "automation", node == XMLNS_ADHOC_COMMANDS ? "command-list" : "command-node", it == m_items.end() ? "Ad-Hoc Commands" : (*it).second ) ); return l; }
Disco::IdentityList Capabilities::handleDiscoNodeIdentities( const JID&, const std::string& ) { const Disco::IdentityList& il = m_disco->identities(); Disco::IdentityList ret; Disco::IdentityList::const_iterator it = il.begin(); for( ; it != il.end(); ++it ) { ret.push_back( new Disco::Identity( *(*it) ) ); } return ret; }
std::string Capabilities::generate( const Disco::IdentityList& il, const StringList& features, const DataForm* form ) { StringList sl; Disco::IdentityList::const_iterator it = il.begin(); for( ; it != il.end(); ++it ) { std::string id = (*it)->category(); id += '/'; id += (*it)->type(); id += '/'; // FIXME add xml:lang caps here. see XEP-0115 Section 5 id += '/'; id += (*it)->name(); sl.push_back( id ); } sl.sort(); std::string s; StringList::const_iterator it2 = sl.begin(); for( ; it2 != sl.end(); ++it2 ) { s += (*it2); s += '<'; } StringList f = features; f.sort(); it2 = f.begin(); for( ; it2 != f.end(); ++it2 ) { s += (*it2); s += '<'; } if( form ) { DataForm::FieldList::const_iterator it3 = form->fields().begin(); typedef std::map<std::string, StringList> MapSSL; MapSSL m; for( ; it3 != form->fields().end(); ++it3 ) { if( (*it3)->name() == "FORM_TYPE" ) { s += (*it3)->value(); s += '<'; } else m.insert( std::make_pair( (*it3)->name(), (*it3)->values() ) ); } MapSSL::iterator it4 = m.begin(); for( ; it4 != m.end(); ++it4 ) { s += it4->first; s += '<'; it2 = it4->second.begin(); for( ; it2 != it4->second.end(); ++it2 ) { s += (*it2); s += '<'; } } } return s; }