diff --git a/include/Swiften/Server/ServerStanzaChannel.h b/include/Swiften/Server/ServerStanzaChannel.h new file mode 100644 index 0000000000000000000000000000000000000000..1da89448acfa6ee8aef10dd46d028ff3266ad1f5 --- /dev/null +++ b/include/Swiften/Server/ServerStanzaChannel.h @@ -0,0 +1,51 @@ +/* + * 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" + +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 getStreamManagementEnabled() const { + return false; + } + + bool isAvailable() const { + return true; + } + + 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 handleSessionInitialized(); + + private: + IDGenerator idGenerator; + std::list > sessions; + }; + +}