/* * 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 #include namespace Swift { class IQRouter; class IBBRequest; class SWIFTEN_API IBBSendSession { public: IBBSendSession( const std::string& id, const JID& from, const JID& to, std::shared_ptr bytestream, IQRouter* router); ~IBBSendSession(); void start(); void stop(); const JID& getSender() const { return from; } const JID& getReceiver() const { return to; } void setBlockSize(unsigned int blockSize) { this->blockSize = blockSize; } boost::signals2::signal)> onFinished; boost::signals2::signal onBytesSent; private: void handleIBBResponse(IBB::ref, ErrorPayload::ref); void finish(boost::optional); void sendMoreData(); void handleDataAvailable(); private: std::string id; JID from; JID to; std::shared_ptr bytestream; IQRouter* router; unsigned int blockSize; int sequenceNumber; bool active; bool waitingForData; std::shared_ptr currentRequest; }; }