From 639c951fd669c54f25aeaf1e328c91040867e52d Mon Sep 17 00:00:00 2001 From: vanitasvitae Date: Fri, 21 Jul 2017 23:05:46 +0200 Subject: [PATCH] Nearly completed work on Jingle SOCKS5 --- .../jivesoftware/smackx/jet/JetManager.java | 8 +- .../jet/element/JetSecurityElement.java | 2 +- .../IncomingJingleFileOffer.java | 6 +- .../JingleFileRequest.java | 2 +- .../JingleFileTransferManager.java | 12 +- .../JingleFileTransferSession.java | 4 +- .../OutgoingJingleFileOffer.java | 6 +- .../jingle_filetransfer/ReceiveTask.java | 2 +- .../smackx/jingle_filetransfer/SendTask.java | 2 +- .../callback/IncomingFileOfferCallback.java | 2 +- .../callback/IncomingFileRequestCallback.java | 2 +- .../jingle_filetransfer/element/Checksum.java | 2 +- .../element/JingleFileTransfer.java | 4 +- .../element/JingleFileTransferChild.java | 2 +- .../handler/FileTransferHandler.java | 2 +- .../JingleFileTransferOfferListener.java | 2 +- .../provider/ChecksumProvider.java | 2 +- .../provider/JingleFileTransferProvider.java | 4 +- .../jingle_filetransfer/ChecksumTest.java | 2 +- .../JingleUtilFileTransferTest.java | 10 +- .../jivesoftware/smackx/jingle/Callback.java | 31 ++ .../FullJidAndSessionId.java | 2 +- .../jingle/JingleDescriptionManager.java | 31 ++ .../{jingle3 => jingle}/JingleManager.java | 46 ++- .../smackx/jingle/JingleSecurityManager.java | 25 ++ .../smackx/jingle/JingleTransportManager.java | 32 ++ .../smackx/{jingle3 => jingle}/Role.java | 2 +- .../adapter/JingleDescriptionAdapter.java | 30 ++ .../jingle/adapter/JingleSecurityAdapter.java | 30 ++ .../adapter/JingleTransportAdapter.java | 30 ++ .../jingle/callbacks/ContentAddCallback.java | 27 ++ .../element/JingleAction.java | 2 +- .../JingleContentDescriptionChildElement.java | 2 +- .../JingleContentDescriptionElement.java | 2 +- .../element/JingleContentElement.java | 2 +- .../element/JingleContentSecurityElement.java | 2 +- .../JingleContentSecurityInfoElement.java | 2 +- ...ingleContentTransportCandidateElement.java | 2 +- .../JingleContentTransportElement.java | 2 +- .../JingleContentTransportInfoElement.java | 2 +- .../element/JingleElement.java | 2 +- .../element/JingleErrorElement.java | 2 +- .../element/JingleReasonElement.java | 2 +- .../element/package-info.java | 2 +- .../UnsupportedDescriptionException.java | 35 +++ .../UnsupportedSecurityException.java | 35 +++ .../UnsupportedTransportException.java | 35 +++ .../{jingle3 => jingle}/internal/Content.java | 36 ++- .../smackx/jingle/internal/Description.java | 39 +++ .../jingle/internal/PendingJingleAction.java | 54 ++++ .../smackx/jingle/internal/Security.java | 43 +++ .../{jingle3 => jingle}/internal/Session.java | 50 ++-- .../internal/Transport.java | 45 +-- .../jingle/internal/TransportCandidate.java | 48 +++ .../smackx/jingle/package-info.java | 2 +- .../JingleContentDescriptionProvider.java | 4 +- .../JingleContentProviderManager.java | 2 +- .../JingleContentSecurityProvider.java | 4 +- .../JingleContentTransportProvider.java | 4 +- .../provider/JingleErrorProvider.java | 4 +- .../provider/JingleProvider.java | 16 +- .../provider/package-info.java | 2 +- .../BytestreamSessionEstablishedListener.java | 30 ++ .../jingle_ibb/JingleIBBTransport.java | 56 +++- .../jingle_ibb/JingleIBBTransportAdapter.java | 37 +++ .../jingle_ibb/JingleIBBTransportManager.java | 40 +++ .../element/JingleIBBTransportElement.java | 6 +- .../jingle_ibb/element/package-info.java | 2 +- .../transport/jingle_ibb/package-info.java | 2 +- .../provider/JingleIBBTransportProvider.java | 12 +- .../jingle_ibb/provider/package-info.java | 2 +- .../jingle_s5b/JingleS5BTransport.java | 86 ++++-- .../jingle_s5b/JingleS5BTransportAdapter.java | 48 +++ .../JingleS5BTransportCandidate.java | 26 +- .../jingle_s5b/JingleS5BTransportManager.java | 280 ++++++++++++++++++ .../JingleS5BTransportCandidateElement.java | 8 +- .../element}/JingleS5BTransportElement.java | 28 +- .../JingleS5BTransportInfoElement.java | 4 +- .../jingle_s5b/element}/package-info.java | 2 +- .../transport/jingle_s5b/package-info.java | 2 +- .../provider/JingleS5BTransportProvider.java | 30 +- .../jingle_s5b/provider/package-info.java | 2 +- .../legacy/JingleS5BTransportSession.java | 57 +--- .../{ => transport/legacy}/JingleUtil.java | 14 +- .../jivesoftware/smackx/jingle3/Callback.java | 15 - .../jingle3/JingleDescriptionManager.java | 15 - .../smackx/jingle3/JingleSecurityManager.java | 9 - .../JingleSessionInitiateListener.java | 10 - .../jingle3/JingleTransportManager.java | 9 - .../adapter/JingleDescriptionAdapter.java | 14 - .../adapter/JingleSecurityAdapter.java | 14 - .../adapter/JingleTransportAdapter.java | 14 - .../jingle3/callbacks/ContentAddCallback.java | 11 - .../UnsupportedDescriptionException.java | 19 -- .../UnsupportedSecurityException.java | 19 -- .../UnsupportedTransportException.java | 19 -- .../smackx/jingle3/internal/Description.java | 23 -- .../jingle3/internal/PendingJingleAction.java | 37 --- .../smackx/jingle3/internal/Security.java | 27 -- .../jingle3/internal/TransportCandidate.java | 32 -- .../BytestreamSessionEstablishedListener.java | 14 - .../jingle_ibb/JingleIBBTransportAdapter.java | 21 -- .../jingle_s5b/JingleS5BTransportAdapter.java | 32 -- .../legacy/JingleS5BTransportManager.java | 233 --------------- .../jingle/FullJidAndSessionIdTest.java | 1 - .../smackx/jingle/JingleActionTest.java | 2 +- .../jingle/JingleContentElementTest.java | 2 +- .../JingleContentProviderManagerTest.java | 6 +- .../smackx/jingle/JingleElementTest.java | 4 +- .../smackx/jingle/JingleErrorElementTest.java | 4 +- .../smackx/jingle/JingleManagerTest.java | 2 +- .../jingle/JingleReasonElementTest.java | 2 +- .../smackx/jingle/JingleSessionTest.java | 7 +- .../JingleTransportMethodManagerTest.java | 12 +- .../smackx/jingle/JingleUtilTest.java | 11 +- .../jingle_s5b/JingleS5BTransportTest.java | 8 +- .../jingle_filetransfer/FileTransferTest.java | 4 +- 117 files changed, 1363 insertions(+), 911 deletions(-) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/Callback.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/FullJidAndSessionId.java (97%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleDescriptionManager.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/JingleManager.java (83%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleSecurityManager.java create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleTransportManager.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/Role.java (94%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleDescriptionAdapter.java create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleSecurityAdapter.java create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleTransportAdapter.java create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/callbacks/ContentAddCallback.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleAction.java (97%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleContentDescriptionChildElement.java (95%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleContentDescriptionElement.java (97%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleContentElement.java (99%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleContentSecurityElement.java (96%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleContentSecurityInfoElement.java (78%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleContentTransportCandidateElement.java (95%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleContentTransportElement.java (98%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleContentTransportInfoElement.java (96%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleElement.java (99%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleErrorElement.java (98%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/JingleReasonElement.java (99%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/element/package-info.java (93%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedDescriptionException.java create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedSecurityException.java create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedTransportException.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/internal/Content.java (81%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Description.java create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/PendingJingleAction.java create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Security.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/internal/Session.java (89%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/internal/Transport.java (62%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/TransportCandidate.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/provider/JingleContentDescriptionProvider.java (88%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/provider/JingleContentProviderManager.java (97%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/provider/JingleContentSecurityProvider.java (76%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/provider/JingleContentTransportProvider.java (88%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/provider/JingleErrorProvider.java (89%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/provider/JingleProvider.java (92%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/provider/package-info.java (93%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/BytestreamSessionEstablishedListener.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_ibb/JingleIBBTransport.java (60%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransportAdapter.java create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransportManager.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_ibb/element/JingleIBBTransportElement.java (89%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_ibb/element/package-info.java (91%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_ibb/package-info.java (92%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_ibb/provider/JingleIBBTransportProvider.java (73%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_ibb/provider/package-info.java (91%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_s5b/JingleS5BTransport.java (62%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportAdapter.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_s5b/JingleS5BTransportCandidate.java (74%) create mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportManager.java rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3/transport/jingle_s5b/elements => jingle/transport/jingle_s5b/element}/JingleS5BTransportCandidateElement.java (94%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3/transport/jingle_s5b/elements => jingle/transport/jingle_s5b/element}/JingleS5BTransportElement.java (81%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3/transport/jingle_s5b/elements => jingle/transport/jingle_s5b/element}/JingleS5BTransportInfoElement.java (97%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3/transport/jingle_s5b/elements => jingle/transport/jingle_s5b/element}/package-info.java (91%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_s5b/package-info.java (92%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_s5b/provider/JingleS5BTransportProvider.java (77%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/jingle_s5b/provider/package-info.java (91%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/{jingle3 => jingle}/transport/legacy/JingleS5BTransportSession.java (87%) rename smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/{ => transport/legacy}/JingleUtil.java (96%) delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/Callback.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/JingleDescriptionManager.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/JingleSecurityManager.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/JingleSessionInitiateListener.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/JingleTransportManager.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleDescriptionAdapter.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleSecurityAdapter.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleTransportAdapter.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/callbacks/ContentAddCallback.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedDescriptionException.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedSecurityException.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedTransportException.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Description.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/PendingJingleAction.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Security.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/TransportCandidate.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/BytestreamSessionEstablishedListener.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/JingleIBBTransportAdapter.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportAdapter.java delete mode 100644 smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/legacy/JingleS5BTransportManager.java diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jet/JetManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jet/JetManager.java index d6abdd642..26c1e131b 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jet/JetManager.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jet/JetManager.java @@ -35,10 +35,10 @@ import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.jet.element.JetSecurityElement; -import org.jivesoftware.smackx.jingle.JingleUtil; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement; +import org.jivesoftware.smackx.jingle.transport.legacy.JingleUtil; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement; import org.jivesoftware.smackx.jingle_filetransfer.OutgoingJingleFileOffer; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jet/element/JetSecurityElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jet/element/JetSecurityElement.java index 96d14c6b5..32c7d9ec9 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jet/element/JetSecurityElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jet/element/JetSecurityElement.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jet.element; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smackx.jet.JetManager; -import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement; +import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement; /** * Implementation of the Jingle security element as specified in XEP-XXXX (Jingle Encrypted Transfers). diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/IncomingJingleFileOffer.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/IncomingJingleFileOffer.java index df7de850d..6fdfc6630 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/IncomingJingleFileOffer.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/IncomingJingleFileOffer.java @@ -26,9 +26,9 @@ import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smackx.bytestreams.BytestreamSession; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback; import org.jivesoftware.smackx.jingle.transports.JingleTransportManager; import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileRequest.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileRequest.java index b701c1aef..2dcddaf26 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileRequest.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileRequest.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.jingle_filetransfer; import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smackx.jingle3.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; import org.jxmpp.jid.FullJid; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileTransferManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileTransferManager.java index d1d4116f4..b66a9e56f 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileTransferManager.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileTransferManager.java @@ -29,12 +29,12 @@ import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; -import org.jivesoftware.smackx.jingle.JingleUtil; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleAction; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement; -import org.jivesoftware.smackx.jingle3.provider.JingleContentProviderManager; +import org.jivesoftware.smackx.jingle.transport.legacy.JingleUtil; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement; +import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager; import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileTransferSession.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileTransferSession.java index 27afb6886..5a8e430e5 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileTransferSession.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/JingleFileTransferSession.java @@ -19,8 +19,8 @@ package org.jivesoftware.smackx.jingle_filetransfer; import java.util.ArrayList; import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smackx.jingle.JingleUtil; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.transport.legacy.JingleUtil; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer; import org.jivesoftware.smackx.jingle_filetransfer.handler.FileTransferHandler; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/OutgoingJingleFileOffer.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/OutgoingJingleFileOffer.java index 3c74f12da..3487ced50 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/OutgoingJingleFileOffer.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/OutgoingJingleFileOffer.java @@ -28,9 +28,9 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smackx.bytestreams.BytestreamSession; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback; import org.jivesoftware.smackx.jingle.transports.JingleTransportManager; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/ReceiveTask.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/ReceiveTask.java index 30b40b700..1dd952a60 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/ReceiveTask.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/ReceiveTask.java @@ -24,7 +24,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.jivesoftware.smackx.bytestreams.BytestreamSession; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/SendTask.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/SendTask.java index e457900cd..a4d9542e7 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/SendTask.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/SendTask.java @@ -25,7 +25,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.jivesoftware.smackx.bytestreams.BytestreamSession; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; /** * Created by vanitas on 21.06.17. diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/callback/IncomingFileOfferCallback.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/callback/IncomingFileOfferCallback.java index ca8020af1..b3e9068fd 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/callback/IncomingFileOfferCallback.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/callback/IncomingFileOfferCallback.java @@ -18,7 +18,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.callback; import java.io.File; -import org.jivesoftware.smackx.jingle3.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; import org.jivesoftware.smackx.jingle_filetransfer.handler.FileTransferHandler; /** diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/callback/IncomingFileRequestCallback.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/callback/IncomingFileRequestCallback.java index 85803a92f..18ecaddf7 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/callback/IncomingFileRequestCallback.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/callback/IncomingFileRequestCallback.java @@ -18,7 +18,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.callback; import java.io.File; -import org.jivesoftware.smackx.jingle3.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; /** * Callback used to accept/decline file requests. diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Checksum.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Checksum.java index 8c8bc2e9e..3d6a004bd 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Checksum.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Checksum.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.element; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.Objects; import org.jivesoftware.smack.util.XmlStringBuilder; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; /** * Checksum element. diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransfer.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransfer.java index e8bdc2921..77149660b 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransfer.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransfer.java @@ -18,8 +18,8 @@ package org.jivesoftware.smackx.jingle_filetransfer.element; import java.util.List; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement; /** * File element. diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java index 08d5084bb..ed20b38d8 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java @@ -21,7 +21,7 @@ import java.util.Date; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smackx.hashes.element.HashElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement; /** * Content of type File. diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/handler/FileTransferHandler.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/handler/FileTransferHandler.java index 274036580..cbd33671d 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/handler/FileTransferHandler.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/handler/FileTransferHandler.java @@ -18,7 +18,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.handler; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; /** * Handler that provides some control over the JingleFileOffer session. diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/listener/JingleFileTransferOfferListener.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/listener/JingleFileTransferOfferListener.java index 6ad36b705..9b8825eb9 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/listener/JingleFileTransferOfferListener.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/listener/JingleFileTransferOfferListener.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.jingle_filetransfer.listener; -import org.jivesoftware.smackx.jingle3.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback; /** diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/ChecksumProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/ChecksumProvider.java index ace17ca99..f34bc7a05 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/ChecksumProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/ChecksumProvider.java @@ -23,7 +23,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smackx.hashes.element.HashElement; import org.jivesoftware.smackx.hashes.provider.HashElementProvider; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; import org.jivesoftware.smackx.jingle_filetransfer.element.Checksum; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild; import org.jivesoftware.smackx.jingle_filetransfer.element.Range; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/JingleFileTransferProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/JingleFileTransferProvider.java index 59ba02f0a..9b4883ae0 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/JingleFileTransferProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/provider/JingleFileTransferProvider.java @@ -24,8 +24,8 @@ import java.util.ArrayList; import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smackx.hashes.element.HashElement; import org.jivesoftware.smackx.hashes.provider.HashElementProvider; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement; -import org.jivesoftware.smackx.jingle3.provider.JingleContentDescriptionProvider; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement; +import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild; import org.jivesoftware.smackx.jingle_filetransfer.element.Range; diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/jingle_filetransfer/ChecksumTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/jingle_filetransfer/ChecksumTest.java index 08d1bae92..f43579360 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/jingle_filetransfer/ChecksumTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/jingle_filetransfer/ChecksumTest.java @@ -22,7 +22,7 @@ import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.TestUtils; import org.jivesoftware.smackx.hashes.HashManager; import org.jivesoftware.smackx.hashes.element.HashElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; import org.jivesoftware.smackx.jingle_filetransfer.element.Checksum; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild; import org.jivesoftware.smackx.jingle_filetransfer.element.Range; diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/jingle_filetransfer/JingleUtilFileTransferTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/jingle_filetransfer/JingleUtilFileTransferTest.java index fb877b5b7..77af11e37 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/jingle_filetransfer/JingleUtilFileTransferTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/jingle_filetransfer/JingleUtilFileTransferTest.java @@ -29,12 +29,12 @@ import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.TestUtils; import org.jivesoftware.smackx.hashes.HashManager; import org.jivesoftware.smackx.hashes.element.HashElement; -import org.jivesoftware.smackx.jingle.JingleUtil; +import org.jivesoftware.smackx.jingle.transport.legacy.JingleUtil; import org.jivesoftware.smackx.jingle.JingleUtilTest; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleAction; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement; import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/Callback.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/Callback.java new file mode 100644 index 000000000..bb0c649f9 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/Callback.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle; + +import org.jivesoftware.smackx.jingle.internal.Content; + +/** + * User callback that the user can use to control a jingle content. + */ +public abstract class Callback { + + private final Content content; + + public Callback(Content content) { + this.content = content; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/FullJidAndSessionId.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/FullJidAndSessionId.java similarity index 97% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/FullJidAndSessionId.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/FullJidAndSessionId.java index 014b650ca..2bd3e7cde 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/FullJidAndSessionId.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/FullJidAndSessionId.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3; +package org.jivesoftware.smackx.jingle; import org.jxmpp.jid.FullJid; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleDescriptionManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleDescriptionManager.java new file mode 100644 index 000000000..e5f22fd70 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleDescriptionManager.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle; + +import org.jivesoftware.smackx.jingle.callbacks.ContentAddCallback; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.internal.Content; + +/** + * Manager for JingleDescription components. + */ +public interface JingleDescriptionManager { + + String getNamespace(); + + JingleElement notifyContentListeners(Content content, ContentAddCallback callback); +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/JingleManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java similarity index 83% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/JingleManager.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java index 60d50dc1e..a479ecbcc 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/JingleManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java @@ -1,4 +1,20 @@ -package org.jivesoftware.smackx.jingle3; +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle; import java.util.ArrayList; import java.util.Collections; @@ -13,24 +29,24 @@ import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler; import org.jivesoftware.smack.iqrequest.IQRequestHandler; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smackx.jingle3.adapter.JingleDescriptionAdapter; -import org.jivesoftware.smackx.jingle3.adapter.JingleSecurityAdapter; -import org.jivesoftware.smackx.jingle3.adapter.JingleTransportAdapter; -import org.jivesoftware.smackx.jingle3.element.JingleAction; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; -import org.jivesoftware.smackx.jingle3.exception.UnsupportedDescriptionException; -import org.jivesoftware.smackx.jingle3.exception.UnsupportedSecurityException; -import org.jivesoftware.smackx.jingle3.exception.UnsupportedTransportException; -import org.jivesoftware.smackx.jingle3.internal.Session; -import org.jivesoftware.smackx.jingle3.provider.JingleContentDescriptionProvider; -import org.jivesoftware.smackx.jingle3.provider.JingleContentSecurityProvider; -import org.jivesoftware.smackx.jingle3.provider.JingleContentTransportProvider; +import org.jivesoftware.smackx.jingle.adapter.JingleDescriptionAdapter; +import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.exception.UnsupportedTransportException; +import org.jivesoftware.smackx.jingle.provider.JingleContentSecurityProvider; +import org.jivesoftware.smackx.jingle.adapter.JingleSecurityAdapter; +import org.jivesoftware.smackx.jingle.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.exception.UnsupportedDescriptionException; +import org.jivesoftware.smackx.jingle.exception.UnsupportedSecurityException; +import org.jivesoftware.smackx.jingle.internal.Session; +import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider; +import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider; import org.jxmpp.jid.FullJid; /** - * Created by vanitas on 18.07.17. + * Manager for Jingle (XEP-0166). */ public class JingleManager extends Manager { private static final WeakHashMap INSTANCES = new WeakHashMap<>(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleSecurityManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleSecurityManager.java new file mode 100644 index 000000000..4637464d2 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleSecurityManager.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle; + +/** + * Manager for JingleSecurity components. + */ +public interface JingleSecurityManager { + + String getNamespace(); +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleTransportManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleTransportManager.java new file mode 100644 index 000000000..502e5d4b1 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleTransportManager.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle; + +import org.jivesoftware.smackx.jingle.internal.Content; +import org.jivesoftware.smackx.jingle.internal.Transport; + +/** + * Manager for JingleTransport components. + */ +public interface JingleTransportManager extends Comparable { + + String getNamespace(); + + Transport createTransport(Content content); + + Transport createTransport(Content content, Transport peersTransport); +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/Role.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/Role.java similarity index 94% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/Role.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/Role.java index 908a22efc..0473b0894 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/Role.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/Role.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3; +package org.jivesoftware.smackx.jingle; public enum Role { initiator, diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleDescriptionAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleDescriptionAdapter.java new file mode 100644 index 000000000..f382780ff --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleDescriptionAdapter.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.adapter; + +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement; +import org.jivesoftware.smackx.jingle.internal.Description; + +/** + * Adapter that creates a Description object from an element. + */ +public interface JingleDescriptionAdapter> { + + D descriptionFromElement(JingleContentDescriptionElement element); + + String getNamespace(); +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleSecurityAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleSecurityAdapter.java new file mode 100644 index 000000000..c2fef71db --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleSecurityAdapter.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.adapter; + +import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement; +import org.jivesoftware.smackx.jingle.internal.Security; + +/** + * Adapter that creates a Security object from an element. + */ +public interface JingleSecurityAdapter> { + + S securityFromElement(JingleContentSecurityElement element); + + String getNamespace(); +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleTransportAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleTransportAdapter.java new file mode 100644 index 000000000..4b485804b --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/adapter/JingleTransportAdapter.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.adapter; + +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.internal.Transport; + +/** + * Adapter that creates a Transport element from an element. + */ +public interface JingleTransportAdapter> { + + T transportFromElement(JingleContentTransportElement element); + + String getNamespace(); +} \ No newline at end of file diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/callbacks/ContentAddCallback.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/callbacks/ContentAddCallback.java new file mode 100644 index 000000000..f9421c78b --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/callbacks/ContentAddCallback.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.callbacks; + +/** + * Callback that gets called when the user accepts a content-add request. + */ +public interface ContentAddCallback { + + void acceptContentAdd(); + + void rejectContentAdd(); +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleAction.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleAction.java similarity index 97% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleAction.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleAction.java index d8be701b9..edd2e8033 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleAction.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleAction.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import java.util.HashMap; import java.util.Map; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentDescriptionChildElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescriptionChildElement.java similarity index 95% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentDescriptionChildElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescriptionChildElement.java index 3fa7ddd06..9a262b72c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentDescriptionChildElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescriptionChildElement.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import org.jivesoftware.smack.packet.NamedElement; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentDescriptionElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescriptionElement.java similarity index 97% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentDescriptionElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescriptionElement.java index 2eeb89edb..dd69abd8d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentDescriptionElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescriptionElement.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import java.util.Collections; import java.util.List; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentElement.java similarity index 99% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentElement.java index bedfce5eb..6df3a0375 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentElement.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import org.jivesoftware.smack.packet.NamedElement; import org.jivesoftware.smack.util.Objects; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentSecurityElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentSecurityElement.java similarity index 96% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentSecurityElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentSecurityElement.java index 711f8372a..8e7befaae 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentSecurityElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentSecurityElement.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import org.jivesoftware.smack.packet.ExtensionElement; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentSecurityInfoElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentSecurityInfoElement.java similarity index 78% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentSecurityInfoElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentSecurityInfoElement.java index 241f69a71..ae7a8cd99 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentSecurityInfoElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentSecurityInfoElement.java @@ -1,4 +1,4 @@ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import org.jivesoftware.smack.packet.NamedElement; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentTransportCandidateElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransportCandidateElement.java similarity index 95% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentTransportCandidateElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransportCandidateElement.java index 0d1b4e322..c35be1d96 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentTransportCandidateElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransportCandidateElement.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import org.jivesoftware.smack.packet.NamedElement; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentTransportElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransportElement.java similarity index 98% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentTransportElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransportElement.java index 159682319..bc1d17899 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentTransportElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransportElement.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import java.util.Collections; import java.util.List; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentTransportInfoElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransportInfoElement.java similarity index 96% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentTransportInfoElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransportInfoElement.java index 37d3ccc22..c866e2bcf 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleContentTransportInfoElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransportInfoElement.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import org.jivesoftware.smack.packet.NamedElement; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleElement.java similarity index 99% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleElement.java index 1590a9e56..8bba68cec 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleElement.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import java.util.ArrayList; import java.util.Collections; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleErrorElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleErrorElement.java similarity index 98% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleErrorElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleErrorElement.java index 03105a727..f3081ab69 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleErrorElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleErrorElement.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import java.util.Locale; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleReasonElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReasonElement.java similarity index 99% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleReasonElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReasonElement.java index 6dabd8ca1..d8629f26a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/JingleReasonElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReasonElement.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; import java.util.HashMap; import java.util.Map; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/package-info.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/package-info.java similarity index 93% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/package-info.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/package-info.java index 1da8411b1..49fdcc362 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/element/package-info.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/package-info.java @@ -18,4 +18,4 @@ /** * Stanzas and Extension Elements for XEP-0166: Jingle. */ -package org.jivesoftware.smackx.jingle3.element; +package org.jivesoftware.smackx.jingle.element; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedDescriptionException.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedDescriptionException.java new file mode 100644 index 000000000..4d8862901 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedDescriptionException.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.exception; + +/** + * Exception that gets thrown when an unknown/unsupported description element is received. + */ +public class UnsupportedDescriptionException extends Exception { + private static final long serialVersionUID = 1L; + + private final String namespace; + + public UnsupportedDescriptionException(String namespace) { + super("Description with namespace " + namespace + " not supported."); + this.namespace = namespace; + } + + public String getNamespace() { + return namespace; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedSecurityException.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedSecurityException.java new file mode 100644 index 000000000..810fd0055 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedSecurityException.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.exception; + +/** + * Exception that gets thrown when an unknown/unsupported security element gets received. + */ +public class UnsupportedSecurityException extends Exception { + private static final long serialVersionUID = 1L; + + private final String namespace; + + public UnsupportedSecurityException(String namespace) { + super("Security with namespace " + namespace + " not supported."); + this.namespace = namespace; + } + + public String getNamespace() { + return namespace; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedTransportException.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedTransportException.java new file mode 100644 index 000000000..f3b64c45e --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/exception/UnsupportedTransportException.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.exception; + +/** + * Exception that gets thrown when an unknown/unsupported transport element gets received. + */ +public class UnsupportedTransportException extends Exception { + private static final long serialVersionUID = 1L; + + private final String namespace; + + public UnsupportedTransportException(String namespace) { + super("Transport with namespace " + namespace + " not supported."); + this.namespace = namespace; + } + + public String getNamespace() { + return namespace; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Content.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Content.java similarity index 81% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Content.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Content.java index ab060984e..7ed0e4171 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Content.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Content.java @@ -1,4 +1,20 @@ -package org.jivesoftware.smackx.jingle3.internal; +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.internal; import java.util.ArrayList; import java.util.Collections; @@ -7,15 +23,15 @@ import java.util.List; import java.util.Set; import org.jivesoftware.smack.util.StringUtils; -import org.jivesoftware.smackx.jingle3.Callback; -import org.jivesoftware.smackx.jingle3.JingleManager; -import org.jivesoftware.smackx.jingle3.adapter.JingleDescriptionAdapter; -import org.jivesoftware.smackx.jingle3.adapter.JingleSecurityAdapter; -import org.jivesoftware.smackx.jingle3.adapter.JingleTransportAdapter; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.JingleManager; +import org.jivesoftware.smackx.jingle.adapter.JingleDescriptionAdapter; +import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement; +import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.Callback; +import org.jivesoftware.smackx.jingle.adapter.JingleSecurityAdapter; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; /** * Internal class that holds the state of a content in a modifiable form. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Description.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Description.java new file mode 100644 index 000000000..f303211da --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Description.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.internal; + +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement; + +/** + * Class that represents a contents description component. + */ +public abstract class Description { + + private Content parent; + + public abstract D getElement(); + + public void setParent(Content parent) { + if (this.parent != parent) { + this.parent = parent; + } + } + + public Content getParent() { + return parent; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/PendingJingleAction.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/PendingJingleAction.java new file mode 100644 index 000000000..3c9997441 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/PendingJingleAction.java @@ -0,0 +1,54 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.internal; + +import org.jivesoftware.smackx.jingle.element.JingleAction; + +/** + * Object that represents a pending jingle action. A pending jingle action is an action that was sent to the peer, + * but a response hasn't yet received. + */ +public abstract class PendingJingleAction { + private final JingleAction action; + private final Content affectedContent; + + public PendingJingleAction(JingleAction action, Content content) { + this.action = action; + this.affectedContent = content; + } + + public JingleAction getAction() { + return action; + } + + public Content getAffectedContent() { + return affectedContent; + } + + public static class TransportReplace extends PendingJingleAction { + private final Transport newTransport; + + public TransportReplace(Content content, Transport newTransport) { + super(JingleAction.transport_replace, content); + this.newTransport = newTransport; + } + + public Transport getNewTransport() { + return newTransport; + } + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Security.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Security.java new file mode 100644 index 000000000..2c982c472 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Security.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.internal; + +import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleContentSecurityInfoElement; + +/** + * Class that represents a contents security component. + */ +public abstract class Security { + + private Content parent; + + public abstract D getElement(); + + public abstract JingleElement handleSecurityInfo(JingleContentSecurityInfoElement element); + + public void setParent(Content parent) { + if (this.parent != parent) { + this.parent = parent; + } + } + + public Content getParent() { + return parent; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Session.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Session.java similarity index 89% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Session.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Session.java index c676c2ad1..bad86988e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Session.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Session.java @@ -1,4 +1,20 @@ -package org.jivesoftware.smackx.jingle3.internal; +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.internal; import java.util.ArrayList; import java.util.Collections; @@ -13,26 +29,26 @@ import java.util.logging.Logger; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smackx.jingle3.JingleDescriptionManager; -import org.jivesoftware.smackx.jingle3.JingleManager; -import org.jivesoftware.smackx.jingle3.Role; -import org.jivesoftware.smackx.jingle3.adapter.JingleTransportAdapter; -import org.jivesoftware.smackx.jingle3.callbacks.ContentAddCallback; -import org.jivesoftware.smackx.jingle3.element.JingleAction; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; -import org.jivesoftware.smackx.jingle3.exception.UnsupportedDescriptionException; -import org.jivesoftware.smackx.jingle3.exception.UnsupportedSecurityException; -import org.jivesoftware.smackx.jingle3.exception.UnsupportedTransportException; +import org.jivesoftware.smackx.jingle.JingleManager; +import org.jivesoftware.smackx.jingle.Role; +import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter; +import org.jivesoftware.smackx.jingle.callbacks.ContentAddCallback; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.exception.UnsupportedDescriptionException; +import org.jivesoftware.smackx.jingle.exception.UnsupportedSecurityException; +import org.jivesoftware.smackx.jingle.exception.UnsupportedTransportException; +import org.jivesoftware.smackx.jingle.JingleDescriptionManager; +import org.jivesoftware.smackx.jingle.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement; import org.jxmpp.jid.FullJid; /** - * Created by vanitas on 17.07.17. + * Class that represents a Jingle session. */ public class Session { private static final Logger LOGGER = Logger.getLogger(Session.class.getName()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Transport.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Transport.java similarity index 62% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Transport.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Transport.java index f2b0300a1..481dbc5c5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Transport.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/Transport.java @@ -1,17 +1,32 @@ -package org.jivesoftware.smackx.jingle3.internal; +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.internal; import java.util.ArrayList; import java.util.List; +import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement; -import org.jivesoftware.smackx.jingle3.transport.BytestreamSessionEstablishedListener; - -import org.jxmpp.jid.FullJid; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.transport.BytestreamSessionEstablishedListener; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement; /** - * Created by vanitas on 18.07.17. + * Class that represents a contents transport component. */ public abstract class Transport { @@ -21,10 +36,6 @@ public abstract class Transport { private Transport peersProposal; private boolean isPeersProposal; - public Transport(Content content) { - this.parent = content; - } - public abstract D getElement(); public void addCandidate(TransportCandidate candidate) { @@ -60,15 +71,11 @@ public abstract class Transport { public abstract String getNamespace(); - public abstract void establishIncomingBytestreamSession(FullJid peer, - String transportSessionId, - BytestreamSessionEstablishedListener listener, - XMPPConnection connection); + public abstract void establishIncomingBytestreamSession(BytestreamSessionEstablishedListener listener, + XMPPConnection connection) throws SmackException.NotConnectedException, InterruptedException; - public abstract void establishOutgoingBytestreamSession(FullJid peer, - String transportSessionId, - BytestreamSessionEstablishedListener listener, - XMPPConnection connection); + public abstract void establishOutgoingBytestreamSession(BytestreamSessionEstablishedListener listener, + XMPPConnection connection) throws SmackException.NotConnectedException, InterruptedException; public void setPeersProposal(Transport peersProposal) { this.peersProposal = peersProposal; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/TransportCandidate.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/TransportCandidate.java new file mode 100644 index 000000000..392ef008d --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/internal/TransportCandidate.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.internal; + +import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement; + +/** + * Class that represents a transports candidate component. + */ +public abstract class TransportCandidate { + + private Transport parent; + private int priority; + + public void setParent(Transport transport) { + if (parent != transport) { + parent = transport; + } + } + + public Transport getParent() { + return parent; + } + + public int getPriority() { + return priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } + + public abstract E getElement(); +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/package-info.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/package-info.java index 2e7a2ec90..cfdd289cd 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/package-info.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/package-info.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus + * Copyright 2017 Florian Schmaus, Paul Schaub * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentDescriptionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentDescriptionProvider.java similarity index 88% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentDescriptionProvider.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentDescriptionProvider.java index aafb3122d..54efceee6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentDescriptionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentDescriptionProvider.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.provider; +package org.jivesoftware.smackx.jingle.provider; import org.jivesoftware.smack.provider.ExtensionElementProvider; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement; import org.xmlpull.v1.XmlPullParser; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentProviderManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentProviderManager.java similarity index 97% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentProviderManager.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentProviderManager.java index c876fc22d..3c0939950 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentProviderManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentProviderManager.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.provider; +package org.jivesoftware.smackx.jingle.provider; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentSecurityProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentSecurityProvider.java similarity index 76% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentSecurityProvider.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentSecurityProvider.java index e4dfdbefc..09613dc73 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentSecurityProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentSecurityProvider.java @@ -1,7 +1,7 @@ -package org.jivesoftware.smackx.jingle3.provider; +package org.jivesoftware.smackx.jingle.provider; import org.jivesoftware.smack.provider.ExtensionElementProvider; -import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement; +import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement; import org.xmlpull.v1.XmlPullParser; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentTransportProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentTransportProvider.java similarity index 88% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentTransportProvider.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentTransportProvider.java index 942e36b35..43d131fed 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleContentTransportProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleContentTransportProvider.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.provider; +package org.jivesoftware.smackx.jingle.provider; import org.jivesoftware.smack.provider.ExtensionElementProvider; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; import org.xmlpull.v1.XmlPullParser; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleErrorProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleErrorProvider.java similarity index 89% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleErrorProvider.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleErrorProvider.java index f02d43ff6..fff184ada 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleErrorProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleErrorProvider.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.provider; +package org.jivesoftware.smackx.jingle.provider; import org.jivesoftware.smack.provider.ExtensionElementProvider; -import org.jivesoftware.smackx.jingle3.element.JingleErrorElement; +import org.jivesoftware.smackx.jingle.element.JingleErrorElement; import org.xmlpull.v1.XmlPullParser; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java similarity index 92% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleProvider.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java index 1e83de5ff..a89c453bb 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/JingleProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java @@ -14,20 +14,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.provider; +package org.jivesoftware.smackx.jingle.provider; import java.util.logging.Logger; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.ParserUtils; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleAction; -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement.Reason; +import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement.Reason; import org.jxmpp.jid.FullJid; import org.xmlpull.v1.XmlPullParser; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/package-info.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/package-info.java similarity index 93% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/package-info.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/package-info.java index 394cd2f3f..feb0e8d86 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/provider/package-info.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/package-info.java @@ -18,4 +18,4 @@ /** * Providers and parsers for XEP-0166: Jingle. */ -package org.jivesoftware.smackx.jingle3.provider; +package org.jivesoftware.smackx.jingle.provider; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/BytestreamSessionEstablishedListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/BytestreamSessionEstablishedListener.java new file mode 100644 index 000000000..b0f306318 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/BytestreamSessionEstablishedListener.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.transport; + +import org.jivesoftware.smackx.bytestreams.BytestreamSession; + +/** + * Listener that can be registered to get notified about established Bytestreams. + */ +public interface BytestreamSessionEstablishedListener { + + void onBytestreamSessionEstablished(BytestreamSession session); + + void onBytestreamSessionFailed(Exception exception); + +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/JingleIBBTransport.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransport.java similarity index 60% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/JingleIBBTransport.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransport.java index 76794c294..47dd7d31c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/JingleIBBTransport.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransport.java @@ -1,4 +1,20 @@ -package org.jivesoftware.smackx.jingle3.transport.jingle_ibb; +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.transport.jingle_ibb; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPConnection; @@ -8,16 +24,15 @@ import org.jivesoftware.smackx.bytestreams.BytestreamListener; import org.jivesoftware.smackx.bytestreams.BytestreamRequest; import org.jivesoftware.smackx.bytestreams.BytestreamSession; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement; -import org.jivesoftware.smackx.jingle3.internal.Transport; -import org.jivesoftware.smackx.jingle3.internal.TransportCandidate; -import org.jivesoftware.smackx.jingle3.transport.BytestreamSessionEstablishedListener; -import org.jivesoftware.smackx.jingle3.transport.jingle_ibb.element.JingleIBBTransportElement; - -import org.jxmpp.jid.FullJid; +import org.jivesoftware.smackx.jingle.internal.Transport; +import org.jivesoftware.smackx.jingle.internal.TransportCandidate; +import org.jivesoftware.smackx.jingle.transport.BytestreamSessionEstablishedListener; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement; +import org.jivesoftware.smackx.jingle.internal.Session; +import org.jivesoftware.smackx.jingle.transport.jingle_ibb.element.JingleIBBTransportElement; /** - * Created by vanitas on 18.07.17. + * Jingle InBandBytestream Transport component. */ public class JingleIBBTransport extends Transport { @@ -36,6 +51,14 @@ public class JingleIBBTransport extends Transport { this(StringUtils.randomString(10), JingleIBBTransportElement.DEFAULT_BLOCK_SIZE); } + public Short getBlockSize() { + return blockSize; + } + + public String getSid() { + return streamId; + } + @Override public JingleIBBTransportElement getElement() { return new JingleIBBTransportElement(streamId, blockSize); @@ -47,13 +70,14 @@ public class JingleIBBTransport extends Transport { } @Override - public void establishIncomingBytestreamSession(final FullJid peer, final String transportSessionId, final BytestreamSessionEstablishedListener listener, XMPPConnection connection) { + public void establishIncomingBytestreamSession(final BytestreamSessionEstablishedListener listener, final XMPPConnection connection) { + final Session session = getParent().getParent(); InBandBytestreamManager.getByteStreamManager(connection) .addIncomingBytestreamListener(new BytestreamListener() { @Override public void incomingBytestreamRequest(BytestreamRequest request) { - if (request.getFrom().asFullJidIfPossible().equals(peer) - && request.getSessionID().equals(transportSessionId)) { + if (request.getFrom().asFullJidIfPossible().equals(session.getPeer()) + && request.getSessionID().equals(getSid())) { BytestreamSession bytestreamSession; try { @@ -69,12 +93,13 @@ public class JingleIBBTransport extends Transport { } @Override - public void establishOutgoingBytestreamSession(FullJid peer, String transportSessionId, BytestreamSessionEstablishedListener listener, XMPPConnection connection) { + public void establishOutgoingBytestreamSession(BytestreamSessionEstablishedListener listener, XMPPConnection connection) { + Session session = getParent().getParent(); InBandBytestreamManager inBandBytestreamManager = InBandBytestreamManager.getByteStreamManager(connection); inBandBytestreamManager.setDefaultBlockSize(blockSize); try { - BytestreamSession session = inBandBytestreamManager.establishSession(peer, transportSessionId); - listener.onBytestreamSessionEstablished(session); + BytestreamSession bytestreamSession = inBandBytestreamManager.establishSession(session.getPeer(), getSid()); + listener.onBytestreamSessionEstablished(bytestreamSession); } catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | InterruptedException | SmackException.NotConnectedException e) { listener.onBytestreamSessionFailed(e); } @@ -88,6 +113,5 @@ public class JingleIBBTransport extends Transport { @Override public void handleTransportInfo(JingleContentTransportInfoElement info) { // Nothing to do. - } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransportAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransportAdapter.java new file mode 100644 index 000000000..f6e601d5d --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransportAdapter.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.transport.jingle_ibb; + +import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_ibb.element.JingleIBBTransportElement; + +/** + * Adapter for Jingle InBandBytestream transports. + */ +public class JingleIBBTransportAdapter implements JingleTransportAdapter { + @Override + public JingleIBBTransport transportFromElement(JingleContentTransportElement element) { + JingleIBBTransportElement transport = (JingleIBBTransportElement) element; + return new JingleIBBTransport(transport.getSid(), transport.getBlockSize()); + } + + @Override + public String getNamespace() { + return JingleIBBTransport.NAMESPACE; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransportManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransportManager.java new file mode 100644 index 000000000..aeec2d30f --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/JingleIBBTransportManager.java @@ -0,0 +1,40 @@ +package org.jivesoftware.smackx.jingle.transport.jingle_ibb; + +import org.jivesoftware.smack.Manager; +import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smackx.jingle.JingleTransportManager; +import org.jivesoftware.smackx.jingle.internal.Content; +import org.jivesoftware.smackx.jingle.internal.Transport; + +/** + * Created by vanitas on 21.07.17. + */ +public class JingleIBBTransportManager extends Manager implements JingleTransportManager { + + public static final short MAX_BLOCKSIZE = 8192; + + private JingleIBBTransportManager(XMPPConnection connection) { + super(connection); + } + + @Override + public String getNamespace() { + return JingleIBBTransport.NAMESPACE; + } + + @Override + public Transport createTransport(Content content) { + return new JingleIBBTransport(); + } + + @Override + public Transport createTransport(Content content, Transport peersTransport) { + JingleIBBTransport other = (JingleIBBTransport) peersTransport; + return new JingleIBBTransport(other.getSid(), (short) Math.min(other.getBlockSize(), MAX_BLOCKSIZE)); + } + + @Override + public int compareTo(JingleTransportManager manager) { + return 0; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/element/JingleIBBTransportElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/element/JingleIBBTransportElement.java similarity index 89% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/element/JingleIBBTransportElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/element/JingleIBBTransportElement.java index f0d909d4f..0ccb91599 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/element/JingleIBBTransportElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/element/JingleIBBTransportElement.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_ibb.element; +package org.jivesoftware.smackx.jingle.transport.jingle_ibb.element; import org.jivesoftware.smack.util.XmlStringBuilder; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_ibb.JingleIBBTransport; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_ibb.JingleIBBTransport; /** * Transport Element for JingleInBandBytestream transports. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/element/package-info.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/element/package-info.java similarity index 91% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/element/package-info.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/element/package-info.java index 6117ffa32..144290cb3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/element/package-info.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/element/package-info.java @@ -19,4 +19,4 @@ * Smack's API for XEP-0261: Jingle In-Band Bytestreams. * Element classes. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_ibb.element; +package org.jivesoftware.smackx.jingle.transport.jingle_ibb.element; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/package-info.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/package-info.java similarity index 92% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/package-info.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/package-info.java index b956ee167..71fc7d0f7 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/package-info.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/package-info.java @@ -18,4 +18,4 @@ /** * Smack's API for XEP-0261: Jingle In-Band Bytestreams. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_ibb; +package org.jivesoftware.smackx.jingle.transport.jingle_ibb; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/provider/JingleIBBTransportProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/provider/JingleIBBTransportProvider.java similarity index 73% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/provider/JingleIBBTransportProvider.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/provider/JingleIBBTransportProvider.java index 5563c2b40..015f4ff16 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/provider/JingleIBBTransportProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/provider/JingleIBBTransportProvider.java @@ -14,24 +14,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_ibb.provider; +package org.jivesoftware.smackx.jingle.transport.jingle_ibb.provider; import org.jivesoftware.smack.util.ParserUtils; -import org.jivesoftware.smackx.jingle3.provider.JingleContentTransportProvider; -import org.jivesoftware.smackx.jingle3.transport.jingle_ibb.JingleIBBTransport; -import org.jivesoftware.smackx.jingle3.transport.jingle_ibb.element.JingleIBBTransportElement; +import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider; +import org.jivesoftware.smackx.jingle.transport.jingle_ibb.JingleIBBTransport; +import org.jivesoftware.smackx.jingle.transport.jingle_ibb.element.JingleIBBTransportElement; import org.xmlpull.v1.XmlPullParser; /** * Parse JingleByteStreamTransport elements. */ -public class JingleIBBTransportProvider extends JingleContentTransportProvider { +public class JingleIBBTransportProvider extends JingleContentTransportProvider { @Override public JingleIBBTransportElement parse(XmlPullParser parser, int initialDepth) throws Exception { Short blockSize = ParserUtils.getShortAttribute(parser, JingleIBBTransportElement.ATTR_BLOCK_SIZE); String sid = parser.getAttributeValue(null, JingleIBBTransportElement.ATTR_SID); - return new JingleIBBTransportElement(blockSize, sid); + return new JingleIBBTransportElement(sid, blockSize); } @Override diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/provider/package-info.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/provider/package-info.java similarity index 91% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/provider/package-info.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/provider/package-info.java index 85381f0c6..6cb217eb6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/provider/package-info.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_ibb/provider/package-info.java @@ -19,4 +19,4 @@ * Smack's API for XEP-0261: Jingle In-Band Bytestreams. * Provider classes. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_ibb.provider; +package org.jivesoftware.smackx.jingle.transport.jingle_ibb.provider; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransport.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransport.java similarity index 62% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransport.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransport.java index 3f5969582..39a12f6dc 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransport.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransport.java @@ -1,4 +1,20 @@ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b; +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.transport.jingle_s5b; import java.io.IOException; import java.util.Collections; @@ -9,29 +25,30 @@ import java.util.concurrent.TimeoutException; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy; import org.jivesoftware.smackx.bytestreams.socks5.Socks5Utils; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement; -import org.jivesoftware.smackx.jingle3.internal.Content; -import org.jivesoftware.smackx.jingle3.internal.Transport; -import org.jivesoftware.smackx.jingle3.internal.TransportCandidate; -import org.jivesoftware.smackx.jingle3.transport.BytestreamSessionEstablishedListener; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportInfoElement; +import org.jivesoftware.smackx.jingle.transport.BytestreamSessionEstablishedListener; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportInfoElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement; +import org.jivesoftware.smackx.jingle.internal.Content; +import org.jivesoftware.smackx.jingle.internal.Transport; +import org.jivesoftware.smackx.jingle.internal.TransportCandidate; import org.jxmpp.jid.FullJid; /** - * Created by vanitas on 19.07.17. + * Jingle SOCKS5Bytestream transport component. */ public class JingleS5BTransport extends Transport { public static final String NAMESPACE_V1 = "urn:xmpp:jingle:transports:s5b:1"; public static final String NAMESPACE = NAMESPACE_V1; + public static final int MAX_TIMEOUT = 10 * 1000; + private final String sid; private String dstAddr; @@ -42,22 +59,25 @@ public class JingleS5BTransport extends Transport { /** * Create fresh JingleS5BTransport. - * @param content parent content. + * @param initiator initiator. + * @param responder responder. */ - public JingleS5BTransport(Content content) { - super(content); - this.sid = StringUtils.randomString(24); - this.dstAddr = Socks5Utils.createDigest(sid, content.getParent().getInitiator(), content.getParent().getResponder()); - this.mode = Bytestream.Mode.tcp; + public JingleS5BTransport(FullJid initiator, FullJid responder, String sid, List> candidates) { + this(sid, Socks5Utils.createDigest(sid, initiator, responder), Bytestream.Mode.tcp, candidates); } - public JingleS5BTransport(Content content, String sid, String dstAddr, Bytestream.Mode mode, List candidates) { - super(content); + public JingleS5BTransport(Content content, JingleS5BTransport other, List> candidates) { + this(other.getSid(), + Socks5Utils.createDigest(other.getSid(), content.getParent().getInitiator(), content.getParent().getResponder()), + other.mode, candidates); + } + + public JingleS5BTransport(String sid, String dstAddr, Bytestream.Mode mode, List> candidates) { this.sid = sid; this.dstAddr = dstAddr; this.mode = mode; - for (TransportCandidate c : (candidates != null ? + for (TransportCandidate c : (candidates != null ? candidates : Collections.emptySet())) { addCandidate(c); } @@ -77,6 +97,10 @@ public class JingleS5BTransport extends Transport { return builder.build(); } + public String getSid() { + return sid; + } + public String getDstAddr() { return dstAddr; } @@ -91,12 +115,27 @@ public class JingleS5BTransport extends Transport { } @Override - public void establishIncomingBytestreamSession(FullJid peer, String transportSessionId, BytestreamSessionEstablishedListener listener, XMPPConnection connection) { - Socks5Proxy.getSocks5Proxy().addTransfer(dstAddr); + public void establishIncomingBytestreamSession(BytestreamSessionEstablishedListener listener, XMPPConnection connection) + throws SmackException.NotConnectedException, InterruptedException { + establishBytestreamSession(listener, connection); } @Override - public void establishOutgoingBytestreamSession(FullJid peer, String transportSessionId, BytestreamSessionEstablishedListener listener, XMPPConnection connection) { + public void establishOutgoingBytestreamSession(BytestreamSessionEstablishedListener listener, XMPPConnection connection) + throws SmackException.NotConnectedException, InterruptedException { + establishBytestreamSession(listener, connection); + } + + void establishBytestreamSession(BytestreamSessionEstablishedListener listener, XMPPConnection connection) + throws SmackException.NotConnectedException, InterruptedException { + Socks5Proxy.getSocks5Proxy().addTransfer(dstAddr); + JingleS5BTransportManager transportManager = JingleS5BTransportManager.getInstanceFor(connection); + this.selectedCandidate = connectToCandidates(MAX_TIMEOUT); + + if (selectedCandidate == null) { + connection.createStanzaCollectorAndSend(transportManager.createCandidateError(this)); + } + } @@ -150,7 +189,6 @@ public class JingleS5BTransport extends Transport { } Iterator> ourCandidates = getCandidates().iterator(); - while (ourCandidates.hasNext()) { JingleS5BTransportCandidate candidate = (JingleS5BTransportCandidate) ourCandidates.next(); if (candidate.getCandidateId().equals(candidateId)) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportAdapter.java new file mode 100644 index 000000000..debeda7a2 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportAdapter.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.transport.jingle_s5b; + +import java.util.ArrayList; + +import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement; + +/** + * Adapter for Jingle SOCKS5Bytestream components. + */ +public class JingleS5BTransportAdapter implements JingleTransportAdapter { + + @Override + public JingleS5BTransport transportFromElement(JingleContentTransportElement element) { + JingleS5BTransportElement s5b = (JingleS5BTransportElement) element; + ArrayList candidates = new ArrayList<>(); + + for (JingleContentTransportCandidateElement e : element.getCandidates()) { + candidates.add(JingleS5BTransportCandidate.fromElement((JingleS5BTransportCandidateElement) e)); + } + + return new JingleS5BTransport(s5b.getSid(), s5b.getDestinationAddress(), s5b.getMode(), candidates); + } + + @Override + public String getNamespace() { + return JingleS5BTransport.NAMESPACE; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportCandidate.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportCandidate.java similarity index 74% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportCandidate.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportCandidate.java index 95f725632..9281191ef 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportCandidate.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportCandidate.java @@ -1,4 +1,20 @@ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b; +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.transport.jingle_s5b; import java.io.IOException; import java.net.Socket; @@ -9,12 +25,12 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smackx.bytestreams.socks5.Socks5Client; import org.jivesoftware.smackx.bytestreams.socks5.Socks5ClientForInitiator; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; -import org.jivesoftware.smackx.jingle3.internal.Session; -import org.jivesoftware.smackx.jingle3.internal.TransportCandidate; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement; +import org.jivesoftware.smackx.jingle.internal.Session; +import org.jivesoftware.smackx.jingle.internal.TransportCandidate; /** - * Created by vanitas on 19.07.17. + * Jingle SOCKS5Bytestream transport candidate. */ public class JingleS5BTransportCandidate extends TransportCandidate { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportManager.java new file mode 100644 index 000000000..5feacb177 --- /dev/null +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/JingleS5BTransportManager.java @@ -0,0 +1,280 @@ +/** + * + * Copyright 2017 Paul Schaub + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.jingle.transport.jingle_s5b; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.WeakHashMap; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.jivesoftware.smack.ConnectionListener; +import org.jivesoftware.smack.Manager; +import org.jivesoftware.smack.SmackException; +import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smack.XMPPException; +import org.jivesoftware.smack.packet.IQ; +import org.jivesoftware.smack.util.StringUtils; +import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager; +import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy; +import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.internal.Content; +import org.jivesoftware.smackx.jingle.internal.Session; +import org.jivesoftware.smackx.jingle.internal.Transport; +import org.jivesoftware.smackx.jingle.internal.TransportCandidate; +import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportInfoElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.provider.JingleS5BTransportProvider; +import org.jivesoftware.smackx.jingle.JingleTransportManager; +import org.jivesoftware.smackx.jingle.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; + +import org.jxmpp.jid.Jid; + +/** + * Manager for Jingle SOCKS5 Bytestream transports (XEP-0261). + */ +public final class JingleS5BTransportManager extends Manager implements JingleTransportManager { + + private static final Logger LOGGER = Logger.getLogger(JingleS5BTransportManager.class.getName()); + private final Socks5BytestreamManager socks5BytestreamManager = Socks5BytestreamManager.getBytestreamManager(connection()); + + private static final WeakHashMap INSTANCES = new WeakHashMap<>(); + + private List localStreamHosts = null; + private List availableStreamHosts = null; + + private static boolean useLocalCandidates = true; + private static boolean useExternalCandidates = true; + + private JingleS5BTransportManager(XMPPConnection connection) { + super(connection); + JingleContentProviderManager.addJingleContentTransportProvider(getNamespace(), new JingleS5BTransportProvider()); + connection.addConnectionListener(new ConnectionListener() { + + @Override + public void connected(XMPPConnection connection) { + } + + @Override + public void authenticated(XMPPConnection connection, boolean resumed) { + if (connection.equals(connection())) { + try { + Socks5Proxy socks5Proxy = Socks5Proxy.getSocks5Proxy(); + if (!socks5Proxy.isRunning()) { + socks5Proxy.start(); + } + localStreamHosts = queryLocalStreamHosts(); + availableStreamHosts = queryAvailableStreamHosts(); + } catch (InterruptedException | SmackException.NoResponseException | SmackException.NotConnectedException | XMPPException.XMPPErrorException e) { + LOGGER.log(Level.WARNING, "Could not query available StreamHosts: " + e, e); + } + } + } + + @Override + public void connectionClosed() { + Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy(); + if (proxy.isRunning()) { + Socks5Proxy.getSocks5Proxy().stop(); + } + } + + @Override + public void connectionClosedOnError(Exception e) { + } + + @Override + public void reconnectionSuccessful() { + } + + @Override + public void reconnectingIn(int seconds) { + } + + @Override + public void reconnectionFailed(Exception e) { + } + }); + } + + public static JingleS5BTransportManager getInstanceFor(XMPPConnection connection) { + JingleS5BTransportManager manager = INSTANCES.get(connection); + if (manager == null) { + manager = new JingleS5BTransportManager(connection); + INSTANCES.put(connection, manager); + } + return manager; + } + + @Override + public String getNamespace() { + return JingleS5BTransport.NAMESPACE; + } + + @Override + public Transport createTransport(Content content) { + Session session = content.getParent(); + List> candidates = collectCandidates(); + return new JingleS5BTransport(session.getInitiator(), session.getResponder(), StringUtils.randomString(24), candidates); + } + + @Override + public Transport createTransport(Content content, Transport peersTransport) { + JingleS5BTransport transport = (JingleS5BTransport) peersTransport; + List> candidates = collectCandidates(); + return new JingleS5BTransport(content, transport, candidates); + } + + private List> collectCandidates() { + List> candidates = new ArrayList<>(); + + //Local host + if (JingleS5BTransportManager.isUseLocalCandidates()) { + for (Bytestream.StreamHost host : getLocalStreamHosts()) { + candidates.add(new JingleS5BTransportCandidate(StringUtils.randomString(16), host, 100, JingleS5BTransportCandidateElement.Type.direct)); + } + } + + List remoteHosts = Collections.emptyList(); + if (JingleS5BTransportManager.isUseExternalCandidates()) { + try { + remoteHosts = getAvailableStreamHosts(); + } catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) { + LOGGER.log(Level.WARNING, "Could not determine available StreamHosts.", e); + } + } + + for (Bytestream.StreamHost host : remoteHosts) { + candidates.add(new JingleS5BTransportCandidate(StringUtils.randomString(16), host, 0, JingleS5BTransportCandidateElement.Type.proxy)); + } + + return candidates; + } + + private List queryAvailableStreamHosts() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException { + List proxies = socks5BytestreamManager.determineProxies(); + return determineStreamHostInfo(proxies); + } + + private List queryLocalStreamHosts() { + return socks5BytestreamManager.getLocalStreamHost(); + } + + public List getAvailableStreamHosts() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException { + if (availableStreamHosts == null) { + availableStreamHosts = queryAvailableStreamHosts(); + } + return availableStreamHosts; + } + + public List getLocalStreamHosts() { + if (localStreamHosts == null) { + localStreamHosts = queryLocalStreamHosts(); + } + return localStreamHosts; + } + + public List determineStreamHostInfo(List proxies) { + List streamHosts = new ArrayList<>(); + + Iterator iterator = proxies.iterator(); + while (iterator.hasNext()) { + Jid proxy = iterator.next(); + Bytestream request = new Bytestream(); + request.setType(IQ.Type.get); + request.setTo(proxy); + + try { + Bytestream response = connection().createStanzaCollectorAndSend(request).nextResultOrThrow(); + streamHosts.addAll(response.getStreamHosts()); + } + catch (Exception e) { + iterator.remove(); + } + } + + return streamHosts; + } + + private JingleElement createTransportInfo(JingleS5BTransport transport, JingleS5BTransportInfoElement info) { + Content content = transport.getParent(); + Session session = content.getParent(); + + JingleElement.Builder jb = JingleElement.getBuilder() + .setSessionId(session.getSessionId()) + .setInitiator(session.getInitiator()) + .setAction(JingleAction.transport_info); + + JingleContentElement.Builder cb = JingleContentElement.getBuilder() + .setCreator(content.getCreator()) + .setName(content.getName()) + .setSenders(content.getSenders()); + + JingleS5BTransportElement.Builder tb = JingleS5BTransportElement.getBuilder() + .setTransportInfo(info) + .setStreamId(transport.getSid()); + + JingleElement jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build(); + jingle.setFrom(session.getOurJid()); + jingle.setTo(session.getPeer()); + + return jingle; + } + + JingleElement createCandidateUsed(JingleS5BTransport transport, JingleS5BTransportCandidate candidate) { + return createTransportInfo(transport, JingleS5BTransportInfoElement.CandidateUsed(candidate.getCandidateId())); + } + + JingleElement createCandidateError(JingleS5BTransport transport) { + return createTransportInfo(transport, JingleS5BTransportInfoElement.CandidateError()); + } + + JingleElement createProxyError(JingleS5BTransport transport) { + return createTransportInfo(transport, JingleS5BTransportInfoElement.ProxyError()); + } + + JingleElement createCandidateActivated(JingleS5BTransport transport, JingleS5BTransportCandidate candidate) { + return createTransportInfo(transport, JingleS5BTransportInfoElement.CandidateActivated(candidate.getCandidateId())); + } + + public static void setUseLocalCandidates(boolean localCandidates) { + JingleS5BTransportManager.useLocalCandidates = localCandidates; + } + + public static void setUseExternalCandidates(boolean externalCandidates) { + JingleS5BTransportManager.useExternalCandidates = externalCandidates; + } + + public static boolean isUseLocalCandidates() { + return useLocalCandidates; + } + + public static boolean isUseExternalCandidates() { + return useExternalCandidates; + } + + @Override + public int compareTo(JingleTransportManager manager) { + return 0; + } +} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/JingleS5BTransportCandidateElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/JingleS5BTransportCandidateElement.java similarity index 94% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/JingleS5BTransportCandidateElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/JingleS5BTransportCandidateElement.java index a72e68872..778ba38cb 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/JingleS5BTransportCandidateElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/JingleS5BTransportCandidateElement.java @@ -14,15 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements; - -import java.util.logging.Logger; +package org.jivesoftware.smackx.jingle.transport.jingle_s5b.element; import org.jivesoftware.smack.util.Objects; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportCandidateElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement; import org.jxmpp.jid.Jid; import org.jxmpp.jid.impl.JidCreate; @@ -33,8 +31,6 @@ import org.jxmpp.stringprep.XmppStringprepException; */ public final class JingleS5BTransportCandidateElement extends JingleContentTransportCandidateElement { - private static final Logger LOGGER = Logger.getLogger(JingleS5BTransportCandidateElement.class.getName()); - public static final String ATTR_CID = "cid"; public static final String ATTR_HOST = "host"; public static final String ATTR_JID = "jid"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/JingleS5BTransportElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/JingleS5BTransportElement.java similarity index 81% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/JingleS5BTransportElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/JingleS5BTransportElement.java index 9fe6fea57..38d0390a9 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/JingleS5BTransportElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/JingleS5BTransportElement.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements; +package org.jivesoftware.smackx.jingle.transport.jingle_s5b.element; import java.util.ArrayList; import java.util.List; @@ -22,15 +22,15 @@ import java.util.List; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportCandidateElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.JingleS5BTransport; /** * Socks5Bytestream transport element. */ public class JingleS5BTransportElement extends JingleContentTransportElement { - public static final String NAMESPACE_V1 = "urn:xmpp:jingle:transports:s5b:1"; public static final String ATTR_DSTADDR = "dstaddr"; public static final String ATTR_MODE = "mode"; public static final String ATTR_SID = "sid"; @@ -61,7 +61,7 @@ public class JingleS5BTransportElement extends JingleContentTransportElement { @Override public String getNamespace() { - return NAMESPACE_V1; + return JingleS5BTransport.NAMESPACE; } @Override @@ -132,22 +132,6 @@ public class JingleS5BTransportElement extends JingleContentTransportElement { return this; } - public Builder setCandidateUsed(String candidateId) { - return setTransportInfo(JingleS5BTransportInfoElement.CandidateUsed(candidateId)); - } - - public Builder setCandidateActivated(String candidateId) { - return setTransportInfo(JingleS5BTransportInfoElement.CandidateActivated(candidateId)); - } - - public Builder setCandidateError() { - return setTransportInfo(JingleS5BTransportInfoElement.CandidateError()); - } - - public Builder setProxyError() { - return setTransportInfo(JingleS5BTransportInfoElement.ProxyError()); - } - public JingleS5BTransportElement build() { return new JingleS5BTransportElement(streamId, candidates, info, dstAddr, mode); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/JingleS5BTransportInfoElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/JingleS5BTransportInfoElement.java similarity index 97% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/JingleS5BTransportInfoElement.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/JingleS5BTransportInfoElement.java index d8074113a..007873c6c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/JingleS5BTransportInfoElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/JingleS5BTransportInfoElement.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements; +package org.jivesoftware.smackx.jingle.transport.jingle_s5b.element; import org.jivesoftware.smack.util.XmlStringBuilder; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement; /** * Class representing possible SOCKS5 TransportInfo elements. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/package-info.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/package-info.java similarity index 91% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/package-info.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/package-info.java index 2b1e70fa1..3abe10b33 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/elements/package-info.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/element/package-info.java @@ -19,4 +19,4 @@ * Smack's API for XEP-0260: Jingle SOCKS5 Bytestreams. * Element classes. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements; +package org.jivesoftware.smackx.jingle.transport.jingle_s5b.element; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/package-info.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/package-info.java similarity index 92% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/package-info.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/package-info.java index a975c7fea..122da3101 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/package-info.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/package-info.java @@ -18,4 +18,4 @@ /** * Smack's API for XEP-0260: Jingle SOCKS5 Bytestreams. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b; +package org.jivesoftware.smackx.jingle.transport.jingle_s5b; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/provider/JingleS5BTransportProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/provider/JingleS5BTransportProvider.java similarity index 77% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/provider/JingleS5BTransportProvider.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/provider/JingleS5BTransportProvider.java index 2be2c95e6..f9e04d419 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/provider/JingleS5BTransportProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/jingle_s5b/provider/JingleS5BTransportProvider.java @@ -14,24 +14,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.provider; +package org.jivesoftware.smackx.jingle.transport.jingle_s5b.provider; import static org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.Mode.tcp; import static org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.Mode.udp; -import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_CID; -import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_HOST; -import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_JID; -import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_PORT; -import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_PRIORITY; -import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_TYPE; +import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_CID; +import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_HOST; +import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_JID; +import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_PORT; +import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_PRIORITY; +import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_TYPE; import static org.xmlpull.v1.XmlPullParser.END_TAG; import static org.xmlpull.v1.XmlPullParser.START_TAG; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.provider.JingleContentTransportProvider; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportInfoElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.JingleS5BTransport; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportInfoElement; import org.xmlpull.v1.XmlPullParser; @@ -115,4 +116,9 @@ public class JingleS5BTransportProvider extends JingleContentTransportProviderXEP-0260: Jingle SOCKS5 Bytestreams. * Provider classes. */ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.provider; +package org.jivesoftware.smackx.jingle.transport.jingle_s5b.provider; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/legacy/JingleS5BTransportSession.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/legacy/JingleS5BTransportSession.java similarity index 87% rename from smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/legacy/JingleS5BTransportSession.java rename to smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/legacy/JingleS5BTransportSession.java index 353a00d99..e19faf05a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/legacy/JingleS5BTransportSession.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transport/legacy/JingleS5BTransportSession.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.jingle3.transport.legacy; +package org.jivesoftware.smackx.jingle.transport.legacy; import java.io.IOException; import java.net.Socket; @@ -35,14 +35,14 @@ import org.jivesoftware.smackx.bytestreams.socks5.Socks5Utils; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback; import org.jivesoftware.smackx.jingle.transports.JingleTransportSession; -import org.jivesoftware.smackx.jingle3.JingleManager; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportCandidateElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportInfoElement; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.JingleS5BTransportManager; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportInfoElement; /** * Handler that handles Jingle Socks5Bytestream transports (XEP-0260). @@ -50,27 +50,6 @@ import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTr public class JingleS5BTransportSession extends JingleTransportSession { private static final Logger LOGGER = Logger.getLogger(JingleS5BTransportSession.class.getName()); - private JingleTransportInitiationCallback callback; - - public JingleS5BTransportSession(JingleSession jingleSession) { - super(jingleSession); - } - - private UsedCandidate ourChoice, theirChoice; - - @Override - public JingleS5BTransportElement createTransport() { - if (ourProposal == null) { - ourProposal = createTransport(JingleManager.randomId(), Bytestream.Mode.tcp); - } - return ourProposal; - } - - @Override - public void setTheirProposal(JingleContentTransportElement transport) { - theirProposal = (JingleS5BTransportElement) transport; - } - public JingleS5BTransportElement createTransport(String sid, Bytestream.Mode mode) { JingleS5BTransportElement.Builder jb = JingleS5BTransportElement.getBuilder() .setStreamId(sid).setMode(mode).setDestinationAddress( @@ -339,22 +318,4 @@ public class JingleS5BTransportSession extends JingleTransportSession { - - String getNamespace(); -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleDescriptionAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleDescriptionAdapter.java deleted file mode 100644 index 3cab18247..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleDescriptionAdapter.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jivesoftware.smackx.jingle3.adapter; - -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement; -import org.jivesoftware.smackx.jingle3.internal.Description; - -/** - * Created by vanitas on 18.07.17. - */ -public interface JingleDescriptionAdapter> { - - D descriptionFromElement(JingleContentDescriptionElement element); - - String getNamespace(); -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleSecurityAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleSecurityAdapter.java deleted file mode 100644 index 84ad49fe8..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleSecurityAdapter.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jivesoftware.smackx.jingle3.adapter; - -import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement; -import org.jivesoftware.smackx.jingle3.internal.Security; - -/** - * Created by vanitas on 18.07.17. - */ -public interface JingleSecurityAdapter> { - - S securityFromElement(JingleContentSecurityElement element); - - String getNamespace(); -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleTransportAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleTransportAdapter.java deleted file mode 100644 index 4f3a20fc6..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/adapter/JingleTransportAdapter.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jivesoftware.smackx.jingle3.adapter; - -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.internal.Transport; - -/** - * Created by vanitas on 18.07.17. - */ -public interface JingleTransportAdapter> { - - T transportFromElement(JingleContentTransportElement element); - - String getNamespace(); -} \ No newline at end of file diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/callbacks/ContentAddCallback.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/callbacks/ContentAddCallback.java deleted file mode 100644 index fb4759174..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/callbacks/ContentAddCallback.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jivesoftware.smackx.jingle3.callbacks; - -/** - * Created by vanitas on 19.07.17. - */ -public interface ContentAddCallback { - - void acceptContentAdd(); - - void rejectContentAdd(); -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedDescriptionException.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedDescriptionException.java deleted file mode 100644 index 6bdf965df..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedDescriptionException.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jivesoftware.smackx.jingle3.exception; - -/** - * Created by vanitas on 18.07.17. - */ -public class UnsupportedDescriptionException extends Exception { - private static final long serialVersionUID = 1L; - - private final String namespace; - - public UnsupportedDescriptionException(String namespace) { - super("Description with namespace " + namespace + " not supported."); - this.namespace = namespace; - } - - public String getNamespace() { - return namespace; - } -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedSecurityException.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedSecurityException.java deleted file mode 100644 index e78216848..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedSecurityException.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jivesoftware.smackx.jingle3.exception; - -/** - * Created by vanitas on 18.07.17. - */ -public class UnsupportedSecurityException extends Exception { - private static final long serialVersionUID = 1L; - - private final String namespace; - - public UnsupportedSecurityException(String namespace) { - super("Security with namespace " + namespace + " not supported."); - this.namespace = namespace; - } - - public String getNamespace() { - return namespace; - } -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedTransportException.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedTransportException.java deleted file mode 100644 index a7e69fede..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/exception/UnsupportedTransportException.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jivesoftware.smackx.jingle3.exception; - -/** - * Created by vanitas on 18.07.17. - */ -public class UnsupportedTransportException extends Exception { - private static final long serialVersionUID = 1L; - - private final String namespace; - - public UnsupportedTransportException(String namespace) { - super("Transport with namespace " + namespace + " not supported."); - this.namespace = namespace; - } - - public String getNamespace() { - return namespace; - } -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Description.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Description.java deleted file mode 100644 index 1c04b967c..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Description.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jivesoftware.smackx.jingle3.internal; - -import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement; - -/** - * Created by vanitas on 18.07.17. - */ -public abstract class Description { - - private Content parent; - - public abstract D getElement(); - - public void setParent(Content parent) { - if (this.parent != parent) { - this.parent = parent; - } - } - - public Content getParent() { - return parent; - } -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/PendingJingleAction.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/PendingJingleAction.java deleted file mode 100644 index d9206ecd5..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/PendingJingleAction.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jivesoftware.smackx.jingle3.internal; - -import org.jivesoftware.smackx.jingle3.element.JingleAction; - -/** - * Created by vanitas on 19.07.17. - */ -public abstract class PendingJingleAction { - private final JingleAction action; - private final Content affectedContent; - - public PendingJingleAction(JingleAction action, Content content) { - this.action = action; - this.affectedContent = content; - } - - public JingleAction getAction() { - return action; - } - - public Content getAffectedContent() { - return affectedContent; - } - - public static class TransportReplace extends PendingJingleAction { - private final Transport newTransport; - - public TransportReplace(Content content, Transport newTransport) { - super(JingleAction.transport_replace, content); - this.newTransport = newTransport; - } - - public Transport getNewTransport() { - return newTransport; - } - } -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Security.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Security.java deleted file mode 100644 index 2917a9409..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/Security.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jivesoftware.smackx.jingle3.internal; - -import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityInfoElement; - -/** - * Created by vanitas on 18.07.17. - */ -public abstract class Security { - - private Content parent; - - public abstract D getElement(); - - public abstract JingleElement handleSecurityInfo(JingleContentSecurityInfoElement element); - - public void setParent(Content parent) { - if (this.parent != parent) { - this.parent = parent; - } - } - - public Content getParent() { - return parent; - } -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/TransportCandidate.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/TransportCandidate.java deleted file mode 100644 index 77b586705..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/internal/TransportCandidate.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jivesoftware.smackx.jingle3.internal; - -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportCandidateElement; - -/** - * Created by vanitas on 21.07.17. - */ -public abstract class TransportCandidate { - - private Transport parent; - private int priority; - - public void setParent(Transport transport) { - if (parent != transport) { - parent = transport; - } - } - - public Transport getParent() { - return parent; - } - - public int getPriority() { - return priority; - } - - public void setPriority(int priority) { - this.priority = priority; - } - - public abstract E getElement(); -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/BytestreamSessionEstablishedListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/BytestreamSessionEstablishedListener.java deleted file mode 100644 index a8492f8ec..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/BytestreamSessionEstablishedListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jivesoftware.smackx.jingle3.transport; - -import org.jivesoftware.smackx.bytestreams.BytestreamSession; - -/** - * Created by vanitas on 18.07.17. - */ -public interface BytestreamSessionEstablishedListener { - - void onBytestreamSessionEstablished(BytestreamSession session); - - void onBytestreamSessionFailed(Exception exception); - -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/JingleIBBTransportAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/JingleIBBTransportAdapter.java deleted file mode 100644 index 3e55cf433..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_ibb/JingleIBBTransportAdapter.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jivesoftware.smackx.jingle3.transport.jingle_ibb; - -import org.jivesoftware.smackx.jingle3.adapter.JingleTransportAdapter; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_ibb.element.JingleIBBTransportElement; - -/** - * Created by vanitas on 18.07.17. - */ -public class JingleIBBTransportAdapter implements JingleTransportAdapter { - @Override - public JingleIBBTransport transportFromElement(JingleContentTransportElement element) { - JingleIBBTransportElement transport = (JingleIBBTransportElement) element; - return new JingleIBBTransport(transport.getSid(), transport.getBlockSize()); - } - - @Override - public String getNamespace() { - return JingleIBBTransport.NAMESPACE; - } -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportAdapter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportAdapter.java deleted file mode 100644 index 365892554..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportAdapter.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jivesoftware.smackx.jingle3.transport.jingle_s5b; - -import java.util.ArrayList; - -import org.jivesoftware.smackx.jingle3.adapter.JingleTransportAdapter; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportCandidateElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement; - -/** - * Created by vanitas on 19.07.17. - */ -public class JingleS5BTransportAdapter implements JingleTransportAdapter { - - @Override - public JingleS5BTransport transportFromElement(JingleContentTransportElement element) { - JingleS5BTransportElement s5b = (JingleS5BTransportElement) element; - ArrayList candidates = new ArrayList<>(); - - for (JingleContentTransportCandidateElement e : element.getCandidates()) { - candidates.add(JingleS5BTransportCandidate.fromElement((JingleS5BTransportCandidateElement) e)); - } - - return new JingleS5BTransport(s5b.getSid(), s5b.getDestinationAddress(), s5b.getMode(), candidates); - } - - @Override - public String getNamespace() { - return JingleS5BTransport.NAMESPACE; - } -} diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/legacy/JingleS5BTransportManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/legacy/JingleS5BTransportManager.java deleted file mode 100644 index 45d291ea5..000000000 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle3/transport/legacy/JingleS5BTransportManager.java +++ /dev/null @@ -1,233 +0,0 @@ -/** - * - * Copyright 2017 Paul Schaub - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jivesoftware.smackx.jingle3.transport.legacy; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.WeakHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager; -import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy; -import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleAction; -import org.jivesoftware.smackx.jingle3.provider.JingleContentProviderManager; -import org.jivesoftware.smackx.jingle.transports.JingleTransportManager; -import org.jivesoftware.smackx.jingle.transports.JingleTransportSession; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.provider.JingleS5BTransportProvider; - -import org.jxmpp.jid.FullJid; -import org.jxmpp.jid.Jid; - -/** - * Manager for Jingle SOCKS5 Bytestream transports (XEP-0261). - */ -public final class JingleS5BTransportManager extends JingleTransportManager { - - private static final Logger LOGGER = Logger.getLogger(JingleS5BTransportManager.class.getName()); - - private static final WeakHashMap INSTANCES = new WeakHashMap<>(); - - private List localStreamHosts = null; - private List availableStreamHosts = null; - - private static boolean useLocalCandidates = true; - private static boolean useExternalCandidates = true; - - private JingleS5BTransportManager(XMPPConnection connection) { - super(connection); - JingleContentProviderManager.addJingleContentTransportProvider(getNamespace(), new JingleS5BTransportProvider()); - } - - public static JingleS5BTransportManager getInstanceFor(XMPPConnection connection) { - JingleS5BTransportManager manager = INSTANCES.get(connection); - if (manager == null) { - manager = new JingleS5BTransportManager(connection); - INSTANCES.put(connection, manager); - } - return manager; - } - - @Override - public String getNamespace() { - return JingleS5BTransportElement.NAMESPACE_V1; - } - - @Override - public JingleTransportSession transportSession(JingleSession jingleSession) { - return new JingleS5BTransportSession(jingleSession); - } - - private List queryAvailableStreamHosts() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException { - Socks5BytestreamManager s5m = Socks5BytestreamManager.getBytestreamManager(getConnection()); - List proxies = s5m.determineProxies(); - return determineStreamHostInfo(proxies); - } - - private List queryLocalStreamHosts() { - return Socks5BytestreamManager.getBytestreamManager(getConnection()) - .getLocalStreamHost(); - } - - public List getAvailableStreamHosts() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException { - if (availableStreamHosts == null) { - availableStreamHosts = queryAvailableStreamHosts(); - } - return availableStreamHosts; - } - - public List getLocalStreamHosts() { - if (localStreamHosts == null) { - localStreamHosts = queryLocalStreamHosts(); - } - return localStreamHosts; - } - - public List determineStreamHostInfo(List proxies) { - XMPPConnection connection = getConnection(); - List streamHosts = new ArrayList<>(); - - Iterator iterator = proxies.iterator(); - while (iterator.hasNext()) { - Jid proxy = iterator.next(); - Bytestream request = new Bytestream(); - request.setType(IQ.Type.get); - request.setTo(proxy); - try { - Bytestream response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow(); - streamHosts.addAll(response.getStreamHosts()); - } - catch (Exception e) { - iterator.remove(); - } - } - - return streamHosts; - } - - - @Override - public void authenticated(XMPPConnection connection, boolean resumed) { - if (!resumed) try { - Socks5Proxy socks5Proxy = Socks5Proxy.getSocks5Proxy(); - if (!socks5Proxy.isRunning()) { - socks5Proxy.start(); - } - localStreamHosts = queryLocalStreamHosts(); - availableStreamHosts = queryAvailableStreamHosts(); - } catch (InterruptedException | SmackException.NoResponseException | SmackException.NotConnectedException | XMPPException.XMPPErrorException e) { - LOGGER.log(Level.WARNING, "Could not query available StreamHosts: " + e, e); - } - } - - public JingleElement createCandidateUsed(FullJid recipient, FullJid initiator, String sessionId, JingleContentElement.Senders contentSenders, - JingleContentElement.Creator contentCreator, String contentName, String streamId, - String candidateId) { - JingleElement.Builder jb = JingleElement.getBuilder(); - jb.setSessionId(sessionId).setInitiator(initiator).setAction(JingleAction.transport_info); - - JingleContentElement.Builder cb = JingleContentElement.getBuilder(); - cb.setName(contentName).setCreator(contentCreator).setSenders(contentSenders); - - JingleS5BTransportElement.Builder tb = JingleS5BTransportElement.getBuilder(); - tb.setCandidateUsed(candidateId).setStreamId(streamId); - - JingleElement jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build(); - jingle.setFrom(getConnection().getUser().asFullJidOrThrow()); - jingle.setTo(recipient); - - return jingle; - } - - public JingleElement createCandidateError(FullJid remote, FullJid initiator, String sessionId, JingleContentElement.Senders senders, JingleContentElement.Creator creator, String name, String streamId) { - JingleElement.Builder jb = JingleElement.getBuilder(); - jb.setSessionId(sessionId).setInitiator(initiator).setAction(JingleAction.transport_info); - - JingleContentElement.Builder cb = JingleContentElement.getBuilder(); - cb.setName(name).setCreator(creator).setSenders(senders); - - JingleS5BTransportElement.Builder tb = JingleS5BTransportElement.getBuilder(); - tb.setCandidateError().setStreamId(streamId); - - JingleElement jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build(); - jingle.setFrom(getConnection().getUser().asFullJidOrThrow()); - jingle.setTo(remote); - - return jingle; - } - - public JingleElement createProxyError(FullJid remote, FullJid initiator, String sessionId, - JingleContentElement.Senders senders, JingleContentElement.Creator creator, - String name, String streamId) { - JingleElement.Builder jb = JingleElement.getBuilder(); - jb.setSessionId(sessionId).setAction(JingleAction.transport_info).setInitiator(initiator); - - JingleContentElement.Builder cb = JingleContentElement.getBuilder(); - cb.setSenders(senders).setCreator(creator).setName(name); - - JingleS5BTransportElement.Builder tb = JingleS5BTransportElement.getBuilder(); - tb.setStreamId(sessionId).setProxyError().setStreamId(streamId); - - JingleElement jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build(); - jingle.setTo(remote); - jingle.setFrom(getConnection().getUser().asFullJidOrThrow()); - return jingle; - } - - public JingleElement createCandidateActivated(FullJid remote, FullJid initiator, String sessionId, - JingleContentElement.Senders senders, JingleContentElement.Creator creator, - String name, String streamId, String candidateId) { - JingleElement.Builder jb = JingleElement.getBuilder(); - jb.setInitiator(initiator).setSessionId(sessionId).setAction(JingleAction.transport_info); - - JingleContentElement.Builder cb = JingleContentElement.getBuilder(); - cb.setName(name).setCreator(creator).setSenders(senders); - - JingleS5BTransportElement.Builder tb = JingleS5BTransportElement.getBuilder(); - tb.setStreamId(streamId).setCandidateActivated(candidateId); - - JingleElement jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build(); - jingle.setFrom(getConnection().getUser().asFullJidOrThrow()); - jingle.setTo(remote); - return jingle; - } - - public static void setUseLocalCandidates(boolean localCandidates) { - JingleS5BTransportManager.useLocalCandidates = localCandidates; - } - - public static void setUseExternalCandidates(boolean externalCandidates) { - JingleS5BTransportManager.useExternalCandidates = externalCandidates; - } - - public static boolean isUseLocalCandidates() { - return useLocalCandidates; - } - - public static boolean isUseExternalCandidates() { - return useExternalCandidates; - } -} diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/FullJidAndSessionIdTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/FullJidAndSessionIdTest.java index a4dac4657..ce8060330 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/FullJidAndSessionIdTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/FullJidAndSessionIdTest.java @@ -21,7 +21,6 @@ import static junit.framework.TestCase.assertNotSame; import static junit.framework.TestCase.assertTrue; import org.jivesoftware.smack.test.util.SmackTestSuite; -import org.jivesoftware.smackx.jingle3.FullJidAndSessionId; import org.junit.Test; import org.jxmpp.jid.FullJid; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleActionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleActionTest.java index a5ae679ef..e43e78e57 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleActionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleActionTest.java @@ -20,7 +20,7 @@ import static junit.framework.TestCase.assertEquals; import org.jivesoftware.smack.test.util.SmackTestSuite; -import org.jivesoftware.smackx.jingle3.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleAction; import org.junit.Test; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentElementTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentElementTest.java index a6d9e6f27..b76f07bc2 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentElementTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentElementTest.java @@ -22,7 +22,7 @@ import static junit.framework.TestCase.assertNotSame; import static junit.framework.TestCase.assertNull; import org.jivesoftware.smack.test.util.SmackTestSuite; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; import org.junit.Test; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentProviderManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentProviderManagerTest.java index a8473c5c3..92eea2bf0 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentProviderManagerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentProviderManagerTest.java @@ -20,11 +20,11 @@ import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertNull; import org.jivesoftware.smack.test.util.SmackTestSuite; -import org.jivesoftware.smackx.jingle3.provider.JingleContentProviderManager; +import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager; import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport; import org.jivesoftware.smackx.jingle.transports.jingle_ibb.provider.JingleIBBTransportProvider; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.provider.JingleS5BTransportProvider; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.provider.JingleS5BTransportProvider; import org.junit.Test; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleElementTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleElementTest.java index 1cea1b493..80efecb87 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleElementTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleElementTest.java @@ -22,8 +22,8 @@ import static junit.framework.TestCase.assertTrue; import org.jivesoftware.smack.test.util.SmackTestSuite; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleAction; import org.junit.Test; import org.jxmpp.jid.FullJid; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleErrorElementTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleErrorElementTest.java index 8f4c0c8a3..5fdc7bb37 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleErrorElementTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleErrorElementTest.java @@ -20,8 +20,8 @@ import static junit.framework.TestCase.assertEquals; import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.TestUtils; -import org.jivesoftware.smackx.jingle3.element.JingleErrorElement; -import org.jivesoftware.smackx.jingle3.provider.JingleErrorProvider; +import org.jivesoftware.smackx.jingle.element.JingleErrorElement; +import org.jivesoftware.smackx.jingle.provider.JingleErrorProvider; import org.junit.Test; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java index ad4bcb76b..63d1282bb 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java @@ -25,7 +25,7 @@ import org.jivesoftware.smack.DummyConnection; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.test.util.SmackTestSuite; -import org.jivesoftware.smackx.jingle3.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; import org.junit.Test; import org.jxmpp.jid.FullJid; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleReasonElementTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleReasonElementTest.java index 666ee0a2e..a3ccc50af 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleReasonElementTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleReasonElementTest.java @@ -20,7 +20,7 @@ import static junit.framework.TestCase.assertEquals; import org.jivesoftware.smack.test.util.SmackTestSuite; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; import org.junit.Test; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleSessionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleSessionTest.java index cc178f6e3..f0b2609e4 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleSessionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleSessionTest.java @@ -28,10 +28,9 @@ import org.jivesoftware.smack.DummyConnection; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.TestIQ; -import org.jivesoftware.smackx.jingle3.FullJidAndSessionId; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleAction; import org.jivesoftware.smackx.jingle.transports.jingle_ibb.JingleIBBTransportSession; import org.junit.Test; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleTransportMethodManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleTransportMethodManagerTest.java index fbc3a9ff9..96289b4a1 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleTransportMethodManagerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleTransportMethodManagerTest.java @@ -27,16 +27,16 @@ import java.util.Set; import org.jivesoftware.smack.DummyConnection; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.test.util.SmackTestSuite; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleAction; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement; import org.jivesoftware.smackx.jingle.transports.JingleTransportManager; import org.jivesoftware.smackx.jingle.transports.JingleTransportSession; import org.jivesoftware.smackx.jingle.transports.jingle_ibb.JingleIBBTransportManager; import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport; -import org.jivesoftware.smackx.jingle3.transport.legacy.JingleS5BTransportManager; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.JingleS5BTransportManager; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement; import org.junit.Test; import org.jxmpp.jid.impl.JidCreate; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleUtilTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleUtilTest.java index bdea5846f..2729492c7 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleUtilTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleUtilTest.java @@ -28,12 +28,13 @@ import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.TestUtils; -import org.jivesoftware.smackx.jingle3.element.JingleContentElement; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleAction; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; -import org.jivesoftware.smackx.jingle3.provider.JingleProvider; +import org.jivesoftware.smackx.jingle.element.JingleContentElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleAction; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.provider.JingleProvider; import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport; +import org.jivesoftware.smackx.jingle.transport.legacy.JingleUtil; import org.junit.Before; import org.junit.Test; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportTest.java index dae75dfba..762514a48 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle3/transport/jingle_s5b/JingleS5BTransportTest.java @@ -26,10 +26,10 @@ import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.TestUtils; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportInfoElement; -import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.provider.JingleS5BTransportProvider; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportInfoElement; +import org.jivesoftware.smackx.jingle.transport.jingle_s5b.provider.JingleS5BTransportProvider; import org.junit.Test; import org.jxmpp.jid.FullJid; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/FileTransferTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/FileTransferTest.java index 1d244c116..4b7e8dfdf 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/FileTransferTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/FileTransferTest.java @@ -28,8 +28,8 @@ import java.util.logging.Level; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy; -import org.jivesoftware.smackx.jingle3.element.JingleElement; -import org.jivesoftware.smackx.jingle3.element.JingleReasonElement; +import org.jivesoftware.smackx.jingle.element.JingleElement; +import org.jivesoftware.smackx.jingle.element.JingleReasonElement; import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback; import org.jivesoftware.smackx.jingle_filetransfer.handler.FileTransferHandler; import org.jivesoftware.smackx.jingle_filetransfer.listener.JingleFileTransferOfferListener;