summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swiften/Examples/SendFile/SendFile.cpp30
-rw-r--r--Swiften/FileTransfer/OutgoingSIFileTransfer.cpp87
-rw-r--r--Swiften/FileTransfer/OutgoingSIFileTransfer.h54
-rw-r--r--Swiften/FileTransfer/SConscript1
4 files changed, 15 insertions, 157 deletions
diff --git a/Swiften/Examples/SendFile/SendFile.cpp b/Swiften/Examples/SendFile/SendFile.cpp
index d686387..5f2403a 100644
--- a/Swiften/Examples/SendFile/SendFile.cpp
+++ b/Swiften/Examples/SendFile/SendFile.cpp
@@ -1,36 +1,36 @@
1/* 1/*
2 * Copyright (c) 2010-2013 Isode Limited. 2 * Copyright (c) 2010-2015 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
6 6
7#include <boost/date_time/posix_time/posix_time.hpp> 7#include <iostream>
8
8#include <boost/bind.hpp> 9#include <boost/bind.hpp>
10#include <boost/date_time/posix_time/posix_time.hpp>
9#include <boost/filesystem.hpp> 11#include <boost/filesystem.hpp>
10#include <iostream>
11 12
13#include <Swiften/Base/ByteArray.h>
14#include <Swiften/Base/Log.h>
12#include <Swiften/Client/Client.h> 15#include <Swiften/Client/Client.h>
16#include <Swiften/Client/ClientXMLTracer.h>
17#include <Swiften/Disco/EntityCapsManager.h>
13#include <Swiften/Elements/Presence.h> 18#include <Swiften/Elements/Presence.h>
14#include <Swiften/Base/Log.h>
15#include <Swiften/Network/BoostTimer.h>
16#include <Swiften/Network/TimerFactory.h>
17#include <Swiften/Network/BoostNetworkFactories.h>
18#include <Swiften/EventLoop/EventLoop.h> 19#include <Swiften/EventLoop/EventLoop.h>
19#include <Swiften/Client/ClientXMLTracer.h>
20#include <Swiften/EventLoop/SimpleEventLoop.h> 20#include <Swiften/EventLoop/SimpleEventLoop.h>
21#include <Swiften/FileTransfer/OutgoingSIFileTransfer.h>
22#include <Swiften/FileTransfer/FileReadBytestream.h> 21#include <Swiften/FileTransfer/FileReadBytestream.h>
23#include <Swiften/FileTransfer/SOCKS5BytestreamServer.h> 22#include <Swiften/FileTransfer/FileTransferManager.h>
24#include <Swiften/Network/BoostConnectionServer.h>
25#include <Swiften/FileTransfer/OutgoingFileTransferManager.h>
26#include <Swiften/FileTransfer/OutgoingFileTransfer.h> 23#include <Swiften/FileTransfer/OutgoingFileTransfer.h>
24#include <Swiften/FileTransfer/OutgoingFileTransferManager.h>
25#include <Swiften/FileTransfer/SOCKS5BytestreamServer.h>
27#include <Swiften/Jingle/JingleSessionManager.h> 26#include <Swiften/Jingle/JingleSessionManager.h>
28#include <Swiften/Disco/EntityCapsManager.h> 27#include <Swiften/Network/BoostConnectionServer.h>
29#include <Swiften/Base/ByteArray.h> 28#include <Swiften/Network/BoostNetworkFactories.h>
29#include <Swiften/Network/BoostTimer.h>
30#include <Swiften/Network/TimerFactory.h>
30#include <Swiften/StringCodecs/Hexify.h> 31#include <Swiften/StringCodecs/Hexify.h>
31#include <Swiften/FileTransfer/FileTransferManager.h>
32 32
33using namespace Swift; 33using namespace Swift;
34 34
35static SimpleEventLoop eventLoop; 35static SimpleEventLoop eventLoop;
36static BoostNetworkFactories networkFactories(&eventLoop); 36static BoostNetworkFactories networkFactories(&eventLoop);
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
17namespace Swift {
18
19OutgoingSIFileTransfer::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
22void 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
35void OutgoingSIFileTransfer::stop() {
36}
37
38void 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
63void OutgoingSIFileTransfer::handleBytestreamsRequestResponse(Bytestreams::ref, ErrorPayload::ref) {
64 /*
65 if (error) {
66 finish(FileTransferError());
67 }
68 */
69 //socksServer->onTransferFinished.connect();
70}
71
72void 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
83void OutgoingSIFileTransfer::handleIBBSessionFinished(boost::optional<FileTransferError>) {
84 //finish(error);
85}
86
87}
diff --git a/Swiften/FileTransfer/OutgoingSIFileTransfer.h b/Swiften/FileTransfer/OutgoingSIFileTransfer.h
deleted file mode 100644
index c323a77..0000000
--- a/Swiften/FileTransfer/OutgoingSIFileTransfer.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * Copyright (c) 2010-2015 Isode Limited.
3 * All rights reserved.
4 * See the COPYING file for more information.
5 */
6
7#pragma once
8
9#include <boost/shared_ptr.hpp>
10
11#include <Swiften/Base/API.h>
12#include <Swiften/FileTransfer/OutgoingFileTransfer.h>
13#include <Swiften/FileTransfer/ReadBytestream.h>
14#include <Swiften/Base/boost_bsignals.h>
15#include <Swiften/FileTransfer/FileTransferError.h>
16#include <Swiften/FileTransfer/SOCKS5BytestreamServer.h>
17#include <Swiften/JID/JID.h>
18#include <Swiften/Elements/StreamInitiation.h>
19#include <Swiften/Elements/Bytestreams.h>
20#include <Swiften/Elements/ErrorPayload.h>
21#include <Swiften/FileTransfer/IBBSendSession.h>
22
23namespace Swift {
24 class IQRouter;
25 class SOCKS5BytestreamServer;
26
27 class SWIFTEN_API OutgoingSIFileTransfer : public OutgoingFileTransfer {
28 public:
29 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);
30
31 virtual void start();
32 virtual void stop();
33
34 boost::signal<void (const boost::optional<FileTransferError>&)> onFinished;
35
36 private:
37 void handleStreamInitiationRequestResponse(StreamInitiation::ref, ErrorPayload::ref);
38 void handleBytestreamsRequestResponse(Bytestreams::ref, ErrorPayload::ref);
39 void finish(boost::optional<FileTransferError> error);
40 void handleIBBSessionFinished(boost::optional<FileTransferError> error);
41
42 private:
43 std::string id;
44 JID from;
45 JID to;
46 std::string name;
47 unsigned long long size;
48 std::string description;
49 boost::shared_ptr<ReadBytestream> bytestream;
50 IQRouter* iqRouter;
51 SOCKS5BytestreamServer* socksServer;
52 boost::shared_ptr<IBBSendSession> ibbSession;
53 };
54}
diff --git a/Swiften/FileTransfer/SConscript b/Swiften/FileTransfer/SConscript
index ff162ad..41af8d4 100644
--- a/Swiften/FileTransfer/SConscript
+++ b/Swiften/FileTransfer/SConscript
@@ -1,11 +1,10 @@
1Import("swiften_env", "env") 1Import("swiften_env", "env")
2 2
3sources = [ 3sources = [
4 "ByteArrayReadBytestream.cpp", 4 "ByteArrayReadBytestream.cpp",
5 "OutgoingFileTransfer.cpp", 5 "OutgoingFileTransfer.cpp",
6 "OutgoingSIFileTransfer.cpp",
7 "OutgoingJingleFileTransfer.cpp", 6 "OutgoingJingleFileTransfer.cpp",
8 "OutgoingFileTransferManager.cpp", 7 "OutgoingFileTransferManager.cpp",
9 "IncomingFileTransfer.cpp", 8 "IncomingFileTransfer.cpp",
10 "IncomingJingleFileTransfer.cpp", 9 "IncomingJingleFileTransfer.cpp",
11 "IncomingFileTransferManager.cpp", 10 "IncomingFileTransferManager.cpp",