Index: libraries/win32/gloox/include/gloox/adhoc.h =================================================================== --- libraries/win32/gloox/include/gloox/adhoc.h +++ libraries/win32/gloox/include/gloox/adhoc.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ADHOC ) #ifndef ADHOC_H__ #define ADHOC_H__ @@ -309,13 +310,6 @@ /** * Returns the command's embedded AdhocPlugin (e.g. DataForm). * @return The command's embedded AdhocPlugin (e.g. DataForm). May be 0. - * @note This will be removed in 1.1. Use plugin() instead. - */ - GLOOX_DEPRECATED const AdhocPlugin* form() const { return m_plugin; } - - /** - * Returns the command's embedded AdhocPlugin (e.g. DataForm). - * @return The command's embedded AdhocPlugin (e.g. DataForm). May be 0. */ const AdhocPlugin* plugin() const { return m_plugin; } @@ -498,3 +492,5 @@ } #endif // ADHOC_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/adhoccommandprovider.h =================================================================== --- libraries/win32/gloox/include/gloox/adhoccommandprovider.h +++ libraries/win32/gloox/include/gloox/adhoccommandprovider.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ADHOC ) #ifndef ADHOCCOMMANDPROVIDER_H__ #define ADHOCCOMMANDPROVIDER_H__ @@ -77,3 +78,5 @@ } #endif // ADHOCCOMMANDPROVIDER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/adhochandler.h =================================================================== --- libraries/win32/gloox/include/gloox/adhochandler.h +++ libraries/win32/gloox/include/gloox/adhochandler.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ADHOC ) #ifndef ADHOCHANDLER_H__ #define ADHOCHANDLER_H__ @@ -77,3 +78,5 @@ } #endif // ADHOCHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/amp.h =================================================================== --- libraries/win32/gloox/include/gloox/amp.h +++ libraries/win32/gloox/include/gloox/amp.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_AMP ) + #ifndef AMP_H__ #define AMP_H__ @@ -241,3 +243,5 @@ } #endif // AMP_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/annotations.h =================================================================== --- libraries/win32/gloox/include/gloox/annotations.h +++ libraries/win32/gloox/include/gloox/annotations.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ANNOTATIONS ) #ifndef ANNOTATIONS_H__ #define ANNOTATIONS_H__ @@ -145,3 +146,5 @@ } #endif // ANNOTATIONS_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/annotationshandler.h =================================================================== --- libraries/win32/gloox/include/gloox/annotationshandler.h +++ libraries/win32/gloox/include/gloox/annotationshandler.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ANNOTATIONS ) #ifndef ANNOTATIONSHANDLER_H__ #define ANNOTATIONSHANDLER_H__ @@ -64,3 +65,5 @@ } #endif // ANNOTATIONSHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/attention.h =================================================================== --- libraries/win32/gloox/include/gloox/attention.h +++ libraries/win32/gloox/include/gloox/attention.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ATTENTION ) #ifndef ATTENTION_H__ #define ATTENTION_H__ @@ -68,3 +69,5 @@ } #endif// ATTENTION_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/bob.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/bob.h @@ -0,0 +1,131 @@ +/* + Copyright (c) 2019 by Jakob Schroeter + 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. +*/ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BOB ) + +#ifndef BOB_H__ +#define BOB_H__ + +#include "macros.h" + +#include "stanzaextension.h" + +// #include "bobhandler.h" + +#include + +namespace gloox +{ + + class Tag; + + /** + * @brief This is an implementation of Bits of Binary (@xep{0231}) as a StanzaExtension. + * + * XEP Version: 1.0 + * @author Adrien Destugues + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API BOB : public StanzaExtension + { + + public: + /** + * Constructs a new object from the given Tag. + * @param tag The Tag to parse. + */ + BOB( const Tag* tag = 0 ); + + /** + * Constructs a new object with the given namespace and priority. + * @param cid A Content-ID that matches the data below and can be mapped to a cid: URL as specified + * in RFC 2111 [10]. The 'cid' value SHOULD be of the form algo+hash@bob.xmpp.org, + * where the "algo" is the hashing algorithm used (e.g., "sha1" for the SHA-1 + * algorithm as specified in RFC 3174) and the "hash" is the hex + * output of the algorithm applied to the binary data itself. + * This will be calculated for you using SHA1 if left empty. + * @param type The value of the 'type' attribute MUST match the syntax specified in RFC 2045. + * That is, the value MUST include a top-level media type, the "/" character, + * and a subtype; in addition, it MAY include one or more optional parameters + * (e.g., the "audio/ogg" MIME type in the example shown below includes a + * "codecs" parameter as specified in RFC 4281 [14]). The "type/subtype" + * string SHOULD be registered in the IANA MIME Media Types Registry, + * but MAY be an unregistered or yet-to-be-registered value. + * @param data The binary data. It will be Base64-encoded for you. + * @param maxage A suggestion regarding how long (in seconds) to cache the data; + * the meaning matches the Max-Age attribute from RFC 2965. + */ + BOB( const std::string& cid, const std::string& type, + const std::string& data, int maxage ); + + /** + * Virtual Destructor. + */ + virtual ~BOB() {} + + /** + * Returns the binary data. + * @return The binary data. + */ + const std::string data() const; + + /** + * Returns the content ID. + * @return The content ID. + */ + const std::string cid() const { return m_cid; } + + /** + * Returns the content type. + * @return The content type. + */ + const std::string& type() const { return m_type; } + + /** + * Returns the maximum cache time in seconds. + * @return The maximum cache time in seconds. + */ + int maxage() const { return m_maxage; } + + // reimplemented from StanzaExtension + virtual const std::string& filterString() const; + + // reimplemented from StanzaExtension + virtual StanzaExtension* newInstance( const Tag* tag ) const + { + return new BOB( tag ); + } + + // reimplemented from StanzaExtension + virtual Tag* tag() const; + + // reimplemented from StanzaExtension + virtual StanzaExtension* clone() const + { + return new BOB( *this ); + } + + private: + std::string m_cid; + std::string m_type; + std::string m_data; + int m_maxage; + + }; + +} + +#endif // BOB_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/bookmarkhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/bookmarkhandler.h +++ libraries/win32/gloox/include/gloox/bookmarkhandler.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BOOKMARKSTORAGE ) #ifndef BOOKMARKHANDLER_H__ #define BOOKMARKHANDLER_H__ @@ -80,3 +81,5 @@ } #endif // BOOKMARKHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/bookmarkstorage.h =================================================================== --- libraries/win32/gloox/include/gloox/bookmarkstorage.h +++ libraries/win32/gloox/include/gloox/bookmarkstorage.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BOOKMARKSTORAGE ) #ifndef BOOKMARKSTORAGE_H__ #define BOOKMARKSTORAGE_H__ @@ -148,3 +149,5 @@ } #endif // BOOKMARKSTORAGE_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/bytestream.h =================================================================== --- libraries/win32/gloox/include/gloox/bytestream.h +++ libraries/win32/gloox/include/gloox/bytestream.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BYTESTREAM ) + #ifndef BYTESTREAM_H__ #define BYTESTREAM_H__ @@ -73,6 +75,8 @@ /** * This function starts the connection process. + * @param timeout The timeout to use for select() in microseconds. Default of -1 means blocking. + * This parameter has no effect in IBB modes. * @return @b True if a connection to a remote entity could be established, @b false * otherwise. * @note If @b false is returned you should pass this Bytestream object @@ -80,7 +84,7 @@ * @note Make sure you have a BytestreamDataHandler registered (using * registerBytestreamDataHandler()) before calling this function. */ - virtual bool connect() = 0; + virtual bool connect( int timeout = -1 ) = 0; /** * Closes the bytestream. @@ -178,3 +182,5 @@ } #endif // BYTESTREAM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/bytestreamdatahandler.h =================================================================== --- libraries/win32/gloox/include/gloox/bytestreamdatahandler.h +++ libraries/win32/gloox/include/gloox/bytestreamdatahandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BYTESTREAM ) + #ifndef BYTESTREAMDATAHANDLER_H__ #define BYTESTREAMDATAHANDLER_H__ @@ -62,7 +64,7 @@ * @param bs The bytestream. * @since 1.0.20 */ - virtual void handleBytestreamDataAck( Bytestream* bs ) {} + virtual void handleBytestreamDataAck( Bytestream* bs ) = 0; /** * Notifies about an error occuring while using a bytestream. @@ -90,3 +92,5 @@ } #endif // BYTESTREAMDATAHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/bytestreamhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/bytestreamhandler.h +++ libraries/win32/gloox/include/gloox/bytestreamhandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BYTESTREAM ) + #ifndef BYTESTREAMHANDLER_H__ #define BYTESTREAMHANDLER_H__ @@ -88,3 +90,5 @@ } #endif // BYTESTREAMHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/capabilities.h =================================================================== --- libraries/win32/gloox/include/gloox/capabilities.h +++ libraries/win32/gloox/include/gloox/capabilities.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CAPABILITIES ) + #ifndef CAPABILITIES_H__ #define CAPABILITIES_H__ @@ -29,7 +31,8 @@ /** * @brief This is an implementation of @xep{0115} (Entity Capabilities). * - * XEP Version: 1.5-15 + * XEP Version: 1.5 + * * @author Jakob Schröter * @since 1.0 */ @@ -130,3 +133,5 @@ } #endif // CAPABILITIES_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/carbons.h =================================================================== --- libraries/win32/gloox/include/gloox/carbons.h +++ libraries/win32/gloox/include/gloox/carbons.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CARBONS ) + #ifndef CARBONS_H__ #define CARBONS_H__ @@ -183,3 +185,5 @@ } #endif // CARBONS_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/chatmarker.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/chatmarker.h @@ -0,0 +1,93 @@ +/* + Copyright (c) 2018-2019 by Jakob Schröter + 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. +*/ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CHATMARKER ) + +#ifndef CHATMARKER_H__ +#define CHATMARKER_H__ + +#include "gloox.h" +#include "stanzaextension.h" + +#include + +namespace gloox +{ + + class Tag; + + /** + * @brief An implementation of Chat Markers (@xep{0333}) as a StanzaExtension. + * + * XEP Version: 0.3 + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API ChatMarker : public StanzaExtension + { + public: + + /** + * Constructs a new object from the given Tag. + * @param tag A Tag to parse. + */ + ChatMarker( const Tag* tag ); + + /** + * Constructs a new object of the given type. + * @param type The chat type. + */ + ChatMarker( ChatMarkerType type ) + : StanzaExtension( ExtChatMarkers ), m_marker( type ) + {} + + /** + * Virtual destructor. + */ + virtual ~ChatMarker() {} + + /** + * Returns the object's type. + * @return The object's type. + */ + ChatMarkerType marker() const { return m_marker; } + + // reimplemented from StanzaExtension + virtual const std::string& filterString() const; + + // reimplemented from StanzaExtension + virtual StanzaExtension* newInstance( const Tag* tag ) const + { + return new ChatMarker( tag ); + } + + // reimplemented from StanzaExtension + Tag* tag() const; + + // reimplemented from StanzaExtension + virtual StanzaExtension* clone() const + { + return new ChatMarker( *this ); + } + + private: + ChatMarkerType m_marker; + + }; + +} + +#endif // CHATMARKER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/chatmarkerfilter.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/chatmarkerfilter.h @@ -0,0 +1,109 @@ +/* + Copyright (c) 2005-2019 by Jakob Schröter + 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. +*/ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CHATMARKER ) + +#ifndef CHATMARKERFILTER_H__ +#define CHATMARKERFILTER_H__ + +#include "messagefilter.h" +#include "gloox.h" + +namespace gloox +{ + + class Tag; + class ChatMarkerHandler; + class MessageSession; + class Message; + + /** + * @brief This class adds Chat Markers (@xep{0333}) support to a MessageSession. + * + * This implementation of Chat States is fully transparent to the user of the class. + * If the remote entity does not request chat markers, ChatMarkerFilter will not send + * any, even if the user requests it. (This is required by the protocol specification.) + * You MUST annouce this capability by use of Disco (associated namespace is XMLNS_CHAT_STATES). + * (This is also required by the protocol specification.) + * + * @note You must register ChatMarker as a StanzaExtension by calling + * ClientBase::registerStanzaExtension() for notifications to work. + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API ChatMarkerFilter : public MessageFilter + { + public: + /** + * Constructs a new Chat State filter for a MessageSession. + * @param parent The MessageSession to decorate. + */ + ChatMarkerFilter( MessageSession* parent ); + + /** + * Virtual destructor. + */ + virtual ~ChatMarkerFilter(); + + /** + * Use this function to set a chat marker as defined in @xep{0085}. + * @note The Spec states that Chat States shall not be sent to an entity + * which did not request them. Reasonable effort is taken in this function to + * avoid spurious marker sending. You should be safe to call this even if Message + * Events were not requested by the remote entity. However, + * calling setChatState( CHAT_STATE_COMPOSING ) for every keystroke still is + * discouraged. ;) + * @param marker The marker to set. + */ + void setMessageMarkable(); + + /** + * The ChatMarkerHandler registered here will receive Chat States according + * to @xep{0085}. + * @param csh The ChatMarkerHandler to register. + */ + void registerChatMarkerHandler( ChatMarkerHandler* csh ) + { m_chatMarkerHandler = csh; } + + /** + * This function clears the internal pointer to the ChatMarkerHandler. + * Chat States will not be delivered anymore after calling this function until another + * ChatMarkerHandler is registered. + */ + void removeChatMarkerHandler() + { m_chatMarkerHandler = 0; } + + // reimplemented from MessageFilter + virtual void decorate( Message& msg ); + + // reimplemented from MessageFilter + virtual void filter( Message& msg ); + + protected: + /** A handler for incoming chat marker changes. */ + ChatMarkerHandler* m_chatMarkerHandler; + + /** Holds the marker sent last. */ + ChatMarkerType m_lastSent; + + /** Indicates whether or not chat markers are currently enabled. */ + bool m_enableChatMarkers; + + }; + +} + +#endif // CHATMARKERFILTER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/chatmarkerhandler.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/chatmarkerhandler.h @@ -0,0 +1,56 @@ +/* + Copyright (c) 2005-2019 by Jakob Schröter + 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. +*/ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CHATMARKER ) + +#ifndef CHATMARKERHANDLER_H__ +#define CHATMARKERHANDLER_H__ + +#include "gloox.h" + +namespace gloox +{ + + class JID; + + /** + * @brief A virtual interface that enables an object to be notified about incoming + * Chat Markers (@xep{0333}). + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API ChatMarkerHandler + { + public: + /** + * Virtual Destructor. + */ + virtual ~ChatMarkerHandler() {} + + /** + * Notifies the ChatMarkerHandler that a message has been marked by the remote + * contact. The occurrence of the 'markable' tag does not cause this handler to be called. + * @param from The originator of the Event. + * @param marker The marker type. + * @param id The marked message's ID. + */ + virtual void handleChatMarker( const JID& from, ChatMarkerType type, const std::string& id ) = 0; + + }; + +} + +#endif // CHATMARKERHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/chatstate.h =================================================================== --- libraries/win32/gloox/include/gloox/chatstate.h +++ libraries/win32/gloox/include/gloox/chatstate.h @@ -10,6 +10,8 @@ This software is distributed without any warranty. */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CHATSTATE ) + #ifndef CHATSTATE_H__ #define CHATSTATE_H__ @@ -85,3 +87,5 @@ } #endif // CHATSTATE_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/chatstatefilter.h =================================================================== --- libraries/win32/gloox/include/gloox/chatstatefilter.h +++ libraries/win32/gloox/include/gloox/chatstatefilter.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CHATSTATE ) + #ifndef CHATSTATEFILTER_H__ #define CHATSTATEFILTER_H__ @@ -103,3 +105,5 @@ } #endif // CHATSTATEFILTER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/chatstatehandler.h =================================================================== --- libraries/win32/gloox/include/gloox/chatstatehandler.h +++ libraries/win32/gloox/include/gloox/chatstatehandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CHATSTATE ) + #ifndef CHATSTATEHANDLER_H__ #define CHATSTATEHANDLER_H__ @@ -49,3 +51,5 @@ } #endif // CHATSTATEHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/client.h =================================================================== --- libraries/win32/gloox/include/gloox/client.h +++ libraries/win32/gloox/include/gloox/client.h @@ -22,9 +22,13 @@ namespace gloox { +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CAPABILITIES ) class Capabilities; +#endif // GLOOX_MINIMAL class RosterManager; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_NONSASLAUH ) class NonSaslAuth; +#endif // GLOOX_MINIMAL class IQ; /** @@ -117,7 +121,9 @@ { public: +#if !defined( GLOOX_MINIMAL ) || defined( WANT_NONSASLAUTH ) friend class NonSaslAuth; +#endif // GLOOX_MINIMAL friend class Parser; /** @@ -327,12 +333,14 @@ */ Presence& presence() { return m_presence; } +#if !defined( GLOOX_MINIMAL ) || defined( WANT_NONSASLAUH ) /** * This is a temporary hack to enforce Non-SASL login. You should not need to use it. * @param force Whether to force non-SASL auth. Default @b true. * @deprecated Please update the server to properly support SASL instead. */ GLOOX_DEPRECATED void setForceNonSasl( bool force = true ) { m_forceNonSasl = force; } +#endif // GLOOX_MINIMAL /** * Disables the automatic roster management. @@ -362,10 +370,12 @@ bool login(); protected: +#if !defined( GLOOX_MINIMAL ) || defined( WANT_NONSASLAUH ) /** * Initiates non-SASL login. */ void nonSaslLogin(); +#endif // GLOOX_MINIMAL private: #ifdef CLIENT_TEST @@ -508,11 +518,13 @@ }; RosterManager* m_rosterManager; + + #if !defined( GLOOX_MINIMAL ) || defined( WANT_NONSASLAUTH ) NonSaslAuth* m_auth; + bool m_forceNonSasl; +#endif // GLOOX_MINIMAL Presence m_presence; - - bool m_forceNonSasl; bool m_manageRoster; std::string m_smId; Index: libraries/win32/gloox/include/gloox/clientbase.h =================================================================== --- libraries/win32/gloox/include/gloox/clientbase.h +++ libraries/win32/gloox/include/gloox/clientbase.h @@ -17,11 +17,15 @@ #include "macros.h" #include "gloox.h" +// #include "connectionbase.h" #include "eventdispatcher.h" #include "iqhandler.h" #include "jid.h" #include "logsink.h" #include "mutex.h" +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PING ) +#include "pinghandler.h" +#endif // GLOOX_MINIMAL #include "taghandler.h" #include "statisticshandler.h" #include "tlshandler.h" @@ -34,7 +38,7 @@ #include #include -#if defined( _WIN32 ) && !defined( __SYMBIAN32__ ) +#if defined( _WIN32 ) #include #define SECURITY_WIN32 #include @@ -51,13 +55,17 @@ class Message; class Presence; class Subscription; - class MessageSessionHandler; class ConnectionListener; class MessageHandler; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGESESSION ) class MessageSession; + class MessageSessionHandler; +#endif // GLOOX_MINIMAL class PresenceHandler; class SubscriptionHandler; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) class MUCInvitationHandler; +#endif // GLOOX_MINIMAL class TagHandler; class TLSBase; class ConnectionBase; @@ -75,8 +83,11 @@ */ class GLOOX_API ClientBase : public TagHandler, public ConnectionDataHandler, public CompressionDataHandler, public TLSHandler, +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PING ) + public PingHandler, +#endif // GLOOX_MINIMAL public IqHandler - { + { friend class RosterManager; @@ -115,17 +126,18 @@ * immediately. If you choose the latter, its your responsibility to call @ref recv() every now * and then to actually receive data from the socket and to feed the parser. * @param block @b True for blocking, @b false for non-blocking connect. Defaults to @b true. + * @param timeout The timeout in microseconds to use for select(). Default of -1 means blocking. * @return @b False if prerequisits are not met (server not set) or if the connection was refused, * @b true otherwise. * @note Since 0.9 @link ConnectionListener::onDisconnect() onDisconnect() @endlink is called * in addition to a return value of @b false. */ - bool connect( bool block = true ); + bool connect( bool block = true, int timeout = -1 ); /** * Use this periodically to receive data from the socket and to feed the parser. You need to use * this only if you chose to connect in non-blocking mode. - * @param timeout The timeout in microseconds to use for select. Default of -1 means blocking + * @param timeout The timeout in microseconds to use for select. Default of -1 means blocking. * until data was available. * @return The state of the connection. */ @@ -146,6 +158,14 @@ */ const JID& jid() { return m_authzid ? m_authzid : m_jid; } +#if !defined( GLOOX_MINIMAL ) || defined( WANT_WEBSOCKET ) + /** + * Switches usage of websocket transport on/off. Default: off. + * @param ws Whether to switch websocket transport usage on or off. + */ + void setWebsocket( bool ws ) { m_websocket = ws; } +#endif // GLOOX_MINIMAL + /** * Switches usage of SASL on/off. Default: on. SASL should only be disabled if there are * problems with using it, and if an alternative authentication method exists. @@ -155,10 +175,12 @@ /** * Sets the TLS policy. Default: TLS will be used if available. TLS should only be - * disabled if there are problems with using it. + * disabled if there are problems with using it. Also sets the minimum required/requested + * TLS version for the connection. * @param tls The TLS policy. + * @param tlsVersion The TLS version to require/request. Default: TLS v1. */ - void setTls( TLSPolicy tls ) { m_tls = tls; } + void setTls( TLSPolicy tls, TLSVersion tlsVersion = TLSv1 ) { m_tls = tls; m_tlsVersion = tlsVersion; } /** * Switches usage of Stream Compression on/off (if available). Default: on if available. Stream @@ -208,6 +230,12 @@ TLSPolicy tls() const { return m_tls; } /** + * Returns the minimum required TLS version (not necessarily the one in use). + * @return The TLS version. + */ + TLSVersion tlsVersion() const { return m_tlsVersion; } + + /** * Returns whether Stream Compression is currently enabled (not necessarily used). * @return The current Stream Compression status. */ @@ -226,11 +254,13 @@ */ virtual const std::string& password() const { return m_password; } +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DISCO ) /** * This function gives access to the @c Disco object. * @return A pointer to the Disco object. */ virtual Disco* disco() const { return m_disco; } +#endif // GLOOX_MINIMAL /** * Creates a string which is unique in the current instance and @@ -357,6 +387,7 @@ */ void setCompressionImpl( CompressionBase* cb ); +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PING ) /** * Sends a whitespace ping to the server. * @since 0.9 @@ -370,6 +401,7 @@ * @since 0.9 */ void xmppPing( const JID& to, EventHandler* eh ); +#endif // GLOOX_MINIMAL /** * Use this function to set an authorization ID (authzid). Provided the server supports it @@ -453,6 +485,20 @@ */ void removeMessageHandler( MessageHandler* mh ); +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PING ) + /** + * Registers @c ph as object that receives Ping stanza notifications. + * @param ph The object to receive Ping stanza notifications. + */ + void registerPingHandler( PingHandler* ph ); + + /** + * Clears the current ping handler. The ping handler does not get deleted. + */ + void removePingHandler(); +#endif // GLOOX_MINIMAL + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGESESSION ) /** * Registers the given MessageSession to receive Messages incoming from the session's * target JID. @@ -471,6 +517,19 @@ void disposeMessageSession( MessageSession* session ); /** + * Use this function to register a MessageSessionHandler with the Client. + * Optionally the MessageSessionHandler can receive only MessageSessions with a given + * message type. There can be only one handler per message type.
+ * A MessageSession will be created for every incoming + * message stanza if there is no MessageHandler registered for the originating JID. + * @param msh The MessageSessionHandler that will receive the newly created MessageSession. + * @param types ORed StanzaSubType's that describe the desired message types the handler + * shall receive. Only StanzaMessage* types are valid. A value of 0 means any type (default). + */ + void registerMessageSessionHandler( MessageSessionHandler* msh, int types = 0 ); +#endif // GLOOX_MINIMAL + + /** * Registers @c ph as object that receives Presence stanza notifications. * @param ph The object to receive Presence stanza notifications. */ @@ -581,18 +640,6 @@ void setClientCert( const std::string& clientKey, const std::string& clientCerts ); /** - * Use this function to register a MessageSessionHandler with the Client. - * Optionally the MessageSessionHandler can receive only MessageSessions with a given - * message type. There can be only one handler per message type.
- * A MessageSession will be created for every incoming - * message stanza if there is no MessageHandler registered for the originating JID. - * @param msh The MessageSessionHandler that will receive the newly created MessageSession. - * @param types ORed StanzaSubType's that describe the desired message types the handler - * shall receive. Only StanzaMessage* types are valid. A value of 0 means any type (default). - */ - void registerMessageSessionHandler( MessageSessionHandler* msh, int types = 0 ); - - /** * Returns the LogSink instance for this ClientBase and all related objects. * @return The LogSink instance used in the current ClientBase. */ @@ -646,6 +693,7 @@ */ StatisticsStruct getStatistics(); +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) /** * Registers a MUCInvitationHandler with the ClientBase. * @param mih The MUCInvitationHandler to register. @@ -656,6 +704,7 @@ * Removes the currently registered MUCInvitationHandler. */ void removeMUCInvitationHandler(); +#endif // GLOOX_MINIMAL /** * Adds a StanzaExtension that will be sent with every Presence stanza @@ -715,8 +764,13 @@ // reimplemented from TLSHandler virtual void handleHandshakeResult( const TLSBase* base, bool success, CertInfo &certinfo ); - protected: -#ifdef CLIENTBASE_TEST +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PING ) + // reimplemented from PingHandler + virtual void handlePing( PingType type, const std::string& body ); +#endif // GLOOX_MINIMAL + + protected: +#if defined( CLIENTBASE_TEST ) || defined( ENABLE_SEND_RAW_XML ) public: #endif /** @@ -765,10 +819,6 @@ */ virtual void disconnect( ConnectionError reason ); - /** - * Sends the stream header. - */ - void header(); /** * Tells ClientBase that authentication was successful (or not). @@ -802,8 +852,8 @@ * Verifies the server response after successful authentication (if applicable) and * releases SASL related resources (if applicable). * @param payload The server's verification string. - * @return @b True if verification is not supported by the chosen SASL mechanism or could be completed successfully, - * @b false if verification failed. + * @return @b True if verification is not supported by the chosen SASL mechanism or could be + * completed successfully, @b false if verification failed. */ bool processSASLSuccess( const std::string& payload ); @@ -871,15 +921,13 @@ ConnectionBase* m_connection; /**< The transport connection. */ TLSBase* m_encryption; /**< Used for connection encryption. */ CompressionBase* m_compression; /**< Used for connection compression. */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DISCO ) Disco* m_disco; /**< The local Service Discovery client. */ +#endif // GLOOX_MINIMAL /** A list of permanent presence extensions. */ StanzaExtensionList m_presenceExtensions; - GLOOX_DEPRECATED std::string m_selectedResource; /**< The currently selected resource. - * See Client::selectResource() and Client::bindRessource(). - * @deprecated Not used anymore. Will be removed for 1.1. - * @todo Remove for 1.1 */ std::string m_clientCerts; /**< TLS client certificates. */ std::string m_clientKey; /**< TLS client private key. */ std::string m_namespace; /**< Default namespace. */ @@ -898,7 +946,11 @@ bool m_resourceBound; /**< Whether resource binding has been completed successfully. */ bool m_block; /**< Whether blocking connection is wanted. */ bool m_sasl; /**< Whether SASL authentication is wanted. */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_WEBSOCKET ) + bool m_websocket; /**< Whether connection is done over websocket. */ +#endif // GLOOX_MINIMAL TLSPolicy m_tls; /**< The current TLS policy. */ + TLSVersion m_tlsVersion; /**< The minimum TLS version to require/request. */ int m_port; /**< The port to connect to, if not to be determined * by querying the server's SRV records. */ @@ -922,9 +974,10 @@ * You should NOT mess with this. */ private: -#ifdef CLIENTBASE_TEST +#if defined( CLIENTBASE_TEST ) || defined( ENABLE_SEND_RAW_XML ) public: #endif +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PING ) /** * @brief This is an implementation of an XMPP Ping (@xep{0199}). * @@ -968,9 +1021,14 @@ } }; +#endif // GLOOX_MINIMAL + private: ClientBase( const ClientBase& ); ClientBase& operator=( const ClientBase& ); +#if defined( CLIENTBASE_TEST ) || defined( ENABLE_SEND_RAW_XML ) + public: +#endif /** * This function is called right after the opening <stream:stream> was received. @@ -1045,7 +1103,9 @@ typedef std::map IqTrackMap; typedef std::map MessageHandlerMap; typedef std::map SMQueueMap; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGESESSION ) typedef std::list MessageSessionList; +#endif // GLOOX_MINIMAL typedef std::list MessageHandlerList; typedef std::list PresenceHandlerList; typedef std::list PresenceJidHandlerList; @@ -1057,7 +1117,6 @@ IqHandlerMap m_iqExtHandlers; IqTrackMap m_iqIDHandlers; SMQueueMap m_smQueue; - MessageSessionList m_messageSessions; MessageHandlerList m_messageHandlers; PresenceHandlerList m_presenceHandlers; PresenceJidHandlerList m_presenceJidHandlers; @@ -1065,11 +1124,19 @@ TagHandlerList m_tagHandlers; StringList m_cacerts; StatisticsHandler * m_statisticsHandler; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) MUCInvitationHandler * m_mucInvitationHandler; +#endif // GLOOX_MINIMAL +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGESESSION ) + MessageSessionList m_messageSessions; MessageSessionHandler * m_messageSessionHandlerChat; MessageSessionHandler * m_messageSessionHandlerGroupchat; MessageSessionHandler * m_messageSessionHandlerHeadline; MessageSessionHandler * m_messageSessionHandlerNormal; +#endif // GLOOX_MINIMAL +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PING ) + PingHandler * m_pingHandler; +#endif // GLOOX_MINIMAL util::Mutex m_iqHandlerMapMutex; util::Mutex m_iqExtHandlerMapMutex; @@ -1101,7 +1168,7 @@ int m_smSent; -#if defined( _WIN32 ) && !defined( __SYMBIAN32__ ) +#if defined( _WIN32 ) CredHandle m_credHandle; CtxtHandle m_ctxtHandle; #endif Index: libraries/win32/gloox/include/gloox/component.h =================================================================== --- libraries/win32/gloox/include/gloox/component.h +++ libraries/win32/gloox/include/gloox/component.h @@ -12,6 +12,8 @@ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_COMPONENT ) + #ifndef COMPONENT_H__ #define COMPONENT_H__ @@ -75,3 +77,5 @@ } #endif // COMPONENT_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/compressiondatahandler.h =================================================================== --- libraries/win32/gloox/include/gloox/compressiondatahandler.h +++ libraries/win32/gloox/include/gloox/compressiondatahandler.h @@ -11,7 +11,6 @@ */ - #ifndef COMPRESSIONDATAHANDLER_H__ #define COMPRESSIONDATAHANDLER_H__ Index: libraries/win32/gloox/include/gloox/config.h =================================================================== --- libraries/win32/gloox/include/gloox/config.h +++ libraries/win32/gloox/include/gloox/config.h @@ -14,12 +14,10 @@ #ifndef CONFIG_H__ #define CONFIG_H__ -#if ( defined _WIN32 ) && !defined( __SYMBIAN32__ ) +#if ( defined _WIN32 ) # include "../config.h.win" #elif defined( _WIN32_WCE ) # include "../config.h.win" -#elif defined( __SYMBIAN32__ ) -# include "../config.h.symbian" #else # include "config.h.unix" // run ./configure to create config.h.unix #endif Index: libraries/win32/gloox/include/gloox/connectionbase.h =================================================================== --- libraries/win32/gloox/include/gloox/connectionbase.h +++ libraries/win32/gloox/include/gloox/connectionbase.h @@ -40,7 +40,7 @@ * received data. */ ConnectionBase( ConnectionDataHandler* cdh ) - : m_handler( cdh ), m_state( StateDisconnected ), m_port( -1 ) + : m_handler( cdh ), m_state( StateDisconnected ), m_port( -1 ), m_timeout( -1 ) {} /** @@ -50,9 +50,10 @@ /** * Used to initiate the connection. + * @param timeout The timeout to use for select() in milliseconds. Default of -1 means blocking. * @return Returns the connection state. */ - virtual ConnectionError connect() = 0; + virtual ConnectionError connect( int timeout = -1 ) = 0; /** * Use this periodically to receive data from the socket. @@ -71,6 +72,16 @@ virtual bool send( const std::string& data ) = 0; /** + * Use this function to send an arbitrary chunk of data over the wire. The function returns only after + * all data has been sent. + * @param data The data to send. + * @param len The length of data to send. + * @return @b True if the data has been sent (no guarantee of receipt), @b false + * in case of an error. + */ + virtual bool send( const char* data, const size_t len ) = 0; + + /** * Use this function to put the connection into 'receive mode', i.e. this function returns only * when the connection is terminated. * @return Returns a value indicating the disconnection reason. @@ -127,6 +138,13 @@ virtual int localPort() const { return -1; } /** + * Returns the open timeout value. + * If return value is >= 0 this is a non-blocking connection. + * @return The timeout value. + */ + int timeout() const { return m_timeout; } + + /** * Returns the locally bound IP address. * @return The locally bound IP address. */ @@ -147,6 +165,19 @@ */ virtual ConnectionBase* newInstance() const = 0; + /** + * Sends the stream header. + */ + virtual std::string header( std::string to, std::string xmlns, std::string xmllang ) + { + std::string head = ""; + head += ""; + + return head; + } + protected: /** A handler for incoming data and connect/disconnect events. */ ConnectionDataHandler* m_handler; @@ -160,6 +191,8 @@ /** Holds the port to connect to. */ int m_port; + /** If timeout is >= 0 this is a non-blocking connection. */ + int m_timeout; }; } Index: libraries/win32/gloox/include/gloox/connectionbosh.h =================================================================== --- libraries/win32/gloox/include/gloox/connectionbosh.h +++ libraries/win32/gloox/include/gloox/connectionbosh.h @@ -10,6 +10,9 @@ * This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CONNECTIONBOSH ) + #ifndef CONNECTIONBOSH_H__ #define CONNECTIONBOSH_H__ @@ -139,7 +142,7 @@ void setMode( ConnMode mode ) { m_connMode = mode; } // reimplemented from ConnectionBase - virtual ConnectionError connect(); + virtual ConnectionError connect( int timeout = -1 ); // reimplemented from ConnectionBase virtual ConnectionError recv( int timeout = -1 ); @@ -148,6 +151,13 @@ virtual bool send( const std::string& data ); // reimplemented from ConnectionBase + virtual bool send( const char* /*data*/, const size_t /*len*/ ) + { + m_logInstance.err( LogAreaClassConnectionBOSH, "Sending binary not implemented" ); + return false; + } + + // reimplemented from ConnectionBase virtual ConnectionError receive(); // reimplemented from ConnectionBase @@ -180,8 +190,8 @@ bool sendRequest( const std::string& xml ); bool sendXML(); const std::string getHTTPField( const std::string& field ); - ConnectionBase* getConnection(); - ConnectionBase* activateConnection(); + ConnectionBase* getConnection( int timeout = -1 ); + ConnectionBase* activateConnection( int timeout = -1 ); void putConnection(); //ConnectionBase *m_connection; @@ -223,3 +233,5 @@ } #endif // CONNECTIONBOSH_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/connectionhttpproxy.h =================================================================== --- libraries/win32/gloox/include/gloox/connectionhttpproxy.h +++ libraries/win32/gloox/include/gloox/connectionhttpproxy.h @@ -11,6 +11,9 @@ */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CONNECTIONHTTPPROXY ) + #ifndef CONNECTIONHTTPPROXY_H__ #define CONNECTIONHTTPPROXY_H__ @@ -90,7 +93,7 @@ virtual ~ConnectionHTTPProxy(); // reimplemented from ConnectionBase - virtual ConnectionError connect(); + virtual ConnectionError connect( int timeout = -1 ); // reimplemented from ConnectionBase virtual ConnectionError recv( int timeout = -1 ); @@ -99,6 +102,9 @@ virtual bool send( const std::string& data ); // reimplemented from ConnectionBase + virtual bool send( const char* data, const size_t len ) ; + + // reimplemented from ConnectionBase virtual ConnectionError receive(); // reimplemented from ConnectionBase @@ -169,3 +175,5 @@ } #endif // CONNECTIONHTTPPROXY_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/connectionsocks5proxy.h =================================================================== --- libraries/win32/gloox/include/gloox/connectionsocks5proxy.h +++ libraries/win32/gloox/include/gloox/connectionsocks5proxy.h @@ -11,6 +11,9 @@ */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CONNECTIONSOCKS5PROXY ) + #ifndef CONNECTIONSOCKS5PROXY_H__ #define CONNECTIONSOCKS5PROXY_H__ @@ -92,7 +95,7 @@ virtual ~ConnectionSOCKS5Proxy(); // reimplemented from ConnectionBase - virtual ConnectionError connect(); + virtual ConnectionError connect( int timeout = -1 ); // reimplemented from ConnectionBase virtual ConnectionError recv( int timeout = -1 ); @@ -101,6 +104,13 @@ virtual bool send( const std::string& data ); // reimplemented from ConnectionBase + virtual bool send( const char* /*data*/, const size_t /*len*/ ) + { + m_logInstance.err( LogAreaClassConnectionSOCKS5Proxy, "Sending binary not implemented" ); + return false; + } + + // reimplemented from ConnectionBase virtual ConnectionError receive(); // reimplemented from ConnectionBase @@ -176,3 +186,5 @@ } #endif // CONNECTIONSOCKS5PROXY_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/connectiontcpbase.h =================================================================== --- libraries/win32/gloox/include/gloox/connectiontcpbase.h +++ libraries/win32/gloox/include/gloox/connectiontcpbase.h @@ -76,6 +76,9 @@ virtual bool send( const std::string& data ); // reimplemented from ConnectionBase + virtual bool send( const char* data, const size_t len ); + + // reimplemented from ConnectionBase virtual ConnectionError receive(); // reimplemented from ConnectionBase @@ -119,6 +122,7 @@ void init( const std::string& server, int port ); bool dataAvailable( int timeout = -1 ); void cancel(); + int waitForSocketReady( bool readop = true ); const LogSink& m_logInstance; util::Mutex m_sendMutex; Index: libraries/win32/gloox/include/gloox/connectiontcpclient.h =================================================================== --- libraries/win32/gloox/include/gloox/connectiontcpclient.h +++ libraries/win32/gloox/include/gloox/connectiontcpclient.h @@ -68,7 +68,7 @@ virtual ConnectionError recv( int timeout = -1 ); // reimplemented from ConnectionBase - virtual ConnectionError connect(); + virtual ConnectionError connect( int timeout = -1 ); // reimplemented from ConnectionBase virtual ConnectionBase* newInstance() const; Index: libraries/win32/gloox/include/gloox/connectiontcpserver.h =================================================================== --- libraries/win32/gloox/include/gloox/connectiontcpserver.h +++ libraries/win32/gloox/include/gloox/connectiontcpserver.h @@ -11,6 +11,9 @@ */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CONNECTIONTCPSERVER ) + #ifndef CONNECTIONTCPSERVER_H__ #define CONNECTIONTCPSERVER_H__ @@ -60,7 +63,7 @@ * constructor. */ // reimplemented from ConnectionBase - virtual ConnectionError connect(); + virtual ConnectionError connect( int timeout = -1 ); // reimplemented from ConnectionBase virtual ConnectionBase* newInstance() const; @@ -75,3 +78,5 @@ } #endif // CONNECTIONTCPSERVER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/connectiontls.h =================================================================== --- libraries/win32/gloox/include/gloox/connectiontls.h +++ libraries/win32/gloox/include/gloox/connectiontls.h @@ -128,8 +128,15 @@ */ void registerTLSHandler( TLSHandler* th ) { m_tlsHandler = th; } + /** + * This function is used to set the minimum required/requested TLS version. Default is to use + * at least TLS v1. + * @param tlsVersion The TLS version. + */ + void setTLSVersion( TLSVersion tlsVersion) { m_tlsVersion = tlsVersion; } + // reimplemented from ConnectionBase - virtual ConnectionError connect(); + virtual ConnectionError connect( int timeout = -1 ); // reimplemented from ConnectionBase virtual ConnectionError recv( int timeout = -1 ); @@ -138,6 +145,9 @@ virtual bool send( const std::string& data ); // reimplemented from ConnectionBase + virtual bool send( const char* data, const size_t len ); + + // reimplemented from ConnectionBase virtual ConnectionError receive(); // reimplemented from ConnectionBase @@ -189,6 +199,7 @@ StringList m_cacerts; std::string m_clientCerts; std::string m_clientKey; + TLSVersion m_tlsVersion; private: ConnectionTLS& operator=( const ConnectionTLS& ); Index: libraries/win32/gloox/include/gloox/connectiontlsserver.h =================================================================== --- libraries/win32/gloox/include/gloox/connectiontlsserver.h +++ libraries/win32/gloox/include/gloox/connectiontlsserver.h @@ -10,6 +10,10 @@ * This software is distributed without any warranty. */ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CONNECTIONTLSSERVER ) + #ifndef CONNECTIONTLSSERVER_H__ #define CONNECTIONTLSSERVER_H__ @@ -79,3 +83,5 @@ } #endif // CONNECTIONTLSSERVER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/connectionwebsocket.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/connectionwebsocket.h @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2017-2019 by Jakob Schröter + * 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. + */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_WEBSOCKET ) + +#ifndef CONNECTIONWEBSOCKET_H__ +#define CONNECTIONWEBSOCKET_H__ + +#include +#include +#include + +#if defined(_WIN32) || defined (_WIN32_WCE) +#include +#endif + +#include "gloox.h" +#include "connectionbase.h" +#include "logsink.h" +#include "taghandler.h" +#include "pinghandler.h" +#include "parser.h" +#include "base64.h" +#include "sha.h" + + +#ifndef SYSTEM_RANDOM_FILEPATH +#define SYSTEM_RANDOM_FILEPATH "/dev/urandom" +#endif + +namespace gloox +{ + + /** + * @brief This class implements XMPP over Websocket (RFC7395). + * + * @author Didier Perrotey + * @author Olivier Tchilinguirian + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API ConnectionWebSocket : public ConnectionBase, public ConnectionDataHandler, public TagHandler + { + public: + /** + * Creates a new WebSocket connection. Usually, you would feed it a ConnectionTLS + * and/or ConnectionTCPClient as transport connection (1st parameter). + * The default path part of the URI is @c /xmpp. Use setPath() to change it. + * @param connection The transport connection. + * @param logInstance The LogSink to use for logging. + * @param wsHost The WebSocket host. This will be put in the HTTP request's Host: header. It + * is not used to resolve hostnames or make an actual connection. + * @param ph The PingHandler to receive notifications about WebSocket Pings. Not required + * for full functionality. + */ + ConnectionWebSocket( ConnectionBase* connection, const LogSink& logInstance, const std::string& wsHost, + PingHandler *ph = 0 ); + + /** + * Creates a new WebSocket connection. Usually, you would feed it a ConnectionTLS + * and/or ConnectionTCPClient as transport connection (2nd parameter). + * The default path part of the URI is @c /xmpp. Use setPath() to change it. + * @param cdh The data handler for incoming data. + * @param connection The transport connection. + * @param logInstance The LogSink to use for logging. + * @param wsHost The WebSocket host. This will be put in the HTTP request's Host: header. It + * is not used to resolve hostnames or make an actual connection. + * @param ph The PingHandler to receive notifications about WebSocket Pings. Not required + * for full functionality. + */ + ConnectionWebSocket( ConnectionDataHandler* cdh, ConnectionBase* connection, + const LogSink& logInstance, const std::string& wsHost, + PingHandler *ph = 0 ); + + /** + * Virtual destructor. + */ + virtual ~ConnectionWebSocket(); + + /** + * Sets the WebSocket host. + * @param wsHost The WebSocket host. This will be put in the HTTP request's Host: header. It + * is not used to resolve hostnames or make an actual connection. + */ + void setServer( const std::string& wsHost ) { m_server = wsHost; } + + /** + * Sets the path part of the URI that is the WebSocket endpoint. + * @param path The path. + */ + void setPath( const std::string& path ) { m_path = path; } + + void setMasked( bool bMasked ) { m_bMasked = bMasked; } + + void setFlags( int flags ) { m_flags = flags; } + + // reimplemented from ConnectionBase + virtual ConnectionError connect( int timeout = -1 ); + + // reimplemented from ConnectionBase + virtual ConnectionError recv( int timeout = -1 ); + + // reimplemented from ConnectionBase + virtual bool send( const std::string& data ); + + // reimplemented from ConnectionBase + virtual bool send( const char* data, const size_t len ) ; + + // reimplemented from ConnectionBase + virtual ConnectionError receive(); + + // reimplemented from ConnectionBase + virtual void disconnect(); + + // reimplemented from ConnectionBase + virtual void cleanup(); + + // reimplemented from ConnectionBase + virtual void getStatistics( long int& totalIn, long int& totalOut ); + + // reimplemented from ConnectionBase + virtual std::string header( std::string to, std::string xmlns, std::string xmllang ); + + // reimplemented from ConnectionDataHandler + virtual void handleReceivedData( const ConnectionBase* connection, const std::string& data ); + + // reimplemented from ConnectionDataHandler + virtual void handleConnect( const ConnectionBase* connection ); + + // reimplemented from ConnectionDataHandler + virtual void handleDisconnect( const ConnectionBase* connection, ConnectionError reason ); + + // reimplemented from ConnectionDataHandler + virtual ConnectionBase* newInstance() const; + + // reimplemented from TagHandler + virtual void handleTag( Tag* tag ); + +// virtual ConnectionBase* connectionImpl() const { return m_connection ; }; + + /** + * Sends a WebSocket Ping. + * @param body An optional ping body. + */ + virtual bool sendPingWebSocketFrame( std::string body = EmptyString ); + + private: + + class FrameWebSocket + { + public: + enum wsFrameType + { + wsFrameContinuation, + wsFrameText, + wsFrameBinary, + wsFrameClose = 8, + wsFramePing, + wsFramePong + }; + + /** + * Constructs a new FrameWebSocket object + */ + FrameWebSocket( const LogSink& logInstance, int flags ); + + FrameWebSocket( const LogSink& logInstance, const std::string& payload, wsFrameType frameType, + bool bMasked, int flags ); + + /** + * Virtual destructor. + */ + virtual ~FrameWebSocket() + { + if( m_encodedFrame ) + { + delete[] m_encodedFrame; + m_encodedFrame = 0; + } + }; + + void encode( bool addCRLF = false, int reason = 0 ); + + void decode( std::string& frameContent ); + + unsigned char* getEncodedBuffer() { return m_encodedFrame; }; + + bool isMasked() { return m_MASK; }; + + unsigned long long getFrameLen(); + + unsigned long long getEffectiveLen(); + + unsigned long long getOffsetLen(); + + /** + * Check if frame content is full or partial. + * @return @b True if this frame content is full (no data missing), @b false otherwise. + */ + bool isFull(); + + std::string getPayload() { return m_payload; }; + + void getMask( std::string& mask ); + + wsFrameType getType() { return m_opcode; } + + bool isUnfragmented() { return m_FIN; } + + void dump(); + + private: + + bool m_FIN; + bool m_RSV1; + bool m_RSV2; + bool m_RSV3; + wsFrameType m_opcode; + bool m_MASK; + unsigned long long m_lenPayload; + unsigned long long m_len; + unsigned int m_payloadOffset; + std::string m_payload; + std::string m_maskingKey; + unsigned char* m_encodedFrame; + const LogSink& m_logInstance; + int m_flags; + + }; // ~FrameWebSocket + + enum WebSocketState + { + wsStateDisconnected, + wsStateDisconnecting, + wsStateConnecting, + wsStateClientOpeningHandshake, + wsStateServerOpeningHandshake, + wsStateClientOpeningXmpp, + wsStateClientClosingXmpp, + wsStateServerOpeningXmpp, + wsStateClientOpeningXmppFragmented, + wsStateConnected, + wsStateConnectedFragmented + + }; + + enum WebSocketStatusCode + { + wsStatusNormal = 1000, + wsStatusAway, + wsStatusProtocolError, + wsStatusUnsupportedData, + wsStatusNotReceived = 1005, + wsStatusAbnormalClosure, + wsStatusInvalidData, + wsStatusPolicyViolation, + wsStatusMessageTooBig, + wsStatusMandatoryExtension, + wsStatusInternalServerError, + wsStatusTLSHandshakeError = 1015 + }; + + //ConnectionWebSocket& operator=( const ConnectionWebSocket& ); + int getRandom( unsigned char* buf, int len ); + void initInstance( ConnectionBase* connection ); + const std::string getHTTPField( const std::string& field ); + + bool sendFrame( FrameWebSocket& frame ); + + bool sendOpeningHandshake(); + + bool sendCloseWebSocketFrame( const WebSocketStatusCode status, std::string reason = EmptyString ); + bool sendPongWebSocketFrame( std::string body = EmptyString ); + + bool sendOpenXmppStream(); + bool sendCloseXmppStream( ConnectionError err=ConnUserDisconnected ); + bool sendStartXmppStream(); + bool parse( const std::string &data ); + + bool checkStreamVersion( const std::string& version ); + + ConnectionBase *m_connection; + const LogSink& m_logInstance; + + WebSocketState m_wsstate; + + PingHandler* m_pinghandler; + + std::string m_path; // The path part of the URL that we need to request + std::string m_buffer; // Buffer of received data + std::string m_fragmentBuffer; // Buffer of fragmented received data + std::string m_bufferHeader; // HTTP header of data currently in buffer // FIXME doens't need to be member + std::string::size_type m_bufferContentLength; // Length of the data in the current response + std::string m_sendBuffer; // Data waiting to be sent + std::string m_clientOpeningHandshake; + + Parser m_parser; // Used for parsing XML section of responses + bool m_streamInitiationValidated; + bool m_streamClosureValidated; + bool m_bMasked; + int m_flags; + +#if defined( _WIN32 ) || defined ( _WIN32_WCE ) + HCRYPTPROV m_hCryptProv; +#else + int m_fd_random; +#endif + + }; + +} + +#endif // CONNECTIONWEBSOCKET_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/dataform.h =================================================================== --- libraries/win32/gloox/include/gloox/dataform.h +++ libraries/win32/gloox/include/gloox/dataform.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) || defined( WANT_ADHOC ) + #ifndef DATAFORM_H__ #define DATAFORM_H__ @@ -48,7 +50,7 @@ /** * @brief An abstraction of a @xep{0004} Data Form. * - * + * XEP Version: 2.9 * * @author Jakob Schröter * @since 0.7 @@ -195,3 +197,5 @@ } #endif // DATAFORM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/dataformfield.h =================================================================== --- libraries/win32/gloox/include/gloox/dataformfield.h +++ libraries/win32/gloox/include/gloox/dataformfield.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) || defined( WANT_ADHOC ) + #ifndef DATAFORMFIELD_H__ #define DATAFORMFIELD_H__ @@ -23,6 +25,7 @@ { class Tag; + class DataFormMedia; /** * @brief An abstraction of a single field in a @xep{0004} Data Form. @@ -229,6 +232,7 @@ StringMultiMap m_options; StringList m_values; + DataFormMedia* m_media; std::string m_name; std::string m_desc; @@ -240,3 +244,5 @@ } #endif // DATAFORMFIELD_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/dataformfieldcontainer.h =================================================================== --- libraries/win32/gloox/include/gloox/dataformfieldcontainer.h +++ libraries/win32/gloox/include/gloox/dataformfieldcontainer.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) || defined( WANT_ADHOC ) + #ifndef DATAFORMFIELDCONTAINER_H__ #define DATAFORMFIELDCONTAINER_H__ @@ -123,3 +125,5 @@ } #endif // DATAFORMFIELDCONTAINER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/dataformitem.h =================================================================== --- libraries/win32/gloox/include/gloox/dataformitem.h +++ libraries/win32/gloox/include/gloox/dataformitem.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) || defined( WANT_ADHOC ) + #ifndef DATAFORMITEM_H__ #define DATAFORMITEM_H__ @@ -60,3 +62,5 @@ } #endif // DATAFORMITEM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/dataformmedia.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/dataformmedia.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2019 by Jakob Schröter + * 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. + */ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) || defined( WANT_ADHOC ) + +#ifndef DATAFORMMEDIA_H__ +#define DATAFORMMEDIA_H__ + +#include "macros.h" + +#include + +namespace gloox +{ + + class Tag; + + /** + * An implementation of Data Forms Media Element (@xep{0221}). + * @note So far only a single URI is supported. + * + * XEP version: 1.0 + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API DataFormMedia + { + public: + /** + * Constructs a new object. + * @param uri The mandatory URI to the media. + * @param type The MIME type of the media. + * @param height Optionally, the display height of the media. + * @param width Optionally, the display width of the media. + */ + DataFormMedia( const std::string& uri, const std::string& type, int height = 0, int width = 0 ); + + /** + * Constructs a new object from the given Tag. + * @param tag The Tag to parse. + */ + DataFormMedia( const Tag* tag ); + + /** + * Virtual destructor. + */ + virtual ~DataFormMedia() {} + + /** + * Creates the XML representation of the object. + * @return The XML. + */ + Tag* tag() const; + + /** + * Returns the URI. + * @return The URI. + */ + const std::string& uri() const { return m_uri; } + + /** + * Returns the MIME type. + * @return The MIME type. + */ + const std::string& type() const { return m_type; } + + /** + * Returns the height. + * @return The height. + */ + const int height() const { return m_height; } + + /** + * Returns the width. + * @return The width. + */ + const int width() const { return m_width; } + + private: + std::string m_uri; + std::string m_type; + int m_height; + int m_width; + + }; + +} + +#endif // DATAFORMMEDIA_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/dataformreported.h =================================================================== --- libraries/win32/gloox/include/gloox/dataformreported.h +++ libraries/win32/gloox/include/gloox/dataformreported.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) || defined( WANT_ADHOC ) + #ifndef DATAFORMREPORTED_H__ #define DATAFORMREPORTED_H__ @@ -62,3 +64,5 @@ } #endif // DATAFORMREPORTED_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/delayeddelivery.h =================================================================== --- libraries/win32/gloox/include/gloox/delayeddelivery.h +++ libraries/win32/gloox/include/gloox/delayeddelivery.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DELAYEDDELIVERY ) + #ifndef DELAYEDDELIVERY_H__ #define DELAYEDDELIVERY_H__ @@ -128,3 +130,5 @@ } #endif // DELAYEDDELIVERY_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/disco.h =================================================================== --- libraries/win32/gloox/include/gloox/disco.h +++ libraries/win32/gloox/include/gloox/disco.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DISCO ) #ifndef DISCO_H__ #define DISCO_H__ @@ -28,7 +29,9 @@ { class ClientBase; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) class DataForm; +#endif // GLOOX_MINIMAL class DiscoHandler; class DiscoNodeHandler; class IQ; @@ -92,6 +95,7 @@ */ const IdentityList& identities() const { return m_identities; } +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) /** * Returns an optionally included data form. This is used by e.g. MUC (@xep{0045}). * @return An optional data form included in the disco#info. May be 0. @@ -106,6 +110,7 @@ * @note If called more than once the previously set form will be deleted. */ void setForm( DataForm* form ); +#endif // GLOOX_MINIMAL // reimplemented from StanzaExtension virtual const std::string& filterString() const; @@ -184,7 +189,10 @@ std::string m_node; StringList m_features; IdentityList m_identities; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) DataForm* m_form; +#endif // GLOOX_MINIMAL + }; /** @@ -528,6 +536,7 @@ */ const IdentityList& identities() const { return m_identities; } +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) /** * Adds an optional DataForm to Disco:Info replies, e.g. for @xep{0232}. * Only one form can be added at this point. @@ -542,6 +551,7 @@ * @return The DataForm, or 0. */ const DataForm* form() const { return m_form; } +#endif // GLOOX_MINIMAL /** * Use this function to register an @ref DiscoHandler with the Disco @@ -623,7 +633,9 @@ IdentityList m_identities; StringList m_features; StringMap m_queryIDs; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DATAFORM ) DataForm* m_form; +#endif // GLOOX_MINIMAL std::string m_versionName; std::string m_versionVersion; @@ -634,3 +646,5 @@ } #endif // DISCO_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/discohandler.h =================================================================== --- libraries/win32/gloox/include/gloox/discohandler.h +++ libraries/win32/gloox/include/gloox/discohandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DISCO ) + #ifndef DISCOHANDLER_H__ #define DISCOHANDLER_H__ @@ -81,3 +83,5 @@ } #endif // DISCOHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/disconodehandler.h =================================================================== --- libraries/win32/gloox/include/gloox/disconodehandler.h +++ libraries/win32/gloox/include/gloox/disconodehandler.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DISCO ) #ifndef DISCONODEHANDLER_H__ #define DISCONODEHANDLER_H__ @@ -79,3 +80,5 @@ } #endif // DISCONODEHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/dns.h =================================================================== --- libraries/win32/gloox/include/gloox/dns.h +++ libraries/win32/gloox/include/gloox/dns.h @@ -95,9 +95,10 @@ * and connects to one of them. * @param host The host to resolve SRV records for. * @param logInstance A LogSink to use for logging. + * @param timeout The timeout to use for select() in milliseconds. Default of -1 means blocking. * @return A file descriptor for the established connection. */ - static int connect( const std::string& host, const LogSink& logInstance ); + static int connect( const std::string& host, const LogSink& logInstance, const int timeout = -1 ); /** * This is a convenience function which connects to the given host and port. No SRV @@ -105,9 +106,10 @@ * @param host The host/IP address to connect to. * @param port A custom port to connect to. * @param logInstance A LogSink to use for logging. + * @param timeout The timeout to use for select() in milliseconds. Default of -1 means blocking. * @return A file descriptor for the established connection. */ - static int connect( const std::string& host, int port, const LogSink& logInstance ); + static int connect( const std::string& host, int port, const LogSink& logInstance, const int timeout = -1 ); /** * A convenience function that prepares and returnes a simple, unconnected TCP socket. Index: libraries/win32/gloox/include/gloox/error.h =================================================================== --- libraries/win32/gloox/include/gloox/error.h +++ libraries/win32/gloox/include/gloox/error.h @@ -10,6 +10,7 @@ This software is distributed without any warranty. */ + #ifndef ERROR_H__ #define ERROR_H__ @@ -142,4 +143,4 @@ } -#endif // ERROR_H__ +#endif /* ERROR_H__ */ Index: libraries/win32/gloox/include/gloox/featureneg.h =================================================================== --- libraries/win32/gloox/include/gloox/featureneg.h +++ libraries/win32/gloox/include/gloox/featureneg.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_FEATURENEG ) + #ifndef FEATURENEG_H__ #define FEATURENEG_H__ @@ -84,3 +86,5 @@ } #endif // FEATURENEG_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/flexoff.h =================================================================== --- libraries/win32/gloox/include/gloox/flexoff.h +++ libraries/win32/gloox/include/gloox/flexoff.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_FLEXOFF ) + #ifndef FLEXOFF_H__ #define FLEXOFF_H__ @@ -176,3 +178,5 @@ } #endif // FLEXOFF_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/flexoffhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/flexoffhandler.h +++ libraries/win32/gloox/include/gloox/flexoffhandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_FLEXOFF ) + #ifndef FLEXOFFHANDLER_H__ #define FLEXOFFHANDLER_H__ @@ -80,3 +82,5 @@ } #endif // FLEXOFFHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/forward.h =================================================================== --- libraries/win32/gloox/include/gloox/forward.h +++ libraries/win32/gloox/include/gloox/forward.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_FORWARD ) + #ifndef FORWARD_H__ #define FORWARD_H__ @@ -102,3 +104,5 @@ } #endif // FORWARD_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/gloox.h =================================================================== --- libraries/win32/gloox/include/gloox/gloox.h +++ libraries/win32/gloox/include/gloox/gloox.h @@ -311,6 +311,7 @@ * @li @xep{0131} @link gloox::SHIM Stanza Headers and Internet Metadata @endlink * @li @xep{0138} Stream Compression (used automatically if gloox is compiled with zlib and if the server * supports it) + * @li @xep{0144} @link gloox::RosterX Roster Item Exchange @endlink * @li @xep{0145} @link gloox::Annotations Annotations @endlink * @li @xep{0153} @link gloox::VCardUpdate vCard-based Avatars @endlink * @li @xep{0166} @link gloox::Jingle::SessionManager Jingle @endlink @@ -327,7 +328,13 @@ * @li @xep{0256} @link gloox::LastActivity::Query Last Activity in Presence @endlink * @li @xep{0280} @link gloox::Carbons Message Carbons @endlink * @li @xep{0297} @link gloox::Forward Stanza Forwarding @endlink + * @li @xep{0333} @link gloox::ChatMarker Chat Markers @endlink + * @li @xep{0334} @link gloox::Hint Message Processing Hints @endlink * @li @xep{0352} @link gloox::Client::hasClientStateIndication() Client State Indication @endlink + * @li @xep{0372} @link gloox::Reference References @endlink + * @li @xep{0394} @link gloox::MessageMarkup Message Markup @endlink + * + * @li RFC 7395: XMPP Over WebSocket, see @link gloox::ConnectionWebSocket WebSocket @endlink * * Further extensions can easily be implemented using * @link gloox::StanzaExtension StanzaExtensions @endlink. @@ -355,6 +362,8 @@ #include "macros.h" +#include + #include #include #include @@ -604,6 +613,9 @@ /** Message Carbons namespace (@xep{0280}) */ GLOOX_API extern const std::string XMLNS_MESSAGE_CARBONS; + /** Shared XML Editing namespace (@xep{0284}) */ + GLOOX_API extern const std::string XMLNS_SXE; + /** Client State Indication namespace (@xep{0352}) */ GLOOX_API extern const std::string XMLNS_CLIENT_STATE_INDICATION; @@ -613,6 +625,30 @@ /** IO Data (@xep{0244}) */ GLOOX_API extern const std::string XMLNS_IODATA; + /** Roster Item Exchange (@xep{0144}) */ + GLOOX_API extern const std::string XMLNS_ROSTER_X; + + /** Websocket protocol (RFC 7395) */ + GLOOX_API extern const std::string XMLNS_XMPP_FRAMING; + + /** Chat Markers (@xep{0333}) */ + GLOOX_API extern const std::string XMLNS_CHAT_MARKERS; + + /** Message Markup (@xep{0394}) */ + GLOOX_API extern const std::string XMLNS_MESSAGE_MARKUP; + + /** Message Markup (@xep{0372}) */ + GLOOX_API extern const std::string XMLNS_REFERENCES; + + /** Message Processing Hints (@xep{0334}) */ + GLOOX_API extern const std::string XMLNS_HINTS; + + /** Bits of Binary (@xep{0231}) */ + GLOOX_API extern const std::string XMLNS_BOB; + + /** Data Form Media Element (@xep{0221}) */ + GLOOX_API extern const std::string XMLNS_DATAFORM_MEDIA; + /** Supported stream version (major). */ GLOOX_API extern const std::string XMPP_STREAM_VERSION_MAJOR; @@ -687,6 +723,8 @@ * Use ClientBase::streamError() to find the reason. */ ConnStreamVersionError, /**< The incoming stream's version is not supported */ ConnStreamClosed, /**< The stream has been closed (by the server). */ + ConnProxyGatewayTimeout, /**< The server, while acting as a gateway or proxy, did not receive a + * timely response from the upstream server specified by the URI. */ ConnProxyAuthRequired, /**< The HTTP/SOCKS5 proxy requires authentication. * @since 0.9 */ ConnProxyAuthFailed, /**< HTTP/SOCKS5 proxy authentication failed. @@ -712,7 +750,8 @@ ConnAuthenticationFailed, /**< Authentication failed. Username/password wrong or account does * not exist. Use ClientBase::authError() to find the reason. */ ConnUserDisconnected, /**< The user (or higher-level protocol) requested a disconnect. */ - ConnNotConnected /**< There is no active connection. */ + ConnNotConnected, /**< There is no active connection. */ + ConnAttemptTimeout /**< The connection attempt timed out. */ }; /** @@ -728,6 +767,24 @@ }; /** + * The (minimum) required/requested TLS version. Use with ClientBase::setTls() or + * directly with a TLSBase-derived object (setTLSVersion()). + */ + enum TLSVersion + { + SSLv3, /**< Insecure and outdated version. Use at your own risk. + * Possibly not supported by your crypto lib. */ + TLSv1, /**< Use this to require TLS v1 as a minimum. Default. */ + TLSv1_1, /**< Use this to require TLS v1.1 as a minimum. */ + TLSv1_2, /**< Use this to require TLS v1.2 as a minimum. */ +// TLSv1_3, /**< Use this to require TLS v1.3 as a minimum. */ + DTLSv1, /**< Use this to require DTLS v1 as a minimum. + * Requires a datagram-based transport (e.g. UDP). */ + DTLSv1_2 /**< Use this to require DTLS v1.2 as a minimum. + * Requires a datagram-based transport (e.g. UDP). */ + }; + + /** * Supported Stream Features. */ enum StreamFeature @@ -984,6 +1041,11 @@ }; /** + * A list of strings. + */ + typedef std::list StringList; + + /** * Describes the certificate presented by the peer. */ struct CertInfo @@ -1002,6 +1064,7 @@ std::string cipher; /**< The cipher used for the connection. */ std::string mac; /**< The MAC used for the connection. */ std::string compression; /**< The compression used for the connection. */ + StringList listSAN; /**< List of Subject Alternative Names. */ }; /** @@ -1066,6 +1129,7 @@ LogAreaClassConnectionBOSH = 0x001000, /**< Log messages from ConnectionBOSH */ LogAreaClassConnectionTLS = 0x002000, /**< Log messages from ConnectionTLS */ LogAreaLinkLocalManager = 0x004000, /**< Log messages from LinkLocalManager */ + LogAreaClassConnectionWebSocket = 0x008000, /**< Log messages from ConnectionWebSocket */ LogAreaAllClasses = 0x01FFFF, /**< All log messages from all the classes. */ LogAreaXmlIncoming = 0x020000, /**< Incoming XML. */ LogAreaXmlOutgoing = 0x040000, /**< Outgoing XML. */ @@ -1113,6 +1177,19 @@ }; /** + * The available Chat Marker types according to @xep{0333}. + */ + enum ChatMarkerType + { + ChatMarkerReceived = 1, /**< The message has been received by a client. */ + ChatMarkerDisplayed = 2, /**< The message has been displayed to a user in a active chat + * and not in a system notification. */ + ChatMarkerAcknowledged = 4, /**< The message has been acknowledged by some user interaction + * e.g. pressing an acknowledgement button. */ + ChatMarkerInvalid = 8 /**< Invalid type. */ + }; + + /** * Describes the possible error conditions for resource binding. */ enum ResourceBindError Index: libraries/win32/gloox/include/gloox/glooxversion.h =================================================================== --- libraries/win32/gloox/include/gloox/glooxversion.h +++ libraries/win32/gloox/include/gloox/glooxversion.h @@ -10,4 +10,5 @@ This software is distributed without any warranty. */ -#define GLOOXVERSION 0x010020 +#define GLOOXVERSION 0x010100 + Index: libraries/win32/gloox/include/gloox/gpgencrypted.h =================================================================== --- libraries/win32/gloox/include/gloox/gpgencrypted.h +++ libraries/win32/gloox/include/gloox/gpgencrypted.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_GPGENCRYPTED ) + #ifndef GPGENCRYPTED_H__ #define GPGENCRYPTED_H__ @@ -89,3 +91,5 @@ } #endif // GPGENCRYPTED_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/gpgsigned.h =================================================================== --- libraries/win32/gloox/include/gloox/gpgsigned.h +++ libraries/win32/gloox/include/gloox/gpgsigned.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_GPGSIGNED ) + #ifndef GPGSIGNED_H__ #define GPGSIGNED_H__ @@ -89,3 +91,5 @@ } #endif // GPGSIGNED_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/hint.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/hint.h @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2018-2019 by Jakob Schröter + * 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. + */ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_HINTS ) + +#ifndef HINT_H__ +#define HINT_H__ + +#include "gloox.h" +#include "stanzaextension.h" + +#include +#include + +namespace gloox +{ + /** + * This is an abstraction of Message Processing Hints (@xep{0334}). + * + * XEP Version: 0.3.0 + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API Hint : public StanzaExtension + { + public: + + /** + * The supported Message Processing Hints types according to @xep{0334}. + */ + enum HintType + { + NoPermanentStore, /**< The message shouldn't be stored in any permanent or semi-permanent + * public or private archive or in logs (such as chatroom logs) */ + NoStore, /**< A message containing this hint should not be stored by a server either + * permanently (as for NoPermanentStore) or temporarily, e.g. for later + * delivery to an offline client, or to users not currently present in a + * chatroom. */ + NoCopy, /**< Messages with this hint should not be copied to addresses other than + * the one to which it is addressed, for example through Message Carbons + * (@xep{0280}). */ + Store, /**< A message containing this hint that is not of type 'error' SHOULD be + * stored by the entity. */ + InvalidType /**< Invalid type. Ignored. */ + }; + + /** + * Constructs a new object from the given Tag. + * @param tag A Tag to parse. + */ + Hint( const Tag* tag ); + + /** + * Constructs a new Hint object of the given type. + * @param ml The hint type. + */ + Hint( HintType type ) + : StanzaExtension( ExtHint ), m_type( type ) + {} + + /** + * Virtual destructor. + */ + virtual ~Hint() {} + + /** + * Lets you retrieve the hint's type. + * @return The hint's type. + */ + HintType type() const { return m_type; } + + // reimplemented from StanzaExtension + virtual const std::string& filterString() const; + + // reimplemented from StanzaExtension + virtual StanzaExtension* newInstance( const Tag* tag ) const + { + return new Hint( tag ); + } + + // reimplemented from StanzaExtension + Tag* tag() const; + + // reimplemented from StanzaExtension + virtual Hint* clone() const + { + return new Hint( *this ); + } + + private: + HintType m_type; + + }; + +} + +#endif // HINT_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/inbandbytestream.h =================================================================== --- libraries/win32/gloox/include/gloox/inbandbytestream.h +++ libraries/win32/gloox/include/gloox/inbandbytestream.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BYTESTREAM ) + #ifndef INBANDBYTESTREAM_H__ #define INBANDBYTESTREAM_H__ @@ -72,7 +74,7 @@ bool send( const std::string& data ); // reimplemented from Bytestream - virtual bool connect(); + virtual bool connect( int timeout = -1 ); // reimplemented from Bytestream virtual void close(); @@ -200,6 +202,7 @@ const JID& target, const std::string& sid ); InBandBytestream& operator=( const InBandBytestream& ); void closed(); // by remote entity + void error( const IQ& iq ); // by remote entity void returnResult( const JID& to, const std::string& id ); void returnError( const JID& to, const std::string& id, StanzaErrorType type, StanzaError error ); @@ -207,9 +210,12 @@ int m_blockSize; int m_sequence; int m_lastChunkReceived; + const LogSink& m_logInstance; }; } #endif // INBANDBYTESTREAM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/instantmucroom.h =================================================================== --- libraries/win32/gloox/include/gloox/instantmucroom.h +++ libraries/win32/gloox/include/gloox/instantmucroom.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) #ifndef INSTANTMUCROOM_H__ #define INSTANTMUCROOM_H__ @@ -58,3 +59,5 @@ } #endif // INSTANTMUCROOM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/iodata.h =================================================================== --- libraries/win32/gloox/include/gloox/iodata.h +++ libraries/win32/gloox/include/gloox/iodata.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_IODATA ) || defined( WANT_ADHOC ) + #ifndef IODATA_H__ #define IODATA_H__ @@ -190,3 +192,5 @@ } #endif // IODATA_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/jinglecontent.h =================================================================== --- libraries/win32/gloox/include/gloox/jinglecontent.h +++ libraries/win32/gloox/include/gloox/jinglecontent.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_JINGLE ) + #ifndef JINGLECONTENT_H__ #define JINGLECONTENT_H__ @@ -136,3 +138,5 @@ } #endif // JINGLECONTENT_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/jinglefiletransfer.h =================================================================== --- libraries/win32/gloox/include/gloox/jinglefiletransfer.h +++ libraries/win32/gloox/include/gloox/jinglefiletransfer.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_JINGLE ) + #ifndef JINGLEFILETRANSFER_H__ #define JINGLEFILETRANSFER_H__ @@ -132,3 +134,5 @@ } #endif // JINGLEFILETRANSFER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/jingleiceudp.h =================================================================== --- libraries/win32/gloox/include/gloox/jingleiceudp.h +++ libraries/win32/gloox/include/gloox/jingleiceudp.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_JINGLE ) + #ifndef JINGLEICEUDP_H__ #define JINGLEICEUDP_H__ @@ -139,3 +141,5 @@ } #endif // JINGLEICEUDP_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/jingleplugin.h =================================================================== --- libraries/win32/gloox/include/gloox/jingleplugin.h +++ libraries/win32/gloox/include/gloox/jingleplugin.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_JINGLE ) + #ifndef JINGLEPLUGIN_H__ #define JINGLEPLUGIN_H__ @@ -177,3 +179,5 @@ } #endif // JINGLEPLUGIN_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/jinglepluginfactory.h =================================================================== --- libraries/win32/gloox/include/gloox/jinglepluginfactory.h +++ libraries/win32/gloox/include/gloox/jinglepluginfactory.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_JINGLE ) + #ifndef JINGLEPLUGINFACTORY_H__ #define JINGLEPLUGINFACTORY_H__ @@ -80,3 +82,5 @@ } #endif // JINGLEPLUGINFACTORY_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/jinglesession.h =================================================================== --- libraries/win32/gloox/include/gloox/jinglesession.h +++ libraries/win32/gloox/include/gloox/jinglesession.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_JINGLE ) + #ifndef JINGLESESSION_H__ #define JINGLESESSION_H__ @@ -573,3 +575,5 @@ } #endif // JINGLESESSION_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/jinglesessionhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/jinglesessionhandler.h +++ libraries/win32/gloox/include/gloox/jinglesessionhandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_JINGLE ) + #ifndef JINGLESESSIONHANDLER_H__ #define JINGLESESSIONHANDLER_H__ @@ -72,3 +74,5 @@ } #endif // JINGLESESSIONHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/jinglesessionmanager.h =================================================================== --- libraries/win32/gloox/include/gloox/jinglesessionmanager.h +++ libraries/win32/gloox/include/gloox/jinglesessionmanager.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_JINGLE ) + #ifndef JINGLESESSIONMANAGER_H__ #define JINGLESESSIONMANAGER_H__ @@ -115,3 +117,5 @@ } #endif // JINGLESESSIONMANAGER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/jingletransport.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/jingletransport.h @@ -0,0 +1,60 @@ +/* + Copyright (c) 2008-2019 by Jakob Schröter + 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. +*/ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_JINGLE ) + +#ifndef JINGLETRANSPORT_H__ +#define JINGLETRANSPORT_H__ + +#include "jingleplugin.h" + +#include + +namespace gloox +{ + + namespace Jingle + { + + /** + * @brief An abstract base class of a Jingle Transport. This is part of Jingle (@xep{0166}). + * + * You should not need to use this class directly unless you are extending gloox. See + * @link gloox::Jingle::Session Jingle::Session @endlink for more info on Jingle. + * + * XEP Version: 1.1 + * + * @author Jakob Schröter + * @since 1.0.5 + */ + class GLOOX_API Transport : public Plugin + { + public: + /** + * Virtual destructor. + */ + virtual ~Transport() {} + + protected: + /** The Transport's namespace. */ +// const std::string m_xmlns; + + }; + + } + +} + +#endif // JINGLETRANSPORT_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/lastactivity.h =================================================================== --- libraries/win32/gloox/include/gloox/lastactivity.h +++ libraries/win32/gloox/include/gloox/lastactivity.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_LASTACTIVITY ) + #ifndef LASTACTIVITY_H__ #define LASTACTIVITY_H__ @@ -164,3 +166,5 @@ } #endif // LASTACTIVITY_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/lastactivityhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/lastactivityhandler.h +++ libraries/win32/gloox/include/gloox/lastactivityhandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_LASTACTIVITY ) + #ifndef LASTACTIVITYHANDLER_H__ #define LASTACTIVITYHANDLER_H__ @@ -56,3 +58,5 @@ } #endif // LASTACTIVITYHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/linklocal.h =================================================================== --- libraries/win32/gloox/include/gloox/linklocal.h +++ libraries/win32/gloox/include/gloox/linklocal.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_LINKLOCAL ) + #ifndef LINKLOCAL_H__ #define LINKLOCAL_H__ @@ -77,3 +80,5 @@ #endif // HAVE_MDNS #endif // LINKLOCAL_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/linklocalclient.h =================================================================== --- libraries/win32/gloox/include/gloox/linklocalclient.h +++ libraries/win32/gloox/include/gloox/linklocalclient.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_LINKLOCAL ) + #ifndef LINKLOCALCLIENT_H__ #define LINKLOCALCLIENT_H__ @@ -123,3 +125,5 @@ #endif // HAVE_MDNS #endif // LINKLOCALCLIENT_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/linklocalhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/linklocalhandler.h +++ libraries/win32/gloox/include/gloox/linklocalhandler.h @@ -10,6 +10,8 @@ This software is distributed without any warranty. */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_LINKLOCAL ) + #ifndef LINKLOCALHANDLER_H__ #define LINKLOCALHANDLER_H__ @@ -64,3 +66,5 @@ #endif // HAVE_MDNS #endif // LINKLOCALHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/linklocalmanager.h =================================================================== --- libraries/win32/gloox/include/gloox/linklocalmanager.h +++ libraries/win32/gloox/include/gloox/linklocalmanager.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_LINKLOCAL ) + #ifndef LINKLOCALMANAGER_H___ #define LINKLOCALMANAGER_H___ @@ -354,3 +357,5 @@ #endif // HAVE_MDNS #endif // LINKLOCALMANAGER_H___ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/macros.h =================================================================== --- libraries/win32/gloox/include/gloox/macros.h +++ libraries/win32/gloox/include/gloox/macros.h @@ -19,7 +19,7 @@ # pragma warning( disable:4786 ) #endif -#if defined( _WIN32 ) && !defined( __SYMBIAN32__ ) +#if defined( _WIN32 ) # if defined( GLOOX_EXPORTS ) || defined( DLL_EXPORT ) # define GLOOX_API __declspec( dllexport ) # else Index: libraries/win32/gloox/include/gloox/md5.h =================================================================== --- libraries/win32/gloox/include/gloox/md5.h +++ libraries/win32/gloox/include/gloox/md5.h @@ -127,7 +127,15 @@ */ void reset(); - private: + /** + * Static function to quickly get an SHA1 hash in hex. + * @param data The data to hash. + * @return The hash in hex. + * @since 1.1 + */ + static const std::string hex( const std::string& data ); + + private: struct MD5State { unsigned int count[2]; /* message length in bits, lsw first */ Index: libraries/win32/gloox/include/gloox/message.h =================================================================== --- libraries/win32/gloox/include/gloox/message.h +++ libraries/win32/gloox/include/gloox/message.h @@ -121,6 +121,7 @@ */ void setID( const std::string& id ) { m_id = id; } +#if !defined( GLOOX_MINIMAL ) || defined( WANT_DELAYEDDELIVERY ) /** * Convenience function that returns a pointer to a DelayedDelivery StanzaExtension, if the * message contains one. @@ -132,6 +133,7 @@ { return static_cast( findExtension( ExtDelay ) ); } +#endif // GLOOX_MINIMAL // reimplemented from Stanza virtual Tag* tag() const; Index: libraries/win32/gloox/include/gloox/messageevent.h =================================================================== --- libraries/win32/gloox/include/gloox/messageevent.h +++ libraries/win32/gloox/include/gloox/messageevent.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGEEVENT ) + #ifndef MESSAGEEVENT_H__ #define MESSAGEEVENT_H__ @@ -92,3 +95,5 @@ } #endif // MESSAGEEVENT_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/messageeventhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/messageeventhandler.h +++ libraries/win32/gloox/include/gloox/messageeventhandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGEEVENT ) + #ifndef MESSAGEEVENTHANDLER_H__ #define MESSAGEEVENTHANDLER_H__ @@ -20,6 +22,7 @@ { class JID; + class MessageEvent; /** * @brief A virtual interface that enables an object to be notified about @@ -42,10 +45,12 @@ * @param from The originator of the Event. * @param event The Event which has been raised. */ - virtual void handleMessageEvent( const JID& from, MessageEventType event ) = 0; + virtual void handleMessageEvent( const JID& from, const MessageEvent* event ) = 0; }; } #endif // MESSAGEEVENTHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/messagefilter.h =================================================================== --- libraries/win32/gloox/include/gloox/messagefilter.h +++ libraries/win32/gloox/include/gloox/messagefilter.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGESESSION ) + #ifndef MESSAGEFILTER_H__ #define MESSAGEFILTER_H__ @@ -82,3 +84,5 @@ } #endif // MESSAGEFILTER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/messagemarkup.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/messagemarkup.h @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2018-2019 by Jakob Schröter + * 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. + */ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGEMARKUP ) + +#ifndef MESSAGEMARKUP_H__ +#define MESSAGEMARKUP_H__ + +#include "gloox.h" +#include "stanzaextension.h" + +#include +#include + +namespace gloox +{ + /** + * This is an abstraction of Message Markup (@xep{0394}). + * + * XEP Version: 0.1.0 + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API MessageMarkup : public StanzaExtension + { + public: + + /** + * A list of ints. + */ + typedef std::list IntList; + + /** + * The supported Message Markup types according to @xep{0394}. + */ + enum MarkupType + { + Span, /**< A span, possibly containing emphasis, code and/or deleted tags. */ + BCode, /**< A code block. Suggested rendering: as block-level element with + * monospaced font. */ + List, /**< An itemized list. */ + BQuote, /**< A block quote. */ + InvalidType /**< Invalid/unknown type. Ignored. */ + }; + + /** + * The supported Span types according to @xep{0394}. + */ + enum SpanType + { + Emphasis = 1, /**< An emphasised section of text. */ + Code = 2, /**< Suggested rendering: with monospaced font. */ + Deleted = 4, /**< Deleted text. Suggested rendering strike-through. */ + InvalidSpan = 8 /**< Invalid/unknown type. Ignored. */ + }; + + /** + * A struct describing a single child element of a <markup> element. + */ + struct Markup + { + MarkupType type; /**< The type. */ + int start; /**< The start of the range, in units of unicode code points in the character + * data of the body element. */ + int end; /**< The end of the range, in units of unicode code points in the character + * data of the body element. */ + int spans; /**< The applicable span types (SpanType) for the current span. Only set if + * @c type is @c Span, 0 otherwise. */ + IntList lis; /**< A list of positions inside the text that are start positions for list + * items. Only used if @c type is List, empty otherwise. */ + + /** + * Constructor for a Markup struct for convenience. + * @param _type The type. + * @param _start The start of the range. + * @param _end The end of the range. + * @param _spans The applicable span types (SpanType) for the current span. + * @param _lis A list of positions inside the text that are start positions for list + * items. + */ + Markup( MarkupType _type, int _start, int _end, int _spans, IntList _lis ) + : type( _type ), start( _start ), end( _end ), spans( _spans ), lis( _lis ) + {} + + }; + + /** + * A list of Markup structs. + */ + typedef std::list MarkupList; + + /** + * Constructs a new object from the given Tag. + * @param tag A Tag to parse. + */ + MessageMarkup( const Tag* tag ); + + /** + * Constructs a new MessageMarkup object with the given markups. + * @param ml The markups to include. + */ + MessageMarkup( const MarkupList& ml ) + : StanzaExtension( ExtMessageMarkup ), m_markups( ml ) + {} + + /** + * Virtual destructor. + */ + virtual ~MessageMarkup() {} + + /** + * Lets you set the @c lang attribute (@c xml:lang) to that of the corresponding body element. + * @param lang The language. + */ + void setLang( const std::string& lang ) { m_lang = lang; } + + /** + * Lets you retrieve the @c lang attribute's value (@c xml:lang). + * @return The @c lang attribute's value. + */ + const std::string& lang() const { return m_lang; } + + /** + * Returns the list of markups. + * @return The list of markups. + */ + const MarkupList& markup() const { return m_markups; } + + // reimplemented from StanzaExtension + virtual const std::string& filterString() const; + + // reimplemented from StanzaExtension + virtual StanzaExtension* newInstance( const Tag* tag ) const + { + return new MessageMarkup( tag ); + } + + // reimplemented from StanzaExtension + Tag* tag() const; + + // reimplemented from StanzaExtension + virtual MessageMarkup* clone() const + { + return new MessageMarkup( *this ); + } + + private: + MarkupList m_markups; + std::string m_lang; + + }; + +} + +#endif // MESSAGEMARKUP_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/messagesession.h =================================================================== --- libraries/win32/gloox/include/gloox/messagesession.h +++ libraries/win32/gloox/include/gloox/messagesession.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGESESSION ) + #ifndef MESSAGESESSION_H__ #define MESSAGESESSION_H__ @@ -316,3 +318,5 @@ } #endif // MESSAGESESSION_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/messagesessionhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/messagesessionhandler.h +++ libraries/win32/gloox/include/gloox/messagesessionhandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MESSAGESESSION ) + #ifndef MESSAGESESSIONHANDLER_H__ #define MESSAGESESSIONHANDLER_H__ @@ -65,3 +67,5 @@ } #endif // MESSAGESESSIONHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/mucinvitationhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/mucinvitationhandler.h +++ libraries/win32/gloox/include/gloox/mucinvitationhandler.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) #ifndef MUCINVITATIONHANDLER_H__ #define MUCINVITATIONHANDLER_H__ @@ -65,3 +66,5 @@ } #endif // MUCINVITATIONHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/mucmessagesession.h =================================================================== --- libraries/win32/gloox/include/gloox/mucmessagesession.h +++ libraries/win32/gloox/include/gloox/mucmessagesession.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) + #ifndef MUCMESSAGESESSION_H__ #define MUCMESSAGESESSION_H__ @@ -64,3 +66,5 @@ } #endif // MUCMESSAGESESSION_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/mucroom.h =================================================================== --- libraries/win32/gloox/include/gloox/mucroom.h +++ libraries/win32/gloox/include/gloox/mucroom.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) #ifndef MUCROOM_H__ #define MUCROOM_H__ @@ -992,3 +993,5 @@ } #endif // MUCROOM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/mucroomconfighandler.h =================================================================== --- libraries/win32/gloox/include/gloox/mucroomconfighandler.h +++ libraries/win32/gloox/include/gloox/mucroomconfighandler.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) #ifndef MUCROOMCONFIGHANDLER_H__ #define MUCROOMCONFIGHANDLER_H__ @@ -224,3 +225,5 @@ } #endif // MUCROOMCONFIGHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/mucroomhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/mucroomhandler.h +++ libraries/win32/gloox/include/gloox/mucroomhandler.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) #ifndef MUCROOMHANDLER_H__ #define MUCROOMHANDLER_H__ @@ -214,3 +215,5 @@ } #endif// MUCROOMHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/nickname.h =================================================================== --- libraries/win32/gloox/include/gloox/nickname.h +++ libraries/win32/gloox/include/gloox/nickname.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_NICKNAME ) + #ifndef NICKNAME_H__ #define NICKNAME_H__ @@ -85,3 +88,5 @@ } #endif // NICKNAME_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/nonsaslauth.h =================================================================== --- libraries/win32/gloox/include/gloox/nonsaslauth.h +++ libraries/win32/gloox/include/gloox/nonsaslauth.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_NONSASLAUTH ) + #ifndef NONSASLAUTH_H__ #define NONSASLAUTH_H__ @@ -145,3 +147,5 @@ } #endif // NONSASLAUTH_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/oob.h =================================================================== --- libraries/win32/gloox/include/gloox/oob.h +++ libraries/win32/gloox/include/gloox/oob.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_OOB ) + #ifndef OOB_H__ #define OOB_H__ @@ -99,3 +101,5 @@ } #endif // OOB_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/pinghandler.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/pinghandler.h @@ -0,0 +1,69 @@ +/* + Copyright (c) 2004-2019 by Jakob Schröter + 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. +*/ + + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PING ) + +#ifndef PINGHANDLER_H__ +#define PINGHANDLER_H__ + +#include "gloox.h" + +#include + +namespace gloox +{ + + /** + * @brief A virtual interface which can be reimplemented to receive ping stanzas. + * + * Derived classes can be registered as PingHandlers with the Client. + * Upon an incoming Ping or Pong packet @ref handlePing() will be called. + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API PingHandler + { + public: + + /** + * The supported ping types. + */ + enum PingType + { + websocketPing = 0, /**< A WebSocket Ping. */ + websocketPong, /**< A WebSocket Pong (ping reply). */ + whitespacePing /**< A whitespace ping. */ + }; + + /** + * Virtual Destructor. + */ + virtual ~PingHandler() {} + + /** + * Reimplement this function if you want to be updated on + * incoming ping or pong notifications. + * @param body The content of the ping or pong stanza. + * @since 1.1 + */ + virtual void handlePing( PingType type, const std::string& body ) = 0; + + }; + +} + +#endif // PINGHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/presence.h =================================================================== --- libraries/win32/gloox/include/gloox/presence.h +++ libraries/win32/gloox/include/gloox/presence.h @@ -20,7 +20,9 @@ namespace gloox { +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CAPABILITIES ) class Capabilities; +#endif // GLOOX_MINIMAL class JID; /** @@ -75,11 +77,13 @@ */ PresenceType subtype() const { return m_subtype; } +#if !defined( GLOOX_MINIMAL ) || defined( WANT_CAPABILITIES ) /** * A convenience function returning the stanza's Capabilities, if any. May be 0. * @return A pointer to a Capabilities object, or 0. */ const Capabilities* capabilities() const; +#endif // GLOOX_MINIMAL /** * Returns the presence's type. Index: libraries/win32/gloox/include/gloox/privacyitem.h =================================================================== --- libraries/win32/gloox/include/gloox/privacyitem.h +++ libraries/win32/gloox/include/gloox/privacyitem.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVACYLISTS ) + #ifndef PRIVACYITEM_H__ #define PRIVACYITEM_H__ @@ -124,3 +126,5 @@ } #endif // PRIVACYITEM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/privacylisthandler.h =================================================================== --- libraries/win32/gloox/include/gloox/privacylisthandler.h +++ libraries/win32/gloox/include/gloox/privacylisthandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVACYLISTS ) + #ifndef PRIVACYLISTHANDLER_H__ #define PRIVACYLISTHANDLER_H__ @@ -97,3 +99,5 @@ } #endif // PRIVACYLISTHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/privacymanager.h =================================================================== --- libraries/win32/gloox/include/gloox/privacymanager.h +++ libraries/win32/gloox/include/gloox/privacymanager.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVACYLISTS ) + #ifndef PRIVACYMANAGER_H__ #define PRIVACYMANAGER_H__ @@ -229,3 +231,5 @@ } #endif // PRIVACYMANAGER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/privatexml.h =================================================================== --- libraries/win32/gloox/include/gloox/privatexml.h +++ libraries/win32/gloox/include/gloox/privatexml.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVATEXML ) #ifndef PRIVATEXML_H__ #define PRIVATEXML_H__ @@ -158,3 +159,5 @@ } #endif // PRIVATEXML_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/privatexmlhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/privatexmlhandler.h +++ libraries/win32/gloox/include/gloox/privatexmlhandler.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVATEXML ) #ifndef PRIVATEXMLHANDLER_H__ #define PRIVATEXMLHANDLER_H__ @@ -71,3 +72,5 @@ } #endif // PRIVATEXMLHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/pubsub.h =================================================================== --- libraries/win32/gloox/include/gloox/pubsub.h +++ libraries/win32/gloox/include/gloox/pubsub.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PUBSUB ) + #ifndef PUBSUB_H__ #define PUBSUB_H__ @@ -247,3 +250,5 @@ } #endif // PUBSUB_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/pubsubevent.h =================================================================== --- libraries/win32/gloox/include/gloox/pubsubevent.h +++ libraries/win32/gloox/include/gloox/pubsubevent.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PUBSUB ) + #ifndef PUBSUBEVENT_H__ #define PUBSUBEVENT_H__ @@ -69,17 +72,10 @@ typedef std::list ItemOperationList; /** - * PubSub event notification Stanza Extension. This constructor can - * be used to create an empty instance for registering the - * StanzaExtension. - */ - Event(); - - /** * PubSub event notification Stanza Extension. * @param event A tag to parse. */ - Event( const Tag* event ); + Event( const Tag* event = 0 ); /** * PubSub event notification Stanza Extension. @@ -178,3 +174,5 @@ } #endif // PUBSUBEVENT_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/pubsubitem.h =================================================================== --- libraries/win32/gloox/include/gloox/pubsubitem.h +++ libraries/win32/gloox/include/gloox/pubsubitem.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PUBSUB ) + #ifndef PUBSUBITEM_H__ #define PUBSUBITEM_H__ @@ -100,3 +102,5 @@ } #endif // PUBSUBITEM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/pubsubmanager.h =================================================================== --- libraries/win32/gloox/include/gloox/pubsubmanager.h +++ libraries/win32/gloox/include/gloox/pubsubmanager.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PUBSUB ) + #ifndef PUBSUBMANAGER_H__ #define PUBSUBMANAGER_H__ @@ -71,7 +74,7 @@ * XEP Version: 1.12 * * @author Jakob Schröter - * @author Vincent Thomasset + * @author Vincent Thomasset * * @since 1.0 */ @@ -866,3 +869,5 @@ } #endif // PUBSUBMANAGER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/pubsubresulthandler.h =================================================================== --- libraries/win32/gloox/include/gloox/pubsubresulthandler.h +++ libraries/win32/gloox/include/gloox/pubsubresulthandler.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PUBSUB ) + #ifndef PUBSUBRESULTHANDLER_H__ #define PUBSUBRESULTHANDLER_H__ @@ -393,3 +396,4 @@ #endif // PUBSUBRESULTHANDLER_H__ +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/receipt.h =================================================================== --- libraries/win32/gloox/include/gloox/receipt.h +++ libraries/win32/gloox/include/gloox/receipt.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_RECEIPT ) + #ifndef RECEIPT_H__ #define RECEIPT_H__ @@ -46,7 +49,7 @@ * Constructs a new object from the given Tag. * @param tag A Tag to parse. */ - Receipt( const Tag* tag ); + Receipt( const Tag* tag = 0 ); /** * Constructs a new object of the given type. @@ -101,3 +104,5 @@ } #endif // RECEIPT_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/reference.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/reference.h @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2018-2019 by Jakob Schröter + * 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. + */ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_REFERENCES ) + +#ifndef REFERENCE_H__ +#define REFERENCE_H__ + +#include "gloox.h" +#include "stanzaextension.h" + +#include +#include + +namespace gloox +{ + /** + * This is an abstraction of References (@xep{0372}). + * + * XEP Version: 0.2 + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API Reference : public StanzaExtension + { + public: + + /** + * The supported Message Markup types according to @xep{0394}. + */ + enum ReferenceType + { + Mention, /**< Mentions are a reference to a user's bare JID. */ + Data, /**< Data references are a generic reference without additional information. */ + InvalidType /**< Invalid/unknown type. Ignored. */ + }; + + /** + * Constructs a new object from the given Tag. + * @param tag A Tag to parse. + */ + Reference( const Tag* tag ); + + /** + * Constructs a new Reference object with the given markups. + * @param type The reference type. + * @param uri The referencing URI. + */ + Reference( ReferenceType type, const std::string& uri ) + : StanzaExtension( ExtReference ), m_type( type ), m_uri( uri ) + {} + + /** + * Virtual destructor. + */ + virtual ~Reference() {} + + /** + * Sets the start position of the @c mention. See @xep{0372}. + * @param begin The start position of the @c mention. + */ + void setBegin( const int begin ) { m_begin = begin; } + + /** + * Returns the start position of the mention. + * @return The start position of the mention. + */ + int begin() const { return m_begin; } + + /** + * Sets the end position of the @c mention. See @xep{0372}. + * @param end The end position of the @c mention. + */ + void setEnd( const int end ) { m_end = end; } + + /** + * Returns the end position of the mention. See @xep{0372}. + * @return The end position of the mention. + */ + int end() const { return m_end; } + + /** + * An anchor, i.e. an uri to a previous message. See @xep{0372}. + * @param anchor The anchor. + */ + void setAnchor( const std::string& anchor ) { m_anchor = anchor; } + + /** + * Returns the anchor. See @xep{0372}. + * @return The anchor. + */ + const std::string& anchor() const { return m_anchor; } + + /** + * Returns the URI. See @xep{0372}. + * @return The URI. + */ + const std::string& uri() const { return m_uri; } + + /** + * Returns the reference type. See @xep{0372}. + * @return The reference type. + */ + ReferenceType type() const { return m_type; } + + // reimplemented from StanzaExtension + virtual const std::string& filterString() const; + + // reimplemented from StanzaExtension + virtual StanzaExtension* newInstance( const Tag* tag ) const + { + return new Reference( tag ); + } + + // reimplemented from StanzaExtension + Tag* tag() const; + + // reimplemented from StanzaExtension + virtual Reference* clone() const + { + return new Reference( *this ); + } + + private: + ReferenceType m_type; + std::string m_uri; + std::string m_anchor; + int m_begin; + int m_end; + + }; + +} + +#endif // REFERENCE_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/registration.h =================================================================== --- libraries/win32/gloox/include/gloox/registration.h +++ libraries/win32/gloox/include/gloox/registration.h @@ -11,12 +11,13 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_REGISTRATION ) + #ifndef REGISTRATION_H__ #define REGISTRATION_H__ #include "iqhandler.h" #include "registrationhandler.h" -#include "dataform.h" #include "jid.h" #include "oob.h" @@ -27,6 +28,7 @@ { class ClientBase; + class DataForm; class Stanza; /** @@ -49,8 +51,6 @@ std::string phone; /**< User's phone number. */ std::string url; /**< User's homepage URL (or other URL). */ std::string date; /**< Date (?) */ - std::string misc; /**< Misc (?) */ - std::string text; /**< Text (?)*/ }; /** @@ -86,6 +86,8 @@ * * Check @c tests/register_test.cpp for an example. * + * XEP Version: 2.4 + * * @author Jakob Schröter * @since 0.2 */ @@ -111,9 +113,7 @@ FieldZip = 1024, /**< ZIP requested */ FieldPhone = 2048, /**< Phone no. requested */ FieldUrl = 4096, /**< Homepage or other URL requested */ - FieldDate = 8192, /**< Date requested (unknown purpose; see @xep{0077}) */ - FieldMisc = 16384, /**< Misc data requested (unknown purpose; see @xep{0077}) */ - FieldText = 32768 /**< Extra text requested (unknown purpose; see @xep{0077}) */ + FieldDate = 8192 /**< Date requested (unknown purpose; see @xep{0077}) */ }; /** @@ -210,18 +210,7 @@ virtual Tag* tag() const; // reimplemented from StanzaExtension - virtual StanzaExtension* clone() const - { - Query* q = new Query(); - q->m_form = m_form ? new DataForm( *m_form ) : 0; - q->m_fields = m_fields; - q->m_values = m_values; - q->m_instructions = m_instructions; - q->m_oob = new OOB( *m_oob ); - q->m_del = m_del; - q->m_reg = m_reg; - return q; - } + virtual StanzaExtension* clone() const; private: DataForm* m_form; @@ -337,3 +326,5 @@ } #endif // REGISTRATION_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/registrationhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/registrationhandler.h +++ libraries/win32/gloox/include/gloox/registrationhandler.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_REGISTRATION ) #ifndef REGISTRATIONHANDLER_H__ #define REGISTRATIONHANDLER_H__ @@ -25,6 +26,7 @@ class OOB; class JID; class DataForm; + class Error; /** * Possible results of a @xep{0077} operation. @@ -105,8 +107,9 @@ * This funtion is called to notify about the result of an operation. * @param from The server or service the result came from. * @param regResult The result of the last operation. + * @param error If registration failed, this is the Error object sent by the server (if any), 0 otherwise. @since 1.1 */ - virtual void handleRegistrationResult( const JID& from, RegistrationResult regResult ) = 0; + virtual void handleRegistrationResult( const JID& from, RegistrationResult regResult, const Error* error ) = 0; /** * This function is called additionally to @ref handleRegistrationFields() if the server @@ -129,3 +132,5 @@ } #endif // REGISTRATIONHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/rosteritem.h =================================================================== --- libraries/win32/gloox/include/gloox/rosteritem.h +++ libraries/win32/gloox/include/gloox/rosteritem.h @@ -86,16 +86,8 @@ /** * Returns the contact's bare JID. * @return The contact's bare JID. - * @deprecated Use jidJID() for now. In 1.1, jidJID() will be renamed back to jid(). */ - GLOOX_DEPRECATED const std::string& jid() const; - - /** - * Returns the contact's bare JID. - * @return The contact's bare JID. - * @todo Rename to jid() for 1.1. - */ - const JID& jidJID() const; + const JID& jid() const; /** * Sets the current subscription status of the contact. Index: libraries/win32/gloox/include/gloox/rosteritembase.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/rosteritembase.h @@ -0,0 +1,146 @@ +/* + Copyright (c) 2015-2019 by Jakob Schröter + 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 ROSTERITEMBASE_H__ +#define ROSTERITEMBASE_H__ + +#include "gloox.h" +#include "jid.h" +#include "tag.h" + +#include +#include + + +namespace gloox +{ + + /** + * @brief A base class holding some roster item data. + * + * You should not need to use this class directly. + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API RosterItemBase + { + + public: + /** + * Constructs a new item of the roster. + * @param jid The JID of the contact. + * @param name The displayed name of the contact. + * @param groups A list of groups the contact belongs to. + */ + RosterItemBase( const JID& jid, const std::string& name, + const StringList& groups ) + : m_jid( jid ), m_name( name ), m_groups( groups ), m_changed( false ) + {} + + /** + * Constructs a new item from the given Tag. + * @param tag The Tag to parse. + */ + RosterItemBase( const Tag* tag ) + { + if( !tag || tag->name() != "item" ) + return; + + m_jid.setJID( tag->findAttribute( "jid" ) ); + m_name = tag->findAttribute( "name" ); + const ConstTagList& g = tag->findTagList( "item/group" ); + ConstTagList::const_iterator it = g.begin(); + for( ; it != g.end(); ++it ) + m_groups.push_back( (*it)->cdata() ); + } + + /** + * Copy constructor. + * @param right The RosterItemBase to copy. + */ + RosterItemBase( const RosterItemBase& right ) + : m_jid( right.m_jid ), m_name( right.m_name ), + m_groups( right.m_groups ), m_changed( right.m_changed ) + {} + + /** + * Virtual destructor. + */ + virtual ~RosterItemBase() {} + + /** + * Returns the contact's bare JID. + * @return The contact's bare JID. + */ + const JID& jid() const { return m_jid; } + + /** + * Sets the displayed name of a contact/roster item. + * @param name The contact's new name. + */ + void setName( const std::string& name ) + { + m_name = name; + m_changed = true; + } + + /** + * Retrieves the displayed name of a contact/roster item. + * @return The contact's name. + */ + const std::string& name() const { return m_name; } + + /** + * Sets the groups this RosterItem belongs to. + * @param groups The groups to set for this item. + */ + void setGroups( const StringList& groups ) + { + m_groups = groups; + m_changed = true; + } + + /** + * Returns the groups this RosterItem belongs to. + * @return The groups this item belongs to. + */ + const StringList& groups() const { return m_groups; } + + /** + * Retruns a Tag representation of the roster item data. + * @return A Tag representation. + */ + virtual Tag* tag() const + { + Tag* i = new Tag( "item" ); + i->addAttribute( "jid", m_jid.full() ); + i->addAttribute( "name", m_name ); + StringList::const_iterator it = m_groups.begin(); + for( ; it != m_groups.end(); ++it ) + new Tag( i, "group", (*it) ); + + return i; + } + + protected: + JID m_jid; + std::string m_name; + StringList m_groups; + bool m_changed; + + }; + +} + +#endif // ROSTERITEMBASE_H__ Index: libraries/win32/gloox/include/gloox/rosteritemdata.h =================================================================== --- libraries/win32/gloox/include/gloox/rosteritemdata.h +++ libraries/win32/gloox/include/gloox/rosteritemdata.h @@ -11,9 +11,11 @@ */ -#ifndef ROSTERITEMBASE_H__ -#define ROSTERITEMBASE_H__ +#ifndef ROSTERITEMDATA_H__ +#define ROSTERITEMDATA_H__ +#include "rosterxitemdata.h" +#include "rosteritembase.h" #include "gloox.h" #include "jid.h" #include "tag.h" @@ -26,14 +28,14 @@ { /** - * @brief A class holding roster item data. + * @brief A class holding (some more) roster item data. * * You should not need to use this class directly. * * @author Jakob Schröter * @since 1.0 */ - class GLOOX_API RosterItemData + class GLOOX_API RosterItemData : public RosterItemBase { public: @@ -45,8 +47,8 @@ */ RosterItemData( const JID& jid, const std::string& name, const StringList& groups ) - : m_jid( jid.full() ), m_jidJID( jid ), m_name( name ), m_groups( groups ), - m_subscription( S10nNone ), m_changed( false ), m_remove( false ) + : RosterItemBase( jid, name, groups ), + m_subscription( S10nNone ), m_remove( false ) {} /** @@ -54,8 +56,8 @@ * @param jid The JID of the contact to remove. */ RosterItemData( const JID& jid ) - : m_jid( jid.full() ), m_jidJID( jid ), m_subscription( S10nNone ), m_changed( false ), - m_remove( true ) + : RosterItemBase( jid, EmptyString, StringList() ), + m_subscription( S10nNone ), m_remove( true ) {} /** @@ -63,32 +65,8 @@ * @param right The RosterItemData to copy. */ RosterItemData( const RosterItemData& right ) - : m_jid( right.m_jid ), m_jidJID( right.m_jidJID ), m_name( right.m_name ), - m_groups( right.m_groups ), m_subscription( right.m_subscription ), - m_changed( right.m_changed ), m_remove( right.m_remove ) - {} - - /** - * Constructs a new item of the roster. - * @param jid The JID of the contact. - * @param name The displayed name of the contact. - * @param groups A list of groups the contact belongs to. - * @deprecated Will be removed for 1.1. - */ - GLOOX_DEPRECATED_CTOR RosterItemData( const std::string& jid, const std::string& name, - const StringList& groups ) - : m_jid( jid ), m_jidJID( jid), m_name( name ), m_groups( groups ), - m_subscription( S10nNone ), m_changed( false ), m_remove( false ) - {} - - /** - * Constructs a new item of the roster, scheduled for removal. - * @param jid The JID of the contact to remove. - * @deprecated Will be removed for 1.1. - */ - GLOOX_DEPRECATED_CTOR RosterItemData( const std::string& jid ) - : m_jid( jid ), m_jidJID( jid), m_subscription( S10nNone ), m_changed( false ), - m_remove( true ) + : RosterItemBase( right ), + m_subscription( right.m_subscription ), m_remove( right.m_remove ) {} /** @@ -97,36 +75,6 @@ virtual ~RosterItemData() {} /** - * Returns the contact's bare JID. - * @return The contact's bare JID. - * @deprecated Will be removed for 1.1. - */ - GLOOX_DEPRECATED const std::string& jid() const { return m_jid; } - - /** - * Returns the contact's bare JID. - * @return The contact's bare JID. - * @todo Rename to jid() for 1.1. - */ - const JID& jidJID() const { return m_jidJID; } - - /** - * Sets the displayed name of a contact/roster item. - * @param name The contact's new name. - */ - void setName( const std::string& name ) - { - m_name = name; - m_changed = true; - } - - /** - * Retrieves the displayed name of a contact/roster item. - * @return The contact's name. - */ - const std::string& name() const { return m_name; } - - /** * Sets the current subscription status of the contact. * @param subscription The current subscription. * @param ask Whether a subscription request is pending. @@ -159,22 +107,6 @@ SubscriptionType subscription() const { return m_subscription; } /** - * Sets the groups this RosterItem belongs to. - * @param groups The groups to set for this item. - */ - void setGroups( const StringList& groups ) - { - m_groups = groups; - m_changed = true; - } - - /** - * Returns the groups this RosterItem belongs to. - * @return The groups this item belongs to. - */ - const StringList& groups() const { return m_groups; } - - /** * Whether the item has unsynchronized changes. * @return @b True if the item has unsynchronized changes, @b false otherwise. */ @@ -196,18 +128,13 @@ * Retruns a Tag representation of the roster item data. * @return A Tag representation. */ - Tag* tag() const + virtual Tag* tag() const { - Tag* i = new Tag( "item" ); - i->addAttribute( "jid", m_jidJID.full() ); + Tag* i = RosterItemBase::tag(); if( m_remove ) i->addAttribute( "subscription", "remove" ); else { - i->addAttribute( "name", m_name ); - StringList::const_iterator it = m_groups.begin(); - for( ; it != m_groups.end(); ++it ) - new Tag( i, "group", (*it) ); i->addAttribute( "subscription", m_sub ); i->addAttribute( "ask", m_ask ); } @@ -215,18 +142,13 @@ } protected: - GLOOX_DEPRECATED std::string m_jid; /**< @deprecated Will be removed for 1.1. */ - JID m_jidJID; /**< @todo Rename to m_jid for 1.1. */ - std::string m_name; - StringList m_groups; SubscriptionType m_subscription; std::string m_sub; std::string m_ask; - bool m_changed; bool m_remove; }; } -#endif // ROSTERITEMBASE_H__ +#endif // ROSTERITEMDATA_H__ Index: libraries/win32/gloox/include/gloox/rosterlistener.h =================================================================== --- libraries/win32/gloox/include/gloox/rosterlistener.h +++ libraries/win32/gloox/include/gloox/rosterlistener.h @@ -15,6 +15,7 @@ #define ROSTERLISTENER_H__ #include "rosteritem.h" +#include "rosterx.h" #include #include @@ -166,6 +167,18 @@ * @param iq The error stanza. */ virtual void handleRosterError( const IQ& iq ) = 0; + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ROSTER_ITEM_EXCHANGE ) + /** + * This function is called for incoming Roster Item Exchange (@xep{0144}) suggestions. See RosterX. + * @param from The entity suggesting the Roster Item exchange. + * @param items The suggested item(s). Check the items' action() function to find out whether + * this is a suggested addition/deletion/modification. + * @since 1.1 + */ + virtual void handleRosterItemExchange( const JID& from, const RosterX* items ) = 0; +#endif // GLOOX_MINIMAL + }; } Index: libraries/win32/gloox/include/gloox/rostermanager.h =================================================================== --- libraries/win32/gloox/include/gloox/rostermanager.h +++ libraries/win32/gloox/include/gloox/rostermanager.h @@ -19,6 +19,8 @@ #include "iqhandler.h" #include "presencehandler.h" #include "rosterlistener.h" +#include "messagehandler.h" +#include "message.h" #include #include @@ -29,7 +31,13 @@ class ClientBase; class Stanza; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVATEXML ) class PrivateXML; +#endif // GLOOX_MINIMAL +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ROSTER_ITEM_EXCHANGE ) + class Message; + class MessageSession; +#endif // GLOOX_MINIMAL class RosterItem; /** @@ -44,8 +52,14 @@ * @author Jakob Schröter * @since 0.3 */ - class GLOOX_API RosterManager : public IqHandler, public PresenceHandler, public SubscriptionHandler, - public PrivateXMLHandler + class GLOOX_API RosterManager : public IqHandler, public PresenceHandler, +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVATEXML ) + public PrivateXMLHandler, +#endif // GLOOX_MINIMAL +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ROSTER_ITEM_EXCHANGE ) + public MessageHandler, +#endif + public SubscriptionHandler { public: /** @@ -133,6 +147,7 @@ */ void ackSubscriptionRequest( const JID& to, bool ack ); +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVATEXML ) /** * Use this function to retrieve the delimiter of Nested Roster Groups (@xep{0083}). * @return The group delimiter. @@ -146,6 +161,7 @@ * @since 0.7 */ void setDelimiter( const std::string& delimiter ); +#endif // GLOOX_MINIMAL /** * Lets you retrieve the RosterItem that belongs to the given JID. @@ -182,11 +198,18 @@ // reimplemented from SubscriptionHandler. virtual void handleSubscription( const Subscription& subscription ); +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVATEXML ) // reimplemented from PrivateXMLHandler virtual void handlePrivateXML( const Tag* xml ); // reimplemented from PrivateXMLHandler virtual void handlePrivateXMLResult( const std::string& uid, PrivateXMLResult pxResult ); +#endif // GLOOX_MINIMAL + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ROSTER_ITEM_EXCHANGE ) + // reimplemented from MessageHandler + virtual void handleMessage( const Message& msg, MessageSession* session = 0 ); +#endif private: #ifdef ROSTERMANAGER_TEST @@ -262,7 +285,9 @@ RosterListener* m_rosterListener; Roster m_roster; ClientBase* m_parent; +#if !defined( GLOOX_MINIMAL ) || defined( WANT_PRIVATEXML ) PrivateXML* m_privateXML; +#endif // GLOOX_MINIMAL RosterItem* m_self; std::string m_delimiter; Index: libraries/win32/gloox/include/gloox/rosterx.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/rosterx.h @@ -0,0 +1,104 @@ +/* + Copyright (c) 2015-2019 by Jakob Schröter + 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. +*/ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ROSTER_ITEM_EXCHANGE ) + +#ifndef ROSTERX_H__ +#define ROSTERX_H__ + +#include "gloox.h" +#include "stanzaextension.h" +#include "rosterxitemdata.h" + +#include +#include + +namespace gloox +{ + + class Tag; + + /** + * A list of Roster Item Exchange items. + */ + typedef std::list RosterXItemList; + + /** + * @brief A Roster Item Exchange (@xep{0144}) abstraction implemented as a StanzaExtension. + * + * @xep{0144} defines a protocol for exchanging roster items between entities. To receive + * items proposed for addition, deletion, or modification by another entity, @link + * RosterListener::handleRosterItemExchange() RosterListener's handleRosterItemExchange() @endlink + * has to be implemented. Incoming items should then be treated according to the rules established + * in @xep{0144}. + * + * To send roster items to another entity, an instance of this RosterX class should be created and + * items added using setItems(), again following the rules established in @xep{0144}. + * This RosterX should then be added to an IQ or Message stanza (see @xep{0144}) and sent off. + * + * XEP Version: 1.1.1 + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API RosterX : public StanzaExtension + { + public: + /** + * Constructs a new object from the given Tag. + * @param tag The Tag to parse. + */ + RosterX( const Tag* tag = 0 ); + + /** + * Virtual destructor. + */ + virtual ~RosterX(); + + /** + * Returns the list of exchanged items. + * @return The list of exchanged items. + */ + const RosterXItemList& items() const { return m_list; } + + /** + * Sets a list of roster items. The objects pointed to by the list are owned by RosterX + * and will be deleted upon destruction or on any future call of setItems(). + * @param items The list of roster items to set. + */ + void setItems( const RosterXItemList& items ); + + // reimplemented from StanzaExtension + virtual const std::string& filterString() const; + + // reimplemented from StanzaExtension + virtual StanzaExtension* newInstance( const Tag* tag ) const + { + return new RosterX( tag ); + } + + // reimplemented from StanzaExtension + virtual Tag* tag() const; + + // reimplemented from StanzaExtension + virtual StanzaExtension* clone() const; + + private: + RosterXItemList m_list; + + }; + +} + +#endif // ROSTERX_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/rosterxitemdata.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/rosterxitemdata.h @@ -0,0 +1,90 @@ +/* + Copyright (c) 2004-2019 by Jakob Schröter + 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. +*/ + + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_ROSTER_ITEM_EXCHANGE ) + +#ifndef ROSTERXITEMDATA_H__ +#define ROSTERXITEMDATA_H__ + +#include "gloox.h" +#include "rosteritembase.h" + +#include + +namespace gloox +{ + + class JID; + class Tag; + class RosterItemBase; + + /** + * @brief An bastraction of a @xep{0144} (Roster Item Exchange) roster item. + * + * @author Jakob Schröter + * @since 1.1 + */ + class GLOOX_API RosterXItemData : public RosterItemBase + { + public: + /** + * A list of supported actions. + */ + enum XActions + { + XAdd, /**< Addition suggested. */ + XDelete, /**< Deletion suggested. */ + XModify, /**< Modification suggested. */ + XInvalid /**< Invalid action. */ + }; + + /** + * Creates a new item with the given data. + * @param action The suggested action. + * @param jid The contact's JID. + * @param name The contact's name. + * @param group A list of groups the contact belongs to. + */ + RosterXItemData( XActions action, const JID& jid, const std::string& name, + const StringList& groups ); + + /** + * Creates a new item from the given Tag. + * @param tag The Tag to parse. + */ + RosterXItemData( const Tag* tag ); + + /** + * Virtual destructor. + */ + virtual ~RosterXItemData() {} + + /** + * Returns the suggested action. + * @return The suggested action. + */ + XActions action() const { return m_action; } + + // reimplemented from RosterItemBase + virtual Tag* tag() const; + + private: + XActions m_action; + + }; + +} + +#endif // ROSTERXITEMDATA_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/search.h =================================================================== --- libraries/win32/gloox/include/gloox/search.h +++ libraries/win32/gloox/include/gloox/search.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_SEARCH ) #ifndef SEARCH_H__ #define SEARCH_H__ @@ -213,3 +214,5 @@ } #endif // SEARCH_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/searchhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/searchhandler.h +++ libraries/win32/gloox/include/gloox/searchhandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_SEARCH ) + #ifndef SEARCHHANDLER_H__ #define SEARCHHANDLER_H__ @@ -193,3 +195,5 @@ } #endif // SEARCHHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/sha.h =================================================================== --- libraries/win32/gloox/include/gloox/sha.h +++ libraries/win32/gloox/include/gloox/sha.h @@ -77,6 +77,14 @@ */ void feed( const std::string& data ); + /** + * Static function to quickly get an SHA1 hash in hex. + * @param data The data to hash. + * @return The hash in hex. + * @since 1.1 + */ + static const std::string hex( const std::string& data ); + private: void process(); void pad(); Index: libraries/win32/gloox/include/gloox/shim.h =================================================================== --- libraries/win32/gloox/include/gloox/shim.h +++ libraries/win32/gloox/include/gloox/shim.h @@ -10,6 +10,9 @@ This software is distributed without any warranty. */ + +#if !defined( GLOOX_MINIMAL ) || defined( WANT_SHIM ) + #ifndef SHIM_H__ #define SHIM_H__ @@ -89,3 +92,5 @@ } #endif // SHIM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/sihandler.h =================================================================== --- libraries/win32/gloox/include/gloox/sihandler.h +++ libraries/win32/gloox/include/gloox/sihandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_SI ) + #ifndef SIHANDLER_H__ #define SIHANDLER_H__ @@ -68,3 +70,5 @@ } #endif // SIHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/simanager.h =================================================================== --- libraries/win32/gloox/include/gloox/simanager.h +++ libraries/win32/gloox/include/gloox/simanager.h @@ -11,10 +11,13 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_SI ) + #ifndef SIMANAGER_H__ #define SIMANAGER_H__ #include "iqhandler.h" +#include "mutex.h" namespace gloox { @@ -230,6 +233,7 @@ }; typedef std::map TrackMap; TrackMap m_track; + util::Mutex m_trackMutex; ClientBase* m_parent; @@ -243,3 +247,5 @@ } #endif // SIMANAGER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/siprofileft.h =================================================================== --- libraries/win32/gloox/include/gloox/siprofileft.h +++ libraries/win32/gloox/include/gloox/siprofileft.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_SI ) + #ifndef SIPROFILEFT_H__ #define SIPROFILEFT_H__ @@ -331,6 +333,7 @@ SOCKS5BytestreamManager* m_socks5Manager; StreamHostList m_hosts; StringMap m_id2sid; + util::Mutex m_id2sidMutex; bool m_delManager; bool m_delS5Manager; @@ -339,3 +342,5 @@ } #endif // SIPROFILEFT_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/siprofilefthandler.h =================================================================== --- libraries/win32/gloox/include/gloox/siprofilefthandler.h +++ libraries/win32/gloox/include/gloox/siprofilefthandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_SI ) + #ifndef SIPROFILEFTHANDLER_H__ #define SIPROFILEFTHANDLER_H__ @@ -102,3 +104,5 @@ } #endif // SIPROFILEFTHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/siprofilehandler.h =================================================================== --- libraries/win32/gloox/include/gloox/siprofilehandler.h +++ libraries/win32/gloox/include/gloox/siprofilehandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_SI ) + #ifndef SIPROFILEHANDLER_H__ #define SIPROFILEHANDLER_H__ @@ -60,3 +62,5 @@ } #endif // SIPROFILEHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/socks5bytestream.h =================================================================== --- libraries/win32/gloox/include/gloox/socks5bytestream.h +++ libraries/win32/gloox/include/gloox/socks5bytestream.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BYTESTREAM ) + #ifndef SOCKS5BYTESTREAM_H__ #define SOCKS5BYTESTREAM_H__ @@ -53,6 +55,7 @@ * This function starts the connection process. That is, it attempts to connect * to each of the available StreamHosts. Once a working StreamHosts is found, the * SOCKS5BytestreamManager is notified and the function returns. + * @param timeout The timeout to use for select() in milliseconds. Default of -1 means blocking. * @return @b True if a connection to a StreamHost could be established, @b false * otherwise. * @note If @b false is returned you should hand this SOCKS5Bytestream object @@ -60,7 +63,7 @@ * @note Make sure you have a SOCKS5BytestreamDataHandler registered (using * registerSOCKS5BytestreamDataHandler()) before calling this function. */ - virtual bool connect(); + virtual bool connect( int timeout = -1 ); /** * Closes the bytestream. @@ -106,6 +109,25 @@ */ void setStreamHosts( const StreamHostList& hosts ) { m_hosts = hosts; } + /** + * Returns the current list of stream hosts. + * @return The current list of stream hosts. + */ + StreamHostList hosts() const; + + /** + * Returns whether this instance is the stream's initiator. + * @return @True if this instance is the stream's initiator, @b false otherwise. + */ + bool isInitiator() const; + + /** + * Use this function to indicate that this instance is the stream's initiator. + * @param isInitiator Set to @b true if this instance is the stream's + * initiator, set to @b false otherwise. + */ + void setIsInitiator( bool isInitiator ); + // reimplemented from ConnectionDataHandler virtual void handleReceivedData( const ConnectionBase* connection, const std::string& data ); @@ -126,6 +148,7 @@ ConnectionBase* m_socks5; JID m_proxy; bool m_connected; + bool m_isInitiator; StreamHostList m_hosts; @@ -134,3 +157,5 @@ } #endif // SOCKS5BYTESTREAM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/socks5bytestreammanager.h =================================================================== --- libraries/win32/gloox/include/gloox/socks5bytestreammanager.h +++ libraries/win32/gloox/include/gloox/socks5bytestreammanager.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BYTESTREAM ) + #ifndef SOCKS5BYTESTREAMMANAGER_H__ #define SOCKS5BYTESTREAMMANAGER_H__ @@ -305,3 +307,5 @@ } #endif // SOCKS5BYTESTREAMMANAGER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/socks5bytestreamserver.h =================================================================== --- libraries/win32/gloox/include/gloox/socks5bytestreamserver.h +++ libraries/win32/gloox/include/gloox/socks5bytestreamserver.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BYTESTREAM ) + #ifndef SOCKS5BYTESTREAMSERVER_H__ #define SOCKS5BYTESTREAMSERVER_H__ @@ -147,3 +149,5 @@ } #endif // SOCKS5BYTESTREAMSERVER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/softwareversion.h =================================================================== --- libraries/win32/gloox/include/gloox/softwareversion.h +++ libraries/win32/gloox/include/gloox/softwareversion.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_SOFTWAREVERSION ) #ifndef SOFTWAREVERSION_H__ #define SOFTWAREVERSION_H__ @@ -99,3 +100,5 @@ } #endif// SOFTWAREVERSION_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/stanzaextension.h =================================================================== --- libraries/win32/gloox/include/gloox/stanzaextension.h +++ libraries/win32/gloox/include/gloox/stanzaextension.h @@ -89,8 +89,15 @@ ExtAttention, /**< An extension dealing with Attention (@xep{0224}). */ ExtForward, /**< An extension dealing with Stanza Forwarding (@xep{0297}). */ ExtCarbons, /**< An extension dealing with Message Carbons (@xep{0280}). */ - ExtIOData, /**< An extension dealing with IO Data (@xep{0244}) (though the IOData extension - * is not actually used as/meant to be a StanzaExtension. */ + ExtIOData, /**< An extension dealing with IO Data (@xep{0244}) (though the IOData + * extension is not actually used as/meant to be a StanzaExtension. */ + ExtRosterX, /**< An extension dealing with Roster Item Exchange (@yep{0144}). */ + ExtChatMarkers, /**< The Chat Markers extension (@xep{0333}). */ + ExtMessageMarkup, /**< The Message Markup extension (@xep{0394}). */ + ExtReference, /**< The References extension (@xep{0372}). */ + ExtHint, /**< The Message Processing Hints extension (@xep{0334}). */ + ExtSXE, /**< An extension dealing with Shared XML Editing (@xep{0284}). */ + ExtBOB, /**< An extension dealing with Bits of Binary (BOB) (@xep{0231}). */ ExtUser /**< User-supplied extensions must use IDs above this. Do * not hard-code ExtUser's value anywhere, it is subject * to change. */ Index: libraries/win32/gloox/include/gloox/sxe.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/sxe.h @@ -0,0 +1,159 @@ +/* + Copyright (c) 2019 by Jakob Schröter + 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 SXE_H__ +#define SXE_H__ + +#include "stanzaextension.h" + +#include +#include +#include + +namespace gloox +{ + + enum SxeType + { + SxeInvalid, + SxeConnect, + SxeStateOffer, + SxeAcceptState, + SxeRefuseState, + SxeState + }; + + enum StateChangeType + { + StateChangeDocumentBegin, + StateChangeDocumentEnd, + StateChangeNew, + StateChangeRemove, + StateChangeSet + }; + + struct DocumentBegin + { + const char* prolog; + }; + + struct DocumentEnd + { + const char* last_sender; + const char* last_id; + }; + + struct New + { + const char* rid; + const char* type; + const char* name; + const char* ns; + const char* parent; + const char* chdata; + }; + + struct Remove + { + const char* target; + }; + + struct Set + { + const char* target; + const char* version; + const char* parent; + const char* name; + const char* ns; + const char* chdata; + }; + + struct StateChange + { + StateChangeType type; + union + { + DocumentBegin document_begin; + DocumentEnd document_end; + New new_; + Remove remove; + Set set; + }; + }; + + /** + * @brief An implementation/abstraction of Shared XML Editing (SXE, @xep{0284}) + * + * XEP Version: 0.1.1 + * + * @author Emmanuel Gil Peyrot + * @since 1.0.23 + */ + class GLOOX_API Sxe : public StanzaExtension + { + private: + Sxe( std::string session, std::string id, SxeType type, std::vector state_offer_xmlns, std::vector state_changes ); + + public: + /** + * Creates a new SXE object from the given Tag. + * @param tag The Tag to parse. + */ + Sxe( const Tag* tag = 0 ); + + /** + * Virtual destructor. + */ + virtual ~Sxe() {} + + /** + * Returns a Tag representing a SXE extension. + * @return A Tag representing a SXE extension. + */ + virtual Tag* tag() const; + + /** + * Returns a new instance of SXE. + * @return The new SXE instance. + */ + virtual StanzaExtension* newInstance( const Tag* tag ) const + { + return new Sxe( tag ); + } + + /** + * Returns an identical copy of the current SXE. + * @return an identical copy of the current SXE. + */ + virtual StanzaExtension* clone() const + { + return new Sxe( *this ); + } + + /** + * Returns an XPath expression that describes a path to the SXE element. + * @return The SXE filter string. + */ + virtual const std::string& filterString() const; + + private: + std::string m_session; + std::string m_id; + SxeType m_type; + std::vector m_state_offer_xmlns; + std::vector m_state_changes; + + }; + +} + +#endif // SXE_H__ Index: libraries/win32/gloox/include/gloox/tlsbase.h =================================================================== --- libraries/win32/gloox/include/gloox/tlsbase.h +++ libraries/win32/gloox/include/gloox/tlsbase.h @@ -37,7 +37,7 @@ * @param server The server to use in certificate verification. */ TLSBase( TLSHandler* th, const std::string server ) - : m_handler( th ), m_server( server ), m_secure( false ), m_valid( false ), m_initLib( true ) + : m_handler( th ), m_server( server ), m_tlsVersion( TLSv1 ), m_secure( false ), m_valid( false ), m_initLib( true ) {} /** @@ -68,6 +68,13 @@ void setInitLib( bool init ) { m_initLib = init; } /** + * This function is used to set the minimum required/requested TLS version. Default is to use + * at least TLS v1. This should be called before init() is called. + * @param tlsVersion The TLS version. + */ + void setTLSVersion( TLSVersion tlsVersion ) { m_tlsVersion = tlsVersion; } + + /** * Use this function to feed unencrypted data to the encryption implementation. * The encrypted result will be pushed to the TLSHandler's handleEncryptedData() function. * @param data The data to encrypt. @@ -105,7 +112,8 @@ virtual bool isSecure() const { return m_secure; } /** - * This function indicates whether the underlying TLS implementation supports channel binding (used in e.g. SASL SCRAM-SHA-1-PLUS). + * This function indicates whether the underlying TLS implementation supports channel binding + * (used in e.g. SASL SCRAM-SHA-1-PLUS). * @return @b True if channel binding is supported, @b false otherwise. */ virtual bool hasChannelBinding() const { return false; } @@ -150,6 +158,9 @@ std::string m_server; CertInfo m_certInfo; util::Mutex m_mutex; + util::Mutex m_mutexCryptOp; + util::Mutex m_mutexDeCryptOp; + TLSVersion m_tlsVersion; bool m_secure; bool m_valid; bool m_initLib; Index: libraries/win32/gloox/include/gloox/tlsgnutlsclient.h =================================================================== --- libraries/win32/gloox/include/gloox/tlsgnutlsclient.h +++ libraries/win32/gloox/include/gloox/tlsgnutlsclient.h @@ -28,7 +28,7 @@ { /** - * @brief This class implements a TLS backend using GnuTLS. + * @brief This class implements a TLS client backend using GnuTLS. * * You should not need to use this class directly. * @@ -62,6 +62,9 @@ virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts ); // reimplemented from TLSBase + virtual void setTLSVersion( TLSVersion tlsVersion ); + + // reimplemented from TLSBase virtual void cleanup(); private: Index: libraries/win32/gloox/include/gloox/tlsgnutlsclientanon.h =================================================================== --- libraries/win32/gloox/include/gloox/tlsgnutlsclientanon.h +++ libraries/win32/gloox/include/gloox/tlsgnutlsclientanon.h @@ -55,6 +55,9 @@ const StringList& cacerts = StringList() ); // reimplemented from TLSBase + virtual void setTLSVersion( TLSVersion tlsVersion ); + + // reimplemented from TLSBase virtual void cleanup(); private: Index: libraries/win32/gloox/include/gloox/tlsgnutlsserver.h =================================================================== --- /dev/null +++ libraries/win32/gloox/include/gloox/tlsgnutlsserver.h @@ -0,0 +1,83 @@ +/* + Copyright (c) 2007-2019 by Jakob Schröter + 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 TLSGNUTLSSERVER_H__ +#define TLSGNUTLSSERVER_H__ + +#include "tlsgnutlsbase.h" + +#include "config.h" + +#ifdef HAVE_GNUTLS + +#include +#include + +namespace gloox +{ + + /** + * @brief This class implements (stream) encryption using GnuTLS server-side. + * + * You should not need to use this class directly. + * + * @author Jakob Schröter + * @since 1.0 + */ + class GnuTLSServer : public GnuTLSBase + { + public: + /** + * Constructor. + * @param th The TLSHandler to handle TLS-related events. + */ + GnuTLSServer( TLSHandler* th ); + + /** + * Virtual destructor. + */ + virtual ~GnuTLSServer(); + + // reimplemented from TLSBase + virtual bool init( const std::string& clientKey = EmptyString, + const std::string& clientCerts = EmptyString, + const StringList& cacerts = StringList() ); + + // reimplemented from TLSBase + virtual void cleanup(); + + private: + // reimplemented from TLSBase + virtual void setCACerts( const StringList& cacerts ); + + // reimplemented from TLSBase + virtual void setClientCert( const std::string& clientKey, + const std::string& clientCerts ); + + virtual void getCertInfo(); + void generateDH(); + + gnutls_certificate_credentials_t m_x509cred; +// gnutls_priority_t m_priorityCache; + gnutls_dh_params_t m_dhParams; + gnutls_rsa_params_t m_rsaParams; + const int m_dhBits; + + }; + +} + +#endif // HAVE_GNUTLS + +#endif // TLSGNUTLSSERVER_H__ Index: libraries/win32/gloox/include/gloox/tlsgnutlsserveranon.h =================================================================== --- libraries/win32/gloox/include/gloox/tlsgnutlsserveranon.h +++ libraries/win32/gloox/include/gloox/tlsgnutlsserveranon.h @@ -55,6 +55,9 @@ const StringList& cacerts = StringList() ); // reimplemented from TLSBase + virtual void setTLSVersion( TLSVersion tlsVersion ); + + // reimplemented from TLSBase virtual void cleanup(); private: Index: libraries/win32/gloox/include/gloox/tlsopensslbase.h =================================================================== --- libraries/win32/gloox/include/gloox/tlsopensslbase.h +++ libraries/win32/gloox/include/gloox/tlsopensslbase.h @@ -23,6 +23,10 @@ #include +#ifdef HAVE_PTHREAD +#include +#endif + namespace gloox { @@ -72,7 +76,18 @@ virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts ); protected: - virtual bool setType() = 0; + /** + * Possible results of hostname verification. + */ + enum HostnameValidationResult { + MatchFound, + MatchNotFound, + NoSANPresent, + MalformedCertificate, + Error + }; + + virtual bool createCTX() = 0; virtual int handshakeFunction() = 0; SSL* m_ssl; @@ -93,11 +108,25 @@ void doTLSOperation( TLSOperation op ); int ASN1Time2UnixTime( ASN1_TIME* time ); + HostnameValidationResult matchesCommonName( const char* hostname, const X509* server_cert ); + HostnameValidationResult matchesSubjectAlternativeName( const char* hostname, const X509* server_cert ); + HostnameValidationResult validateHostname( const char* hostname, const X509* server_cert, + StringList& listSAN ); + void fillSubjectAlternativeName( StringList& list, const X509 *server_cert ); +#ifdef HAVE_PTHREAD + static void lockCallback( int mode, int type, char *file, int line ); + static unsigned long threadId(); + void initLocks(); + void killLocks(); +#endif std::string m_recvBuffer; std::string m_sendBuffer; char* m_buf; const int m_bufsize; +#ifdef HAVE_PTHREAD + static pthread_mutex_t **lockarray; +#endif }; Index: libraries/win32/gloox/include/gloox/tlsopensslclient.h =================================================================== --- libraries/win32/gloox/include/gloox/tlsopensslclient.h +++ libraries/win32/gloox/include/gloox/tlsopensslclient.h @@ -54,8 +54,8 @@ virtual const std::string channelBinding() const; private: - // reimplemented from OpenSSLBase - virtual bool setType(); + // reimplemented from TLSOpenSSLBase + virtual bool createCTX(); // reimplemented from OpenSSLBase virtual int handshakeFunction(); Index: libraries/win32/gloox/include/gloox/tlsopensslserver.h =================================================================== --- libraries/win32/gloox/include/gloox/tlsopensslserver.h +++ libraries/win32/gloox/include/gloox/tlsopensslserver.h @@ -49,8 +49,9 @@ private: // reimplemented from OpenSSLBase virtual bool privateInit(); - // reimplemented from OpenSSLBase - virtual bool setType(); + + // reimplemented from TLSOpenSSLBase + virtual bool createCTX(); // reimplemented from OpenSSLBase virtual int handshakeFunction(); Index: libraries/win32/gloox/include/gloox/tlsschannel.h =================================================================== --- libraries/win32/gloox/include/gloox/tlsschannel.h +++ libraries/win32/gloox/include/gloox/tlsschannel.h @@ -100,6 +100,7 @@ size_t m_trailer_max; std::string m_buffer; + std::string m_bufferDecrypt; bool m_cleanedup; Index: libraries/win32/gloox/include/gloox/uniquemucroom.h =================================================================== --- libraries/win32/gloox/include/gloox/uniquemucroom.h +++ libraries/win32/gloox/include/gloox/uniquemucroom.h @@ -11,6 +11,7 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_MUC ) #ifndef UNIQUEMUCROOM_H__ #define UNIQUEMUCROOM_H__ @@ -115,3 +116,5 @@ } #endif // UNIQUEMUCROOM_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/util.h =================================================================== --- libraries/win32/gloox/include/gloox/util.h +++ libraries/win32/gloox/include/gloox/util.h @@ -219,7 +219,7 @@ /** * Checks whether the given input is valid UTF-8. * @param data The data to check for validity. - * @return @@b True if the input is valid UTF-8, @b false otherwise. + * @return @b True if the input is valid UTF-8, @b false otherwise. */ GLOOX_API bool checkValidXMLChars( const std::string& data ); Index: libraries/win32/gloox/include/gloox/vcard.h =================================================================== --- libraries/win32/gloox/include/gloox/vcard.h +++ libraries/win32/gloox/include/gloox/vcard.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_VCARD ) + #ifndef VCARD_H__ #define VCARD_H__ @@ -625,3 +627,5 @@ } #endif // VCARD_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/vcardhandler.h =================================================================== --- libraries/win32/gloox/include/gloox/vcardhandler.h +++ libraries/win32/gloox/include/gloox/vcardhandler.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_VCARD ) + #ifndef VCARDHANDLER_H__ #define VCARDHANDLER_H__ @@ -73,3 +75,5 @@ } #endif // VCARDHANDLER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/vcardmanager.h =================================================================== --- libraries/win32/gloox/include/gloox/vcardmanager.h +++ libraries/win32/gloox/include/gloox/vcardmanager.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_BYTESTREAM ) + #ifndef VCARDMANAGER_H__ #define VCARDMANAGER_H__ @@ -154,3 +156,5 @@ } #endif // VCARDMANAGER_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/vcardupdate.h =================================================================== --- libraries/win32/gloox/include/gloox/vcardupdate.h +++ libraries/win32/gloox/include/gloox/vcardupdate.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_VCARD ) + #ifndef VCARDUPDATE_H__ #define VCARDUPDATE_H__ @@ -104,3 +106,5 @@ } #endif // VCARDUPDATE_H__ + +#endif // GLOOX_MINIMAL Index: libraries/win32/gloox/include/gloox/xhtmlim.h =================================================================== --- libraries/win32/gloox/include/gloox/xhtmlim.h +++ libraries/win32/gloox/include/gloox/xhtmlim.h @@ -11,6 +11,8 @@ */ +#if !defined( GLOOX_MINIMAL ) || defined( WANT_XHTMLIM ) + #ifndef XHTMLIM_H__ #define XHTMLIM_H__ @@ -76,3 +78,5 @@ } #endif // XHTMLIM_H__ + +#endif // GLOOX_MINIMAL Index: source/lobby/glooxwrapper/glooxwrapper.h =================================================================== --- source/lobby/glooxwrapper/glooxwrapper.h +++ source/lobby/glooxwrapper/glooxwrapper.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -320,8 +320,10 @@ string phone; string url; string date; +#if !OS_WIN string misc; string text; +#endif }; struct MUCRoomParticipant Index: source/lobby/glooxwrapper/glooxwrapper.cpp =================================================================== --- source/lobby/glooxwrapper/glooxwrapper.cpp +++ source/lobby/glooxwrapper/glooxwrapper.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -209,7 +209,11 @@ m_Wrapped->handleAlreadyRegistered(fromWrapped); } +#if OS_WIN + virtual void handleRegistrationResult(const gloox::JID& from, gloox::RegistrationResult regResult, const gloox::Error* UNUSED(error)) +#else virtual void handleRegistrationResult(const gloox::JID& from, gloox::RegistrationResult regResult) +#endif { glooxwrapper::JID fromWrapped(from); m_Wrapped->handleRegistrationResult(fromWrapped, regResult); @@ -691,8 +695,10 @@ COPY(phone); COPY(url); COPY(date); +#if !OS_WIN COPY(misc); COPY(text); +#endif #undef COPY return m_Wrapped->createAccount(fields, valuesUnwrapped); }