diff --git a/include/Swiften/Server/ServerStanzaChannel.h b/include/Swiften/Server/ServerStanzaChannel.h index 2a562761a31a44c5169748e17e137d1daeece42c..3b9d45928025dd1b38b5765993ab5d691cda154b 100644 --- a/include/Swiften/Server/ServerStanzaChannel.h +++ b/include/Swiften/Server/ServerStanzaChannel.h @@ -1,58 +1,62 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include - -#include "Swiften/Base/IDGenerator.h" -#include "Swiften/Server/ServerFromClientSession.h" -#include "Swiften/Client/StanzaChannel.h" -#include "Swiften/Elements/Message.h" -#include "Swiften/Elements/IQ.h" -#include "Swiften/Elements/Presence.h" -#include "Swiften/TLS/Certificate.h" - -namespace Swift { - class Error; - class ServerStanzaChannel : public StanzaChannel { - public: - void addSession(boost::shared_ptr session); - void removeSession(boost::shared_ptr session); - - void sendIQ(boost::shared_ptr iq); - void sendMessage(boost::shared_ptr message); - void sendPresence(boost::shared_ptr presence); - - void finishSession(const JID& to, boost::shared_ptr element, bool last = false); - - bool getStreamManagementEnabled() const { - return false; - } - - bool isAvailable() const { - return true; - } - - std::vector getPeerCertificateChain() const { - return std::vector(); - } - - private: - std::string getNewIQID(); - void send(boost::shared_ptr stanza); - void handleSessionFinished(const boost::optional&, const boost::shared_ptr &session); - void handleElement(boost::shared_ptr element, const boost::shared_ptr &session); - void handleDataRead(const SafeByteArray &data, const boost::shared_ptr &session); - void handleSessionInitialized(); - - private: - IDGenerator idGenerator; - // [JID][resources][ServerFromClientSession] - std::map > > sessions; - }; - -} +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include + +#include "Swiften/Base/IDGenerator.h" +#include "Swiften/Server/ServerFromClientSession.h" +#include "Swiften/Client/StanzaChannel.h" +#include "Swiften/Elements/Message.h" +#include "Swiften/Elements/IQ.h" +#include "Swiften/Elements/Presence.h" +#include "Swiften/TLS/Certificate.h" +#include +#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000 + +namespace Swift { + class Error; + class ServerStanzaChannel : public StanzaChannel { + public: + void addSession(boost::shared_ptr session); + void removeSession(boost::shared_ptr session); + + void sendIQ(boost::shared_ptr iq); + void sendMessage(boost::shared_ptr message); + void sendPresence(boost::shared_ptr presence); +#if HAVE_SWIFTEN_3 + void finishSession(const JID& to, boost::shared_ptr element, bool last = false); +#else + void finishSession(const JID& to, boost::shared_ptr element, bool last = false); +#endif + bool getStreamManagementEnabled() const { + return false; + } + + bool isAvailable() const { + return true; + } + + std::vector getPeerCertificateChain() const { + return std::vector(); + } + + private: + std::string getNewIQID(); + void send(boost::shared_ptr stanza); + void handleSessionFinished(const boost::optional&, const boost::shared_ptr &session); + void handleElement(boost::shared_ptr element, const boost::shared_ptr &session); + void handleDataRead(const SafeByteArray &data, const boost::shared_ptr &session); + void handleSessionInitialized(); + + private: + IDGenerator idGenerator; + // [JID][resources][ServerFromClientSession] + std::map > > sessions; + }; + +}