From e9ed818dac91e280eb8da86dc8494710f1da0624 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Tue, 1 Dec 2015 12:13:58 +0100 Subject: Only calculate S5B candidates if supported by recipient Test-Information: Tested against a Swift instance which does not advertise the DiscoInfo::JingleTransportsS5BFeature feature and verified via debug console that only the IBB feature is listed in the candidates. Change-Id: I708c437f5c30c16c3478fd3448d7cb9592e68677 diff --git a/Swiften/FileTransfer/FileTransferManagerImpl.cpp b/Swiften/FileTransfer/FileTransferManagerImpl.cpp index 9dc9d0d..f4b4202 100644 --- a/Swiften/FileTransfer/FileTransferManagerImpl.cpp +++ b/Swiften/FileTransfer/FileTransferManagerImpl.cpp @@ -165,7 +165,22 @@ OutgoingFileTransfer::ref FileTransferManagerImpl::createOutgoingFileTransfer( assert(!iqRouter->getJID().isBare()); - return outgoingFTManager->createOutgoingFileTransfer(iqRouter->getJID(), receipient, bytestream, fileInfo, config); + DiscoInfo::ref capabilities = capsProvider->getCaps(receipient); + + FileTransferOptions options = config; + if (capabilities) { + if (!capabilities->hasFeature(DiscoInfo::JingleTransportsS5BFeature)) { + options = options.withAssistedAllowed(false).withDirectAllowed(false).withProxiedAllowed(false); + } + if (!capabilities->hasFeature(DiscoInfo::JingleTransportsIBBFeature)) { + options = options.withInBandAllowed(false); + } + } + else { + SWIFT_LOG(warning) << "No entity capabilities information for " << receipient.toString() << std::endl; + } + + return outgoingFTManager->createOutgoingFileTransfer(iqRouter->getJID(), receipient, bytestream, fileInfo, options); } } -- cgit v0.10.2-6-g49f6