summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
@@ -4,7 +4,7 @@
4 * See Documentation/Licenses/BSD-simplified.txt for more information. 4 * See Documentation/Licenses/BSD-simplified.txt for more information.
5 */ 5 */
6/* 6/*
7 * Copyright (c) 2013-2015 Isode Limited. 7 * Copyright (c) 2013-2016 Isode Limited.
8 * All rights reserved. 8 * All rights reserved.
9 * See the COPYING file for more information. 9 * See the COPYING file for more information.
10 */ 10 */
@@ -32,11 +32,13 @@ import com.isode.stroke.base.IDGenerator;
32import com.isode.stroke.elements.DiscoInfo; 32import com.isode.stroke.elements.DiscoInfo;
33import com.isode.stroke.elements.Presence; 33import com.isode.stroke.elements.Presence;
34import com.isode.stroke.elements.JingleFileTransferFileInfo; 34import com.isode.stroke.elements.JingleFileTransferFileInfo;
35
35import java.io.File; 36import java.io.File;
36import java.util.Date; 37import java.util.Date;
37import java.util.TimeZone; 38import java.util.TimeZone;
38import java.util.Vector; 39import java.util.Vector;
39import java.util.Collection; 40import java.util.Collection;
41import java.util.logging.Logger;
40 42
41public class FileTransferManagerImpl extends FileTransferManager { 43public class FileTransferManagerImpl extends FileTransferManager {
42 44
@@ -50,6 +52,8 @@ public class FileTransferManagerImpl extends FileTransferManager {
50 private SOCKS5BytestreamRegistry bytestreamRegistry; 52 private SOCKS5BytestreamRegistry bytestreamRegistry;
51 private SOCKS5BytestreamProxiesManager bytestreamProxy; 53 private SOCKS5BytestreamProxiesManager bytestreamProxy;
52 private SOCKS5BytestreamServerManager s5bServerManager; 54 private SOCKS5BytestreamServerManager s5bServerManager;
55
56 private final Logger logger = Logger.getLogger(this.getClass().getName());
53 57
54 public FileTransferManagerImpl( 58 public FileTransferManagerImpl(
55 final JID ownJID, 59 final JID ownJID,
@@ -153,6 +157,21 @@ public class FileTransferManagerImpl extends FileTransferManager {
153 157
154 assert(!iqRouter.getJID().isBare()); 158 assert(!iqRouter.getJID().isBare());
155 159
160 DiscoInfo capabilities = capsProvider.getCaps(receipient);
161
162 FileTransferOptions options = new FileTransferOptions(config);
163 if (capabilities != null) {
164 if (!capabilities.hasFeature(DiscoInfo.JingleTransportsS5BFeature)) {
165 options = options.withAssistedAllowed(false).withDirectAllowed(false).withProxiedAllowed(false);
166 }
167 if (!capabilities.hasFeature(DiscoInfo.JingleTransportsIBBFeature)) {
168 options = options.withInBandAllowed(false);
169 }
170 }
171 else {
172 logger.warning("No entity capabilities information for "+receipient.toString()+"\n");
173 }
174
156 return outgoingFTManager.createOutgoingFileTransfer(iqRouter.getJID(), receipient, bytestream, fileInfo, config); 175 return outgoingFTManager.createOutgoingFileTransfer(iqRouter.getJID(), receipient, bytestream, fileInfo, config);
157 } 176 }
158 177
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,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013-2015 Isode Limited. 2 * Copyright (c) 2013-2016 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 */
@@ -12,7 +12,7 @@
12package com.isode.stroke.filetransfer; 12package com.isode.stroke.filetransfer;
13 13
14public class FileTransferOptions { 14public class FileTransferOptions {
15 15
16 private boolean allowInBand_; 16 private boolean allowInBand_;
17 private boolean allowAssisted_; 17 private boolean allowAssisted_;
18 private boolean allowProxied_; 18 private boolean allowProxied_;
@@ -25,6 +25,17 @@ public class FileTransferOptions {
25 allowDirect_ = true; 25 allowDirect_ = true;
26 } 26 }
27 27
28 /**
29 * Copy constructor
30 * @param other {@link FileTransferOptions} to copy
31 */
32 public FileTransferOptions(FileTransferOptions other) {
33 this.allowInBand_ = other.allowInBand_;
34 this.allowAssisted_ = other.allowAssisted_;
35 this.allowProxied_ = other.allowProxied_;
36 this.allowDirect_ = other.allowDirect_;
37 }
38
28 public FileTransferOptions withInBandAllowed(boolean b) { 39 public FileTransferOptions withInBandAllowed(boolean b) {
29 allowInBand_ = b; 40 allowInBand_ = b;
30 return this; 41 return this;