capabilities.h
/*
Copyright (c) 2007-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef CAPABILITIES_H__
#define CAPABILITIES_H__
#include "disconodehandler.h"
#include "stanzaextension.h"
#include "tag.h"
#include <string>
namespace gloox
{
class Disco;
class Tag;
class GLOOX_API Capabilities : public StanzaExtension, public DiscoNodeHandler
{
public:
Capabilities( Disco* disco );
Capabilities( const Tag* tag = 0 );
virtual ~Capabilities();
const std::string& node() const { return m_node; }
void setNode( const std::string& node ) { m_node = node; }
const std::string ver() const;
// reimplemented from StanzaExtension
virtual const std::string& filterString() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* newInstance( const Tag* tag ) const
{
return new Capabilities( tag );
}
// reimplemented from StanzaExtension
virtual Tag* tag() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* clone() const
{
return new Capabilities( *this );
}
// reimplemented from DiscoNodeHandler
virtual StringList handleDiscoNodeFeatures( const JID& from, const std::string& node );
// reimplemented from DiscoNodeHandler
virtual Disco::IdentityList handleDiscoNodeIdentities( const JID& from,
const std::string& node );
// reimplemented from DiscoNodeHandler
virtual Disco::ItemList handleDiscoNodeItems( const JID& from, const JID& to,
const std::string& node = EmptyString );
private:
const std::string& hash() const { return m_hash; }
void setHash( const std::string& hash ) { m_hash = hash; }
static std::string generate( const Disco::IdentityList& identities,
const StringList& features, const DataForm* form = 0 );
static std::string generate( const Disco::Info* info );
static std::string generate( const Disco* disco );
Disco* m_disco;
std::string m_node;
std::string m_hash;
std::string m_ver;
bool m_valid;
};
}
#endif // CAPABILITIES_H__
gloox::Capabilities::node
const std::string & node() const
Definition capabilities.h:61
gloox::Capabilities::Capabilities
Capabilities(Disco *disco)
Definition capabilities.cpp:25
gloox::Capabilities::clone
virtual StanzaExtension * clone() const
Definition capabilities.h:88
gloox::Capabilities::setNode
void setNode(const std::string &node)
Definition capabilities.h:67
gloox::Capabilities::newInstance
virtual StanzaExtension * newInstance(const Tag *tag) const
Definition capabilities.h:79
gloox::Capabilities::tag
virtual Tag * tag() const
Definition capabilities.cpp:148
gloox::DiscoNodeHandler
Derived classes can be registered as NodeHandlers for certain nodes with the Disco object.
Definition disconodehandler.h:36
gloox::Disco
This class implements XEP-0030 (Service Discovery) and XEP-0092 (Software Version).
Definition disco.h:46
gloox::Disco::IdentityList
std::list< Identity * > IdentityList
Definition disco.h:56
gloox::Disco::ItemList
std::list< Item * > ItemList
Definition disco.h:266
gloox::JID
An abstraction of a JID.
Definition jid.h:31
gloox::StanzaExtension::StanzaExtension
StanzaExtension(int type)
Definition stanzaextension.h:211
gloox::Tag
This is an abstraction of an XML element.
Definition tag.h:47
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::StringList
std::list< std::string > StringList
Definition gloox.h:1251
gloox::EmptyString
const std::string EmptyString
Definition gloox.cpp:124