コード例 #1
0
void FileTransferController::accept(std::string& file) {
	SWIFT_LOG(debug) << "FileTransferController::accept" << std::endl;
	IncomingFileTransfer::ref incomingTransfer = boost::dynamic_pointer_cast<IncomingFileTransfer>(transfer);
	if (incomingTransfer) {
		fileWriteStream = boost::make_shared<FileWriteBytestream>(boost::filesystem::path(file));

		ftProgressInfo = new FileTransferProgressInfo(transfer->getFileSizeInBytes());
		ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1));
		transfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1));
		incomingTransfer->accept(fileWriteStream);
	} else {
		std::cerr << "Expected an incoming transfer in this situation!" << std::endl;
	}
}
コード例 #2
0
		void handleReceiverIncomingFileTransfer(IncomingFileTransfer::ref transfer) {
			incomingFileTransfers_.push_back(transfer);
			boost::shared_ptr<FileWriteBytestream> out = boost::make_shared<FileWriteBytestream>(receiveFilePath_.native());
			transfer->onFinished.connect(boost::bind(&FileTransferTest::handleReceiverFileTransferFinished, this, _1, out));

			FileTransferOptions options;
			options = options.withInBandAllowed(receiverCandidates_ & InBandBytestream);
			options = options.withDirectAllowed(receiverCandidates_ & S5B_Direct);
			options = options.withAssistedAllowed(receiverCandidates_ & S5B_Assisted);
			options = options.withProxiedAllowed(receiverCandidates_ & S5B_Proxied);

			std::cout << "Incoming transfer options: " << "IBB (" << options.isInBandAllowed() << ")" << ", ";
			std::cout << "S5B Direct (" << options.isDirectAllowed() << ")" << ", ";
			std::cout << "S5B Assisted (" << options.isAssistedAllowed() << ")" << ", ";
			std::cout << "S5B Proxied (" << options.isProxiedAllowed() << ")" << std::endl;

			transfer->accept(out, options);
		}
コード例 #3
0
FileTransferController::FileTransferController(IncomingFileTransfer::ref transfer) :
	sending(false), otherParty(transfer->getSender()), filename(transfer->getFileName()), transfer(transfer), ftManager(0), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) {
	transfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1));
}
コード例 #4
0
FileTransferController::FileTransferController(IncomingFileTransfer::ref transfer) :
	sending(false), otherParty(transfer->getSender()), filename(transfer->filename), transfer(transfer), ftManager(0), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) {

}