summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Clayton <alex.clayton@isode.com>2016-01-27 16:36:15 (GMT)
committerAlex Clayton <alex.clayton@isode.com>2016-01-28 12:25:43 (GMT)
commitceb4798aa0739ebd7177632c3f508babacb2f8d7 (patch)
tree7e5a2c1852261c8f0e4d8ed3262a32cced037378 /src/com/isode/stroke/filetransfer/OutgoingSIFileTransfer.java
parent93eb4ab62a08da883cab4a3743a3a86c198eb0b4 (diff)
downloadstroke-ceb4798aa0739ebd7177632c3f508babacb2f8d7.zip
stroke-ceb4798aa0739ebd7177632c3f508babacb2f8d7.tar.bz2
Changes to FileTransfer to be inline with current Swiften code
There has been some changes to the file transfer clases in Swiften since Tarun's patch was written. This patch updates the java classes to bring them in line with the swiften one. In details IBBSendSession - added code to clean up onResponse connection when not needed. In Swiften this was done by keeping reference to current session using boost bindings to remove binding. In java we have to keep a reference to the current onResponse connection and disconnect it when not neeeded. IncomingFileTransferManager - Remove redundant IQRouter field. LocalJingeTransportCandidateGenerator - Do not advertise link-local IPv6 addresses in FT candidates OutgoingSIFileTransfer - File deleted SOCKS5BytestreamProxiesManager and SOCKS5BytestreamProxyFinder - Search for all proxies instead of just one. Test-information: Ran make and make test to check everything built ok and that the unit tests still passed. Change-Id: I696444e5074fe20625243693a44c836306b3a41e
Diffstat (limited to 'src/com/isode/stroke/filetransfer/OutgoingSIFileTransfer.java')
-rw-r--r--src/com/isode/stroke/filetransfer/OutgoingSIFileTransfer.java149
1 files changed, 0 insertions, 149 deletions
diff --git a/src/com/isode/stroke/filetransfer/OutgoingSIFileTransfer.java b/src/com/isode/stroke/filetransfer/OutgoingSIFileTransfer.java
deleted file mode 100644
index 4ba17de..0000000
--- a/src/com/isode/stroke/filetransfer/OutgoingSIFileTransfer.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2010-2015 Isode Limited.
- * All rights reserved.
- * See the COPYING file for more information.
- */
-/*
- * Copyright (c) 2015 Tarun Gupta.
- * Licensed under the simplified BSD license.
- * See Documentation/Licenses/BSD-simplified.txt for more information.
- */
-
-package com.isode.stroke.filetransfer;
-
-import com.isode.stroke.jid.JID;
-import com.isode.stroke.queries.IQRouter;
-import com.isode.stroke.signals.Signal1;
-import com.isode.stroke.elements.ErrorPayload;
-import com.isode.stroke.elements.StreamInitiation;
-import com.isode.stroke.elements.Bytestreams;
-
-public class OutgoingSIFileTransfer implements OutgoingFileTransfer {
-
- private long fileSizeInBytes = 0; //FileTransferVariables
- private String filename = ""; //FileTransferVariables
-
- /**
- * FileTransferMethod.
- */
- @Override
- public String getFileName() {
- return filename;
- }
-
- /**
- * FileTransferMethod.
- */
- @Override
- public long getFileSizeInBytes() {
- return fileSizeInBytes;
- }
-
- /**
- * FileTransferMethod.
- */
- @Override
- public void setFileInfo(final String name, long size) {
- this.filename = name;
- this.fileSizeInBytes = size;
- }
-
- private String id = "";
- private JID from;
- private JID to;
- private String name = "";
- private long size;
- private String description = "";
- private ReadBytestream bytestream;
- private IQRouter iqRouter;
- private SOCKS5BytestreamServer socksServer;
- private IBBSendSession ibbSession;
-
- public OutgoingSIFileTransfer(final String id, final JID from, final JID to, final String name, long size, final String description, ReadBytestream bytestream, IQRouter iqRouter, SOCKS5BytestreamServer socksServer) {
- this.id = id;
- this.from = from;
- this.to = to;
- this.name = name;
- this.size = size;
- this.description = description;
- this.bytestream = bytestream;
- this.iqRouter = iqRouter;
- this.socksServer = socksServer;
- this.ibbSession = ibbSession;
- }
-
- /**
- * OutgoingFileTransferMethod.
- */
- @Override
- public void start() {
- /*
- StreamInitiation::ref streamInitiation(new StreamInitiation());
- streamInitiation.setID(id);
- streamInitiation.setFileInfo(StreamInitiationFileInfo(name, description, size));
- //streamInitiation.addProvidedMethod("http://jabber.org/protocol/bytestreams");
- streamInitiation.addProvidedMethod("http://jabber.org/protocol/ibb");
- StreamInitiationRequest::ref request = StreamInitiationRequest::create(to, streamInitiation, iqRouter);
- request.onResponse.connect(boost::bind(&OutgoingSIFileTransfer::handleStreamInitiationRequestResponse, this, _1, _2));
- request.send();
- */
- }
-
- public void stop() {
- }
-
- public final Signal1<FileTransferError> onFinished = new Signal1<FileTransferError>();
-
- private void handleStreamInitiationRequestResponse(StreamInitiation stream, ErrorPayload error) {
- /*
- if (error) {
- finish(FileTransferError());
- }
- else {
- if (response->getRequestedMethod() == "http://jabber.org/protocol/bytestreams") {
- socksServer->addReadBytestream(id, from, to, bytestream);
- Bytestreams::ref bytestreams(new Bytestreams());
- bytestreams->setStreamID(id);
- HostAddressPort addressPort = socksServer->getAddressPort();
- bytestreams->addStreamHost(Bytestreams::StreamHost(addressPort.getAddress().toString(), from, addressPort.getPort()));
- BytestreamsRequest::ref request = BytestreamsRequest::create(to, bytestreams, iqRouter);
- request->onResponse.connect(boost::bind(&OutgoingSIFileTransfer::handleBytestreamsRequestResponse, this, _1, _2));
- request->send();
- }
- else if (response->getRequestedMethod() == "http://jabber.org/protocol/ibb") {
- ibbSession = boost::make_shared<IBBSendSession>(id, from, to, bytestream, iqRouter);
- ibbSession->onFinished.connect(boost::bind(&OutgoingSIFileTransfer::handleIBBSessionFinished, this, _1));
- ibbSession->start();
- }
- }
- */
- }
-
- private void handleBytestreamsRequestResponse(Bytestreams stream, ErrorPayload error) {
- /*
- if (error) {
- finish(FileTransferError());
- }
- */
- //socksServer->onTransferFinished.connect();
- }
-
- private void finish(FileTransferError error) {
- /*
- if (ibbSession) {
- ibbSession->onFinished.disconnect(boost::bind(&OutgoingSIFileTransfer::handleIBBSessionFinished, this, _1));
- ibbSession.reset();
- }
- socksServer->removeReadBytestream(id, from, to);
- onFinished(error);
- */
- }
-
- private void handleIBBSessionFinished(FileTransferError error) {
- //finish(error);
- }
-
- public void cancel() {
-
- }
-} \ No newline at end of file