/* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include #include #include #include #include #include #include #include namespace Swift { /** * StanzaChannel implementation around a ClientSession. */ class SWIFTEN_API ClientSessionStanzaChannel : public StanzaChannel { public: virtual ~ClientSessionStanzaChannel(); void setSession(std::shared_ptr session); void sendIQ(std::shared_ptr iq); void sendMessage(std::shared_ptr message); void sendPresence(std::shared_ptr presence); bool getStreamManagementEnabled() const; virtual std::vector getPeerCertificateChain() const; bool isAvailable() const { return session && session->getState() == ClientSession::State::Initialized; } private: std::string getNewIQID(); void send(std::shared_ptr stanza); void handleSessionFinished(std::shared_ptr error); void handleStanza(std::shared_ptr stanza); void handleStanzaAcked(std::shared_ptr stanza); void handleSessionInitialized(); private: IDGenerator idGenerator; std::shared_ptr session; }; }