capabilities.h

00001 /*
00002   Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 #ifndef CAPABILITIES_H__
00015 #define CAPABILITIES_H__
00016 
00017 #include "disconodehandler.h"
00018 #include "stanzaextension.h"
00019 #include "tag.h"
00020 
00021 #include <string>
00022 
00023 namespace gloox
00024 {
00025 
00026   class Disco;
00027   class Tag;
00028 
00036   class GLOOX_API Capabilities : public StanzaExtension, public DiscoNodeHandler
00037   {
00038 
00039     public:
00044       Capabilities( Disco* disco );
00045 
00050       Capabilities( const Tag* tag = 0 );
00051 
00055       virtual ~Capabilities();
00056 
00061       const std::string& node() const { return m_node; }
00062 
00067       void setNode( const std::string& node ) { m_node = node; }
00068 
00073       const std::string ver() const;
00074 
00075       // reimplemented from StanzaExtension
00076       virtual const std::string& filterString() const;
00077 
00078       // reimplemented from StanzaExtension
00079       virtual StanzaExtension* newInstance( const Tag* tag ) const
00080       {
00081         return new Capabilities( tag );
00082       }
00083 
00084       // reimplemented from StanzaExtension
00085       virtual Tag* tag() const;
00086 
00087       // reimplemented from StanzaExtension
00088       virtual StanzaExtension* clone() const
00089       {
00090         return new Capabilities( *this );
00091       }
00092 
00093       // reimplemented from DiscoNodeHandler
00094       virtual StringList handleDiscoNodeFeatures( const JID& from, const std::string& node );
00095 
00096       // reimplemented from DiscoNodeHandler
00097       virtual Disco::IdentityList handleDiscoNodeIdentities( const JID& from,
00098                                                              const std::string& node );
00099 
00100       // reimplemented from DiscoNodeHandler
00101       virtual Disco::ItemList handleDiscoNodeItems( const JID& from, const JID& to,
00102                                                     const std::string& node = EmptyString );
00103 
00104     private:
00109       const std::string& hash() const { return m_hash; }
00110 
00116       void setHash( const std::string& hash ) { m_hash = hash; }
00117 
00118       static std::string generate( const Disco::IdentityList& identities,
00119                                    const StringList& features, const DataForm* form = 0 );
00120       static std::string generate( const Disco::Info* info );
00121       static std::string generate( const Disco* disco );
00122 
00123       Disco* m_disco;
00124       std::string m_node;
00125       std::string m_hash;
00126       std::string m_ver;
00127       bool m_valid;
00128   };
00129 
00130 }
00131 
00132 #endif // CAPABILITIES_H__
Generated on Tue Jun 8 23:37:53 2010 for gloox by  doxygen 1.6.3