diff options
Diffstat (limited to 'Swiften/FileTransfer/OutgoingSIFileTransfer.cpp')
| -rw-r--r-- | Swiften/FileTransfer/OutgoingSIFileTransfer.cpp | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/Swiften/FileTransfer/OutgoingSIFileTransfer.cpp b/Swiften/FileTransfer/OutgoingSIFileTransfer.cpp deleted file mode 100644 index f100ed4..0000000 --- a/Swiften/FileTransfer/OutgoingSIFileTransfer.cpp +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2010-2013 Isode Limited. | ||
| 3 | * All rights reserved. | ||
| 4 | * See the COPYING file for more information. | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include <Swiften/FileTransfer/OutgoingSIFileTransfer.h> | ||
| 8 | |||
| 9 | #include <boost/bind.hpp> | ||
| 10 | #include <boost/smart_ptr/make_shared.hpp> | ||
| 11 | |||
| 12 | #include <Swiften/FileTransfer/StreamInitiationRequest.h> | ||
| 13 | #include <Swiften/FileTransfer/BytestreamsRequest.h> | ||
| 14 | #include <Swiften/FileTransfer/SOCKS5BytestreamServer.h> | ||
| 15 | #include <Swiften/FileTransfer/IBBSendSession.h> | ||
| 16 | |||
| 17 | namespace Swift { | ||
| 18 | |||
| 19 | OutgoingSIFileTransfer::OutgoingSIFileTransfer(const std::string& id, const JID& from, const JID& to, const std::string& name, unsigned long long size, const std::string& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer) : id(id), from(from), to(to), name(name), size(size), description(description), bytestream(bytestream), iqRouter(iqRouter), socksServer(socksServer) { | ||
| 20 | } | ||
| 21 | |||
| 22 | void OutgoingSIFileTransfer::start() { | ||
| 23 | /* | ||
| 24 | StreamInitiation::ref streamInitiation(new StreamInitiation()); | ||
| 25 | streamInitiation->setID(id); | ||
| 26 | streamInitiation->setFileInfo(StreamInitiationFileInfo(name, description, size)); | ||
| 27 | //streamInitiation->addProvidedMethod("http://jabber.org/protocol/bytestreams"); | ||
| 28 | streamInitiation->addProvidedMethod("http://jabber.org/protocol/ibb"); | ||
| 29 | StreamInitiationRequest::ref request = StreamInitiationRequest::create(to, streamInitiation, iqRouter); | ||
| 30 | request->onResponse.connect(boost::bind(&OutgoingSIFileTransfer::handleStreamInitiationRequestResponse, this, _1, _2)); | ||
| 31 | request->send(); | ||
| 32 | */ | ||
| 33 | } | ||
| 34 | |||
| 35 | void OutgoingSIFileTransfer::stop() { | ||
| 36 | } | ||
| 37 | |||
| 38 | void OutgoingSIFileTransfer::handleStreamInitiationRequestResponse(StreamInitiation::ref, ErrorPayload::ref) { | ||
| 39 | /* | ||
| 40 | if (error) { | ||
| 41 | finish(FileTransferError()); | ||
| 42 | } | ||
| 43 | else { | ||
| 44 | if (response->getRequestedMethod() == "http://jabber.org/protocol/bytestreams") { | ||
| 45 | socksServer->addReadBytestream(id, from, to, bytestream); | ||
| 46 | Bytestreams::ref bytestreams(new Bytestreams()); | ||
| 47 | bytestreams->setStreamID(id); | ||
| 48 | HostAddressPort addressPort = socksServer->getAddressPort(); | ||
| 49 | bytestreams->addStreamHost(Bytestreams::StreamHost(addressPort.getAddress().toString(), from, addressPort.getPort())); | ||
| 50 | BytestreamsRequest::ref request = BytestreamsRequest::create(to, bytestreams, iqRouter); | ||
| 51 | request->onResponse.connect(boost::bind(&OutgoingSIFileTransfer::handleBytestreamsRequestResponse, this, _1, _2)); | ||
| 52 | request->send(); | ||
| 53 | } | ||
| 54 | else if (response->getRequestedMethod() == "http://jabber.org/protocol/ibb") { | ||
| 55 | ibbSession = boost::make_shared<IBBSendSession>(id, from, to, bytestream, iqRouter); | ||
| 56 | ibbSession->onFinished.connect(boost::bind(&OutgoingSIFileTransfer::handleIBBSessionFinished, this, _1)); | ||
| 57 | ibbSession->start(); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | */ | ||
| 61 | } | ||
| 62 | |||
| 63 | void OutgoingSIFileTransfer::handleBytestreamsRequestResponse(Bytestreams::ref, ErrorPayload::ref) { | ||
| 64 | /* | ||
| 65 | if (error) { | ||
| 66 | finish(FileTransferError()); | ||
| 67 | } | ||
| 68 | */ | ||
| 69 | //socksServer->onTransferFinished.connect(); | ||
| 70 | } | ||
| 71 | |||
| 72 | void OutgoingSIFileTransfer::finish(boost::optional<FileTransferError>) { | ||
| 73 | /* | ||
| 74 | if (ibbSession) { | ||
| 75 | ibbSession->onFinished.disconnect(boost::bind(&OutgoingSIFileTransfer::handleIBBSessionFinished, this, _1)); | ||
| 76 | ibbSession.reset(); | ||
| 77 | } | ||
| 78 | socksServer->removeReadBytestream(id, from, to); | ||
| 79 | onFinished(error); | ||
| 80 | */ | ||
| 81 | } | ||
| 82 | |||
| 83 | void OutgoingSIFileTransfer::handleIBBSessionFinished(boost::optional<FileTransferError>) { | ||
| 84 | //finish(error); | ||
| 85 | } | ||
| 86 | |||
| 87 | } | ||
Swift