summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAlex Clayton <alex.clayton@isode.com>2016-03-14 16:56:32 (GMT)
committerAlex Clayton <alex.clayton@isode.com>2016-03-15 14:13:57 (GMT)
commit826bc53ab9839d4f6dff28cdb4d5dc1b317016de (patch)
tree87dcc73c152f550d618c64ef89198e279ec8bacc /src/com
parent3dcfa7102ac07188ac0c1c8b252d45735abd31ea (diff)
downloadstroke-826bc53ab9839d4f6dff28cdb4d5dc1b317016de.zip
stroke-826bc53ab9839d4f6dff28cdb4d5dc1b317016de.tar.bz2
Only calculate S5B candidates if supported by recipient
As per swiften patch of the same name (e9ed818dac91e280eb8da86dc8494710f1da0624), some changes to FileTransferMangerImpl on how it creates an Outgoing File Transfer. Also added a copy constructor to FileTransferOption that had been in swiften but was not yet implemented in stroke. Change-Id: I314ac5ef7f8e082c7121ad89c012b84569f98d6c Test-information: Unit tests still pass.
Diffstat (limited to 'src/com')
-rw-r--r--src/com/isode/stroke/filetransfer/FileTransferManagerImpl.java21
-rw-r--r--src/com/isode/stroke/filetransfer/FileTransferOptions.java15
2 files changed, 33 insertions, 3 deletions
diff --git a/src/com/isode/stroke/filetransfer/FileTransferManagerImpl.java b/src/com/isode/stroke/filetransfer/FileTransferManagerImpl.java
index da5e120..386bfa9 100644
--- a/src/com/isode/stroke/filetransfer/FileTransferManagerImpl.java
+++ b/src/com/isode/stroke/filetransfer/FileTransferManagerImpl.java
@@ -6,3 +6,3 @@
/*
- * Copyright (c) 2013-2015 Isode Limited.
+ * Copyright (c) 2013-2016 Isode Limited.
* All rights reserved.
@@ -34,2 +34,3 @@ import com.isode.stroke.elements.Presence;
import com.isode.stroke.elements.JingleFileTransferFileInfo;
+
import java.io.File;
@@ -39,2 +40,3 @@ import java.util.Vector;
import java.util.Collection;
+import java.util.logging.Logger;
@@ -52,2 +54,4 @@ public class FileTransferManagerImpl extends FileTransferManager {
private SOCKS5BytestreamServerManager s5bServerManager;
+
+ private final Logger logger = Logger.getLogger(this.getClass().getName());
@@ -155,2 +159,17 @@ public class FileTransferManagerImpl extends FileTransferManager {
+ DiscoInfo capabilities = capsProvider.getCaps(receipient);
+
+ FileTransferOptions options = new FileTransferOptions(config);
+ if (capabilities != null) {
+ if (!capabilities.hasFeature(DiscoInfo.JingleTransportsS5BFeature)) {
+ options = options.withAssistedAllowed(false).withDirectAllowed(false).withProxiedAllowed(false);
+ }
+ if (!capabilities.hasFeature(DiscoInfo.JingleTransportsIBBFeature)) {
+ options = options.withInBandAllowed(false);
+ }
+ }
+ else {
+ logger.warning("No entity capabilities information for "+receipient.toString()+"\n");
+ }
+
return outgoingFTManager.createOutgoingFileTransfer(iqRouter.getJID(), receipient, bytestream, fileInfo, config);
diff --git a/src/com/isode/stroke/filetransfer/FileTransferOptions.java b/src/com/isode/stroke/filetransfer/FileTransferOptions.java
index fd529e9..73fe1a1 100644
--- a/src/com/isode/stroke/filetransfer/FileTransferOptions.java
+++ b/src/com/isode/stroke/filetransfer/FileTransferOptions.java
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2013-2015 Isode Limited.
+ * Copyright (c) 2013-2016 Isode Limited.
* All rights reserved.
@@ -14,3 +14,3 @@ package com.isode.stroke.filetransfer;
public class FileTransferOptions {
-
+
private boolean allowInBand_;
@@ -27,2 +27,13 @@ public class FileTransferOptions {
+ /**
+ * Copy constructor
+ * @param other {@link FileTransferOptions} to copy
+ */
+ public FileTransferOptions(FileTransferOptions other) {
+ this.allowInBand_ = other.allowInBand_;
+ this.allowAssisted_ = other.allowAssisted_;
+ this.allowProxied_ = other.allowProxied_;
+ this.allowDirect_ = other.allowDirect_;
+ }
+
public FileTransferOptions withInBandAllowed(boolean b) {