diff options
author | Tobias Markmann <tm@ayena.de> | 2015-12-01 11:13:58 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2015-12-17 11:54:56 (GMT) |
commit | e9ed818dac91e280eb8da86dc8494710f1da0624 (patch) | |
tree | 824180920c45f20d64c19f6776c67d8472d4c1cc | |
parent | a8d25e85e5ce27b1c26d5675d0a9c927c73583c5 (diff) | |
download | swift-e9ed818dac91e280eb8da86dc8494710f1da0624.zip swift-e9ed818dac91e280eb8da86dc8494710f1da0624.tar.bz2 |
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
-rw-r--r-- | Swiften/FileTransfer/FileTransferManagerImpl.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
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); } } |