mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
Temp
This commit is contained in:
parent
59e79ef668
commit
7658369d63
26 changed files with 268 additions and 356 deletions
|
@ -271,6 +271,11 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
return attribute(name, String.valueOf(value));
|
return attribute(name, String.valueOf(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XmlStringBuilder attribute(String name, long value) {
|
||||||
|
assert name != null;
|
||||||
|
return attribute(name, String.valueOf(value));
|
||||||
|
}
|
||||||
|
|
||||||
public XmlStringBuilder optAttribute(String name, String value) {
|
public XmlStringBuilder optAttribute(String name, String value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
attribute(name, value);
|
attribute(name, value);
|
||||||
|
@ -278,6 +283,13 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XmlStringBuilder optAttribute(String name, Long value) {
|
||||||
|
if (value != null) {
|
||||||
|
attribute(name, value);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new attribute to this builder, with the {@link java.util.Date} instance as its value,
|
* Add a new attribute to this builder, with the {@link java.util.Date} instance as its value,
|
||||||
* which will get formated with {@link XmppDateTime#formatXEP0082Date(Date)}
|
* which will get formated with {@link XmppDateTime#formatXEP0082Date(Date)}
|
||||||
|
|
|
@ -33,8 +33,8 @@ import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
import org.jivesoftware.smack.Manager;
|
import org.jivesoftware.smack.Manager;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.Element;
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
|
import org.jivesoftware.smackx.jet.element.JetSecurityElement;
|
||||||
import org.jivesoftware.smackx.jingle.JingleManager;
|
import org.jivesoftware.smackx.jingle.JingleManager;
|
||||||
import org.jivesoftware.smackx.jingle.JingleUtil;
|
import org.jivesoftware.smackx.jingle.JingleUtil;
|
||||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||||
|
@ -140,14 +140,25 @@ public final class JetManager extends Manager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String contentName = JingleManager.randomId();
|
||||||
|
|
||||||
ExtensionElement encryptionExtension = encryptionMethod.encryptJingleTransfer(recipient, keyAndIv);
|
ExtensionElement encryptionExtension = encryptionMethod.encryptJingleTransfer(recipient, keyAndIv);
|
||||||
|
JetSecurityElement securityElement = new JetSecurityElement(contentName, encryptionExtension);
|
||||||
|
|
||||||
OutgoingJingleFileOffer offer = new OutgoingJingleFileOffer(connection(), recipient);
|
OutgoingJingleFileOffer offer = new OutgoingJingleFileOffer(connection(), recipient);
|
||||||
|
|
||||||
JingleFileTransferChild fileTransferChild = JingleFileTransferChild.getBuilder().setFile(file).build();
|
JingleFileTransferChild fileTransferChild = JingleFileTransferChild.getBuilder().setFile(file).build();
|
||||||
JingleFileTransfer fileTransfer = new JingleFileTransfer(Collections.<JingleContentDescriptionChildElement>singletonList(fileTransferChild));
|
JingleFileTransfer fileTransfer = new JingleFileTransfer(Collections.<JingleContentDescriptionChildElement>singletonList(fileTransferChild));
|
||||||
Jingle initiate = jutil.createSessionInitiateFileOffer(recipient, JingleManager.randomId(), JingleContent.Creator.initiator,
|
|
||||||
JingleManager.randomId(), fileTransfer, offer.getTransportSession().createTransport(), Collections.<Element>singletonList(encryptionExtension));
|
JingleContent content = JingleContent.getBuilder()
|
||||||
|
.setCreator(JingleContent.Creator.initiator)
|
||||||
|
.setName(contentName)
|
||||||
|
.setTransport(offer.getTransportSession().createTransport())
|
||||||
|
.setSecurity(securityElement)
|
||||||
|
.setDescription(fileTransfer)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Jingle initiate = jutil.createSessionInitiate(recipient, JingleManager.randomId(), content);
|
||||||
return offer;
|
return offer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 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.jet;
|
package org.jivesoftware.smackx.jet;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -19,28 +19,30 @@ package org.jivesoftware.smackx.jet.element;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
import org.jivesoftware.smackx.jet.JetManager;
|
import org.jivesoftware.smackx.jet.JetManager;
|
||||||
|
import org.jivesoftware.smackx.jingle.element.JingleContentSecurity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Jingle security element as specified in XEP-XXXX (Jingle Encrypted Transfers).
|
* Implementation of the Jingle security element as specified in XEP-XXXX (Jingle Encrypted Transfers).
|
||||||
|
* <jingle>
|
||||||
|
* <content>
|
||||||
|
* <description/>
|
||||||
|
* <transport/>
|
||||||
|
* <security/> <- You are here.
|
||||||
|
* </content>
|
||||||
|
* </jingle>
|
||||||
*/
|
*/
|
||||||
public class SecurityElement implements ExtensionElement {
|
public class JetSecurityElement extends JingleContentSecurity {
|
||||||
public static final String ELEMENT = "security";
|
|
||||||
public static final String ATTR_NAME = "name";
|
public static final String ATTR_NAME = "name";
|
||||||
public static final String ATTR_TYPE = "type";
|
public static final String ATTR_TYPE = "type";
|
||||||
|
|
||||||
private final ExtensionElement child;
|
private final ExtensionElement child;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public SecurityElement(String name, ExtensionElement child) {
|
public JetSecurityElement(String name, ExtensionElement child) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.child = child;
|
this.child = child;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getElementName() {
|
|
||||||
return ELEMENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML() {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
|
@ -24,20 +24,20 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smackx.jet.JetManager;
|
import org.jivesoftware.smackx.jet.JetManager;
|
||||||
import org.jivesoftware.smackx.jet.JingleEncryptionMethodManager;
|
import org.jivesoftware.smackx.jet.JingleEncryptionMethodManager;
|
||||||
import org.jivesoftware.smackx.jet.element.SecurityElement;
|
import org.jivesoftware.smackx.jet.element.JetSecurityElement;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provider for the Jingle security element for XEP-XXXX (Jingle Encrypted Transfers).
|
* Provider for the Jingle security element for XEP-XXXX (Jingle Encrypted Transfers).
|
||||||
*/
|
*/
|
||||||
public class SecurityProvider extends ExtensionElementProvider<SecurityElement> {
|
public class JetSecurityProvider extends ExtensionElementProvider<JetSecurityElement> {
|
||||||
private static final Logger LOGGER = Logger.getLogger(SecurityProvider.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(JetSecurityProvider.class.getName());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SecurityElement parse(XmlPullParser parser, int initialDepth) throws Exception {
|
public JetSecurityElement parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||||
String name = parser.getAttributeValue(JetManager.NAMESPACE, SecurityElement.ATTR_NAME);
|
String name = parser.getAttributeValue(JetManager.NAMESPACE, JetSecurityElement.ATTR_NAME);
|
||||||
String type = parser.getAttributeValue(JetManager.NAMESPACE, SecurityElement.ATTR_TYPE);
|
String type = parser.getAttributeValue(JetManager.NAMESPACE, JetSecurityElement.ATTR_TYPE);
|
||||||
ExtensionElement child;
|
ExtensionElement child;
|
||||||
|
|
||||||
Objects.requireNonNull(type);
|
Objects.requireNonNull(type);
|
||||||
|
@ -48,10 +48,10 @@ public class SecurityProvider extends ExtensionElementProvider<SecurityElement>
|
||||||
if (encryptionElementProvider != null) {
|
if (encryptionElementProvider != null) {
|
||||||
child = encryptionElementProvider.parse(parser);
|
child = encryptionElementProvider.parse(parser);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.log(Level.WARNING, "Unknown child element in SecurityElement: " + type);
|
LOGGER.log(Level.WARNING, "Unknown child element in JetSecurityElement: " + type);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SecurityElement(name, child);
|
return new JetSecurityElement(name, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -105,7 +105,7 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
||||||
if (transportManager == null) {
|
if (transportManager == null) {
|
||||||
//No usable transports.
|
//No usable transports.
|
||||||
LOGGER.log(Level.WARNING, "No usable transports.");
|
LOGGER.log(Level.WARNING, "No usable transports.");
|
||||||
jutil.sendSessionTerminateUnsupportedTransports(getInitiator(), getSessionId());
|
connection.createStanzaCollectorAndSend(jutil.createSessionTerminateUnsupportedTransports(getInitiator(), getSessionId()));
|
||||||
state = State.terminated;
|
state = State.terminated;
|
||||||
return jutil.createAck(initiate);
|
return jutil.createAck(initiate);
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
||||||
LOGGER.log(Level.INFO, "Unsupported transport. Reject transport-replace.");
|
LOGGER.log(Level.INFO, "Unsupported transport. Reject transport-replace.");
|
||||||
jutil.sendTransportReject(transportReplace.getFrom().asFullJidOrThrow(), transportReplace.getInitiator(),
|
jutil.sendTransportReject(transportReplace.getFrom().asFullJidOrThrow(), transportReplace.getInitiator(),
|
||||||
transportReplace.getSid(), getContents().get(0).getCreator(),
|
transportReplace.getSid(), getContents().get(0).getCreator(),
|
||||||
getContents().get(0).getName(), transportReplace.getContents().get(0).getJingleTransport());
|
getContents().get(0).getName(), transportReplace.getContents().get(0).getTransport());
|
||||||
}
|
}
|
||||||
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
|
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
|
||||||
LOGGER.log(Level.SEVERE, "Help me please!", e);
|
LOGGER.log(Level.SEVERE, "Help me please!", e);
|
||||||
|
|
|
@ -184,7 +184,7 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
||||||
LOGGER.log(Level.INFO, "Unsupported transport. Reject transport-replace.");
|
LOGGER.log(Level.INFO, "Unsupported transport. Reject transport-replace.");
|
||||||
jutil.sendTransportReject(transportReplace.getFrom().asFullJidOrThrow(), transportReplace.getInitiator(),
|
jutil.sendTransportReject(transportReplace.getFrom().asFullJidOrThrow(), transportReplace.getInitiator(),
|
||||||
transportReplace.getSid(), getContents().get(0).getCreator(),
|
transportReplace.getSid(), getContents().get(0).getCreator(),
|
||||||
getContents().get(0).getName(), transportReplace.getContents().get(0).getJingleTransport());
|
getContents().get(0).getName(), transportReplace.getContents().get(0).getTransport());
|
||||||
}
|
}
|
||||||
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
|
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
|
||||||
LOGGER.log(Level.SEVERE, "Help me please!", e);
|
LOGGER.log(Level.SEVERE, "Help me please!", e);
|
||||||
|
|
|
@ -29,22 +29,22 @@ public class Range implements NamedElement {
|
||||||
public static final String ATTR_OFFSET = "offset";
|
public static final String ATTR_OFFSET = "offset";
|
||||||
public static final String ATTR_LENGTH = "length";
|
public static final String ATTR_LENGTH = "length";
|
||||||
|
|
||||||
private final int offset, length;
|
private final Long offset, length;
|
||||||
private final HashElement hash;
|
private final HashElement hash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Range element with default values.
|
* Create a Range element with default values.
|
||||||
*/
|
*/
|
||||||
public Range() {
|
public Range() {
|
||||||
this(0, -1, null);
|
this(null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Range element with specified length.
|
* Create a Range element with specified length.
|
||||||
* @param length length of the transmitted data in bytes.
|
* @param length length of the transmitted data in bytes.
|
||||||
*/
|
*/
|
||||||
public Range(int length) {
|
public Range(Long length) {
|
||||||
this(0, length, null);
|
this(null, length, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +52,7 @@ public class Range implements NamedElement {
|
||||||
* @param offset offset in bytes from the beginning of the transmitted data.
|
* @param offset offset in bytes from the beginning of the transmitted data.
|
||||||
* @param length number of bytes that shall be transferred.
|
* @param length number of bytes that shall be transferred.
|
||||||
*/
|
*/
|
||||||
public Range(int offset, int length) {
|
public Range(Long offset, Long length) {
|
||||||
this(offset, length, null);
|
this(offset, length, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class Range implements NamedElement {
|
||||||
* @param length number of bytes that shall be transferred.
|
* @param length number of bytes that shall be transferred.
|
||||||
* @param hash hash of the bytes in the specified range.
|
* @param hash hash of the bytes in the specified range.
|
||||||
*/
|
*/
|
||||||
public Range(int offset, int length, HashElement hash) {
|
public Range(Long offset, Long length, HashElement hash) {
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
this.length = length;
|
this.length = length;
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
|
@ -73,7 +73,7 @@ public class Range implements NamedElement {
|
||||||
* This marks the begin of the specified range.
|
* This marks the begin of the specified range.
|
||||||
* @return offset
|
* @return offset
|
||||||
*/
|
*/
|
||||||
public int getOffset() {
|
public Long getOffset() {
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class Range implements NamedElement {
|
||||||
* Return the length of the range.
|
* Return the length of the range.
|
||||||
* @return length
|
* @return length
|
||||||
*/
|
*/
|
||||||
public int getLength() {
|
public Long getLength() {
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,12 +102,8 @@ public class Range implements NamedElement {
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML() {
|
||||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||||
|
|
||||||
if (offset > 0) {
|
sb.optAttribute(ATTR_OFFSET, offset);
|
||||||
sb.attribute(ATTR_OFFSET, offset);
|
sb.optAttribute(ATTR_LENGTH, length);
|
||||||
}
|
|
||||||
if (length > 0) {
|
|
||||||
sb.attribute(ATTR_LENGTH, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hash != null) {
|
if (hash != null) {
|
||||||
sb.rightAngleBracket();
|
sb.rightAngleBracket();
|
||||||
|
|
|
@ -20,6 +20,7 @@ import static org.xmlpull.v1.XmlPullParser.END_TAG;
|
||||||
import static org.xmlpull.v1.XmlPullParser.START_TAG;
|
import static org.xmlpull.v1.XmlPullParser.START_TAG;
|
||||||
|
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||||
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
|
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||||
|
@ -59,11 +60,9 @@ public class ChecksumProvider extends ExtensionElementProvider<Checksum> {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Range.ELEMENT:
|
case Range.ELEMENT:
|
||||||
String offset = parser.getAttributeValue(null, Range.ATTR_OFFSET);
|
Long offset = ParserUtils.getLongAttribute(parser, Range.ATTR_OFFSET);
|
||||||
String length = parser.getAttributeValue(null, Range.ATTR_LENGTH);
|
Long length = ParserUtils.getLongAttribute(parser, Range.ATTR_LENGTH);
|
||||||
int o = offset == null ? 0 : Integer.parseInt(offset);
|
range = new Range(offset, length);
|
||||||
int l = length == null ? -1 : Integer.parseInt(length);
|
|
||||||
range = new Range(o, l);
|
|
||||||
}
|
}
|
||||||
} else if (tag == END_TAG) {
|
} else if (tag == END_TAG) {
|
||||||
switch (n) {
|
switch (n) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import static org.xmlpull.v1.XmlPullParser.START_TAG;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||||
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
|
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||||
|
@ -44,10 +45,7 @@ public class JingleFileTransferProvider
|
||||||
boolean inRange = false;
|
boolean inRange = false;
|
||||||
JingleFileTransferChild.Builder builder = JingleFileTransferChild.getBuilder();
|
JingleFileTransferChild.Builder builder = JingleFileTransferChild.getBuilder();
|
||||||
HashElement inRangeHash = null;
|
HashElement inRangeHash = null;
|
||||||
|
Long length = null, offset = null;
|
||||||
int offset = 0;
|
|
||||||
int length = -1;
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
int tag = parser.nextTag();
|
int tag = parser.nextTag();
|
||||||
|
@ -77,10 +75,8 @@ public class JingleFileTransferProvider
|
||||||
|
|
||||||
case Range.ELEMENT:
|
case Range.ELEMENT:
|
||||||
inRange = true;
|
inRange = true;
|
||||||
String offsetString = parser.getAttributeValue(null, Range.ATTR_OFFSET);
|
offset = ParserUtils.getLongAttribute(parser, Range.ATTR_OFFSET);
|
||||||
String lengthString = parser.getAttributeValue(null, Range.ATTR_LENGTH);
|
length = ParserUtils.getLongAttribute(parser, Range.ATTR_LENGTH);
|
||||||
offset = (offsetString != null ? Integer.parseInt(offsetString) : 0);
|
|
||||||
length = (lengthString != null ? Integer.parseInt(lengthString) : -1);
|
|
||||||
|
|
||||||
if (parser.isEmptyElementTag()) {
|
if (parser.isEmptyElementTag()) {
|
||||||
inRange = false;
|
inRange = false;
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class ChecksumTest extends SmackTestSuite {
|
||||||
assertXMLEqual(xml, checksum.toXML().toString());
|
assertXMLEqual(xml, checksum.toXML().toString());
|
||||||
assertXMLEqual(xml, new ChecksumProvider().parse(TestUtils.getParser(xml)).toXML().toString());
|
assertXMLEqual(xml, new ChecksumProvider().parse(TestUtils.getParser(xml)).toXML().toString());
|
||||||
|
|
||||||
Range range = new Range(12,34);
|
Range range = new Range(12L,34L);
|
||||||
file = new JingleFileTransferChild(null, null, hash, null, null, -1, range);
|
file = new JingleFileTransferChild(null, null, hash, null, null, -1, range);
|
||||||
checksum = new Checksum(JingleContent.Creator.initiator, "name", file);
|
checksum = new Checksum(JingleContent.Creator.initiator, "name", file);
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class JingleUtilFileTransferTest extends SmackTestSuite {
|
||||||
assertEquals(1337, file.getSize());
|
assertEquals(1337, file.getSize());
|
||||||
assertNull(file.getRange());
|
assertNull(file.getRange());
|
||||||
|
|
||||||
assertEquals(transport, content.getJingleTransport());
|
assertEquals(transport, content.getTransport());
|
||||||
assertEquals("transid", transport.getSessionId());
|
assertEquals("transid", transport.getSessionId());
|
||||||
assertEquals(JingleIBBTransport.DEFAULT_BLOCK_SIZE, transport.getBlockSize());
|
assertEquals(JingleIBBTransport.DEFAULT_BLOCK_SIZE, transport.getBlockSize());
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public final class JingleTransportMethodManager extends Manager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
JingleContentTransport transport = content.getJingleTransport();
|
JingleContentTransport transport = content.getTransport();
|
||||||
if (transport == null) {
|
if (transport == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,10 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle;
|
package org.jivesoftware.smackx.jingle;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
|
||||||
import org.jivesoftware.smack.packet.Element;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||||
|
@ -50,150 +48,68 @@ public class JingleUtil {
|
||||||
* XEP-0166 Example 10.
|
* XEP-0166 Example 10.
|
||||||
* @param recipient recipient of the stanza.
|
* @param recipient recipient of the stanza.
|
||||||
* @param sessionId sessionId
|
* @param sessionId sessionId
|
||||||
* @param contentCreator creator of the content.
|
* @param content content
|
||||||
* @param contentName name of the content.
|
|
||||||
* @param contentSenders sender of the content.
|
|
||||||
* @param description description of the content.
|
|
||||||
* @param transport used transport.
|
|
||||||
* @return session-initiate stanza.
|
* @return session-initiate stanza.
|
||||||
*/
|
*/
|
||||||
public Jingle createSessionInitiate(FullJid recipient,
|
public Jingle createSessionInitiate(FullJid recipient,
|
||||||
String sessionId,
|
String sessionId,
|
||||||
JingleContent.Creator contentCreator,
|
JingleContent content) {
|
||||||
String contentName,
|
return createSessionInitiate(recipient, sessionId, Collections.singletonList(content));
|
||||||
JingleContent.Senders contentSenders,
|
}
|
||||||
JingleContentDescription description,
|
|
||||||
JingleContentTransport transport,
|
|
||||||
List<Element> additionalElements) {
|
|
||||||
|
|
||||||
Jingle.Builder jb = Jingle.getBuilder();
|
public Jingle createSessionInitiate(FullJid recipient,
|
||||||
jb.setAction(JingleAction.session_initiate)
|
String sessionId,
|
||||||
|
List<JingleContent> contents) {
|
||||||
|
|
||||||
|
Jingle.Builder builder = Jingle.getBuilder();
|
||||||
|
builder.setAction(JingleAction.session_initiate)
|
||||||
.setSessionId(sessionId)
|
.setSessionId(sessionId)
|
||||||
.setInitiator(connection.getUser());
|
.setInitiator(connection.getUser());
|
||||||
|
|
||||||
JingleContent.Builder cb = JingleContent.getBuilder();
|
for (JingleContent content : contents) {
|
||||||
cb.setCreator(contentCreator)
|
builder.addJingleContent(content);
|
||||||
.setName(contentName)
|
}
|
||||||
.setSenders(contentSenders)
|
|
||||||
.setDescription(description)
|
|
||||||
.setTransport(transport)
|
|
||||||
.addAdditionalElements(additionalElements);
|
|
||||||
|
|
||||||
Jingle jingle = jb.addJingleContent(cb.build()).build();
|
Jingle jingle = builder.build();
|
||||||
jingle.setFrom(connection.getUser());
|
jingle.setFrom(connection.getUser());
|
||||||
jingle.setTo(recipient);
|
jingle.setTo(recipient);
|
||||||
|
|
||||||
return jingle;
|
return jingle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiate a file transfer session.
|
|
||||||
* XEP-0234 Example 1.
|
|
||||||
* @param recipient recipient of the file transfer.
|
|
||||||
* @param sessionId sessionId.
|
|
||||||
* @param contentCreator creator of the content.
|
|
||||||
* @param contentName name of the content.
|
|
||||||
* @param description description of the content.
|
|
||||||
* @param transport used transport.
|
|
||||||
* @return session-initiate stanza.
|
|
||||||
*/
|
|
||||||
public Jingle createSessionInitiateFileOffer(FullJid recipient,
|
|
||||||
String sessionId,
|
|
||||||
JingleContent.Creator contentCreator,
|
|
||||||
String contentName,
|
|
||||||
JingleContentDescription description,
|
|
||||||
JingleContentTransport transport,
|
|
||||||
List<Element> additionalElements) {
|
|
||||||
return createSessionInitiate(recipient, sessionId, contentCreator, contentName,
|
|
||||||
JingleContent.Senders.initiator, description, transport, additionalElements);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IQ sendSessionInitiateFileOffer(FullJid recipient,
|
|
||||||
String sessionId,
|
|
||||||
JingleContent.Creator contentCreator,
|
|
||||||
String contentName,
|
|
||||||
JingleContentDescription description,
|
|
||||||
JingleContentTransport transport,
|
|
||||||
List<Element> additionalElements)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
Jingle jingle = createSessionInitiateFileOffer(recipient, sessionId, contentCreator, contentName, description, transport, additionalElements);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IQ sendSessionInitiate(FullJid recipient,
|
|
||||||
String sessionId,
|
|
||||||
JingleContent.Creator contentCreator,
|
|
||||||
String contentName,
|
|
||||||
JingleContent.Senders contentSenders,
|
|
||||||
JingleContentDescription description,
|
|
||||||
JingleContentTransport transport,
|
|
||||||
List<Element> additionalElements)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
Jingle jingle = createSessionInitiate(recipient, sessionId, contentCreator, contentName, contentSenders,
|
|
||||||
description, transport, additionalElements);
|
|
||||||
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accept a session.
|
* Accept a session.
|
||||||
* XEP-0166 Example 17.
|
* XEP-0166 Example 17.
|
||||||
* @param recipient recipient of the stanza.
|
* @param recipient recipient of the stanza.
|
||||||
* @param sessionId sessionId.
|
* @param sessionId sessionId.
|
||||||
* @param contentCreator creator of the content.
|
* @param content content
|
||||||
* @param contentName name of the content.
|
|
||||||
* @param contentSenders sender of the content.
|
|
||||||
* @param description description of the content.
|
|
||||||
* @param transport proposed transport.
|
|
||||||
* @return session-accept stanza.
|
* @return session-accept stanza.
|
||||||
*/
|
*/
|
||||||
public Jingle createSessionAccept(FullJid recipient,
|
public Jingle createSessionAccept(FullJid recipient,
|
||||||
String sessionId,
|
String sessionId,
|
||||||
JingleContent.Creator contentCreator,
|
JingleContent content) {
|
||||||
String contentName,
|
return createSessionAccept(recipient, sessionId, Collections.singletonList(content));
|
||||||
JingleContent.Senders contentSenders,
|
}
|
||||||
JingleContentDescription description,
|
|
||||||
JingleContentTransport transport) {
|
|
||||||
|
|
||||||
|
public Jingle createSessionAccept(FullJid recipient,
|
||||||
|
String sessionId,
|
||||||
|
List<JingleContent> contents) {
|
||||||
Jingle.Builder jb = Jingle.getBuilder();
|
Jingle.Builder jb = Jingle.getBuilder();
|
||||||
jb.setResponder(connection.getUser())
|
jb.setResponder(connection.getUser())
|
||||||
.setAction(JingleAction.session_accept)
|
.setAction(JingleAction.session_accept)
|
||||||
.setSessionId(sessionId);
|
.setSessionId(sessionId);
|
||||||
|
|
||||||
JingleContent.Builder cb = JingleContent.getBuilder();
|
for (JingleContent content : contents) {
|
||||||
cb.setCreator(contentCreator)
|
jb.addJingleContent(content);
|
||||||
.setName(contentName)
|
}
|
||||||
.setSenders(contentSenders)
|
|
||||||
.setDescription(description)
|
|
||||||
.setTransport(transport);
|
|
||||||
|
|
||||||
Jingle jingle = jb.addJingleContent(cb.build()).build();
|
Jingle jingle = jb.build();
|
||||||
jingle.setTo(recipient);
|
jingle.setTo(recipient);
|
||||||
jingle.setFrom(connection.getUser());
|
jingle.setFrom(connection.getUser());
|
||||||
|
|
||||||
return jingle;
|
return jingle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionAccept(FullJid recipient,
|
|
||||||
String sessionId,
|
|
||||||
JingleContent.Creator contentCreator,
|
|
||||||
String contentName,
|
|
||||||
JingleContent.Senders contentSenders,
|
|
||||||
JingleContentDescription description,
|
|
||||||
JingleContentTransport transport)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
Jingle jingle = createSessionAccept(recipient, sessionId, contentCreator, contentName, contentSenders,
|
|
||||||
description, transport);
|
|
||||||
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a session-terminate stanza.
|
* Create a session-terminate stanza.
|
||||||
* XEP-0166 §6.7.
|
* XEP-0166 §6.7.
|
||||||
|
@ -227,22 +143,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, new JingleReason(reason));
|
return createSessionTerminate(recipient, sessionId, new JingleReason(reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQ sendSessionTerminate(FullJid recipient, String sessionId, JingleReason.Reason reason)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
return sendSessionTerminate(recipient, sessionId, new JingleReason(reason));
|
|
||||||
}
|
|
||||||
|
|
||||||
private IQ sendSessionTerminate(FullJid recipient, String sessionId, JingleReason reason)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
Jingle jingle = createSessionTerminate(recipient, sessionId, reason);
|
|
||||||
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate the session by declining.
|
* Terminate the session by declining.
|
||||||
* XEP-0166 Example 21.
|
* XEP-0166 Example 21.
|
||||||
|
@ -254,14 +154,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.decline);
|
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.decline);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateDecline(FullJid recipient, String sessionId)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
Jingle jingle = createSessionTerminateDecline(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate the session due to success.
|
* Terminate the session due to success.
|
||||||
* XEP-0166 Example 19.
|
* XEP-0166 Example 19.
|
||||||
|
@ -273,14 +165,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.success);
|
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.success);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateSuccess(FullJid recipient, String sessionId)
|
|
||||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
|
||||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
Jingle jingle = createSessionTerminateSuccess(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate the session due to being busy.
|
* Terminate the session due to being busy.
|
||||||
* XEP-0166 Example 20.
|
* XEP-0166 Example 20.
|
||||||
|
@ -292,14 +176,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.busy);
|
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.busy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateBusy(FullJid recipient, String sessionId)
|
|
||||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
|
||||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
Jingle jingle = createSessionTerminateBusy(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate the session due to the existence of an alternative session.
|
* Terminate the session due to the existence of an alternative session.
|
||||||
* XEP-0166 Example 22.
|
* XEP-0166 Example 22.
|
||||||
|
@ -312,14 +188,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.AlternativeSession(altSessionId));
|
return createSessionTerminate(recipient, sessionId, JingleReason.AlternativeSession(altSessionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateAlternativeSession(FullJid recipient, String sessionId, String altSessionId)
|
|
||||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
|
||||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
Jingle jingle = createSessionTerminateAlternativeSession(recipient, sessionId, altSessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel all active transfers of the session.
|
* Cancel all active transfers of the session.
|
||||||
* XEP-0234 Example 9.
|
* XEP-0234 Example 9.
|
||||||
|
@ -331,15 +199,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.cancel);
|
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateCancel(FullJid recipient,
|
|
||||||
String sessionId)
|
|
||||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
|
||||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
|
||||||
|
|
||||||
Jingle jingle = createSessionTerminateCancel(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel a single contents transfer.
|
* Cancel a single contents transfer.
|
||||||
* XEP-0234 Example 10.
|
* XEP-0234 Example 10.
|
||||||
|
@ -365,14 +224,6 @@ public class JingleUtil {
|
||||||
return jingle;
|
return jingle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateContentCancel(FullJid recipient, String sessionId,
|
|
||||||
JingleContent.Creator contentCreator, String contentName)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createSessionTerminateContentCancel(recipient, sessionId, contentCreator, contentName);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate the session due to unsupported transport methods.
|
* Terminate the session due to unsupported transport methods.
|
||||||
* XEP-0166 Example 23.
|
* XEP-0166 Example 23.
|
||||||
|
@ -384,13 +235,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.unsupported_transports);
|
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.unsupported_transports);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateUnsupportedTransports(FullJid recipient, String sessionId)
|
|
||||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
|
||||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createSessionTerminateUnsupportedTransports(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate the session due to failed transports.
|
* Terminate the session due to failed transports.
|
||||||
* XEP-0166 Example 24.
|
* XEP-0166 Example 24.
|
||||||
|
@ -402,13 +246,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.failed_transport);
|
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.failed_transport);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateFailedTransport(FullJid recipient, String sessionId)
|
|
||||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
|
||||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createSessionTerminateFailedTransport(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate the session due to unsupported applications.
|
* Terminate the session due to unsupported applications.
|
||||||
* XEP-0166 Example 25.
|
* XEP-0166 Example 25.
|
||||||
|
@ -420,13 +257,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.unsupported_applications);
|
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.unsupported_applications);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateUnsupportedApplications(FullJid recipient, String sessionId)
|
|
||||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
|
||||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createSessionTerminateUnsupportedApplications(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate the session due to failed application.
|
* Terminate the session due to failed application.
|
||||||
* XEP-0166 Example 26.
|
* XEP-0166 Example 26.
|
||||||
|
@ -438,13 +268,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.failed_application);
|
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.failed_application);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateFailedApplication(FullJid recipient, String sessionId)
|
|
||||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
|
||||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createSessionTerminateFailedApplication(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate session due to incompatible parameters.
|
* Terminate session due to incompatible parameters.
|
||||||
* XEP-0166 Example 27.
|
* XEP-0166 Example 27.
|
||||||
|
@ -456,13 +279,6 @@ public class JingleUtil {
|
||||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.incompatible_parameters);
|
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.incompatible_parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionTerminateIncompatibleParameters(FullJid recipient, String sessionId)
|
|
||||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
|
||||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createSessionTerminateIncompatibleParameters(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IQ sendContentRejectFileNotAvailable(FullJid recipient, String sessionId, JingleContentDescription description) {
|
public IQ sendContentRejectFileNotAvailable(FullJid recipient, String sessionId, JingleContentDescription description) {
|
||||||
return null; //TODO Later
|
return null; //TODO Later
|
||||||
}
|
}
|
||||||
|
@ -486,13 +302,6 @@ public class JingleUtil {
|
||||||
return jingle;
|
return jingle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendSessionPing(FullJid recipient, String sessionId)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createSessionPing(recipient, sessionId);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acknowledge the receipt of a stanza.
|
* Acknowledge the receipt of a stanza.
|
||||||
* XEP-0166 Example 5.
|
* XEP-0166 Example 5.
|
||||||
|
@ -503,10 +312,6 @@ public class JingleUtil {
|
||||||
return IQ.createResultIQ(jingle);
|
return IQ.createResultIQ(jingle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendAck(Jingle jingle) throws SmackException.NotConnectedException, InterruptedException {
|
|
||||||
connection.sendStanza(createAck(jingle));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace a transport with another one.
|
* Replace a transport with another one.
|
||||||
* XEP-0260 Example 15.
|
* XEP-0260 Example 15.
|
||||||
|
@ -536,15 +341,6 @@ public class JingleUtil {
|
||||||
return jingle;
|
return jingle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendTransportReplace(FullJid recipient, FullJid initiator, String sessionId,
|
|
||||||
JingleContent.Creator contentCreator, String contentName,
|
|
||||||
JingleContentTransport transport)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createTransportReplace(recipient, initiator, sessionId, contentCreator, contentName, transport);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accept a transport.
|
* Accept a transport.
|
||||||
* XEP-0260 Example 17.
|
* XEP-0260 Example 17.
|
||||||
|
@ -574,15 +370,6 @@ public class JingleUtil {
|
||||||
return jingle;
|
return jingle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendTransportAccept(FullJid recipient, FullJid initiator, String sessionId,
|
|
||||||
JingleContent.Creator contentCreator, String contentName,
|
|
||||||
JingleContentTransport transport)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createTransportAccept(recipient, initiator, sessionId, contentCreator, contentName, transport);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reject a transport.
|
* Reject a transport.
|
||||||
* XEP-0166 §7.2.14.
|
* XEP-0166 §7.2.14.
|
||||||
|
@ -612,15 +399,6 @@ public class JingleUtil {
|
||||||
return jingle;
|
return jingle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ sendTransportReject(FullJid recipient, FullJid initiator, String sessionId,
|
|
||||||
JingleContent.Creator contentCreator, String contentName,
|
|
||||||
JingleContentTransport transport)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException,
|
|
||||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
|
||||||
Jingle jingle = createTransportReject(recipient, initiator, sessionId, contentCreator, contentName, transport);
|
|
||||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ####################################################################################################
|
* ####################################################################################################
|
||||||
*/
|
*/
|
||||||
|
@ -638,11 +416,6 @@ public class JingleUtil {
|
||||||
return IQ.createErrorResponse(request, error);
|
return IQ.createErrorResponse(request, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendErrorUnknownSession(Jingle request)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException {
|
|
||||||
connection.sendStanza(createErrorUnknownSession(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an error response to a request coming from a unknown initiator.
|
* Create an error response to a request coming from a unknown initiator.
|
||||||
* XEP-0166 Example 12.
|
* XEP-0166 Example 12.
|
||||||
|
@ -654,11 +427,6 @@ public class JingleUtil {
|
||||||
return IQ.createErrorResponse(request, b);
|
return IQ.createErrorResponse(request, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendErrorUnknownInitiator(Jingle request)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException {
|
|
||||||
connection.sendStanza(createErrorUnknownInitiator(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an error response to a request with an unsupported info.
|
* Create an error response to a request with an unsupported info.
|
||||||
* XEP-0166 Example 31.
|
* XEP-0166 Example 31.
|
||||||
|
@ -672,11 +440,6 @@ public class JingleUtil {
|
||||||
return IQ.createErrorResponse(request, error);
|
return IQ.createErrorResponse(request, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendErrorUnsupportedInfo(Jingle request)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException {
|
|
||||||
connection.sendStanza(createErrorUnsupportedInfo(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an error response to a tie-breaking request.
|
* Create an error response to a tie-breaking request.
|
||||||
* XEP-0166 Example 34.
|
* XEP-0166 Example 34.
|
||||||
|
@ -690,11 +453,6 @@ public class JingleUtil {
|
||||||
return IQ.createErrorResponse(request, error);
|
return IQ.createErrorResponse(request, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendErrorTieBreak(Jingle request)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException {
|
|
||||||
connection.sendStanza(createErrorTieBreak(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an error response to a request that was out of order.
|
* Create an error response to a request that was out of order.
|
||||||
* TODO: Find example.
|
* TODO: Find example.
|
||||||
|
@ -708,11 +466,6 @@ public class JingleUtil {
|
||||||
return IQ.createErrorResponse(request, error);
|
return IQ.createErrorResponse(request, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendErrorOutOfOrder(Jingle request)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException {
|
|
||||||
connection.sendStanza(createErrorOutOfOrder(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an error response to a malformed request.
|
* Create an error response to a malformed request.
|
||||||
* XEP-0166 Ex. 16
|
* XEP-0166 Ex. 16
|
||||||
|
@ -725,9 +478,4 @@ public class JingleUtil {
|
||||||
error.setCondition(XMPPError.Condition.bad_request);
|
error.setCondition(XMPPError.Condition.bad_request);
|
||||||
return IQ.createErrorResponse(request, error);
|
return IQ.createErrorResponse(request, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendErrorMalformedRequest(Jingle request)
|
|
||||||
throws SmackException.NotConnectedException, InterruptedException {
|
|
||||||
connection.sendStanza(createErrorMalformedRequest(request));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle.element;
|
package org.jivesoftware.smackx.jingle.element;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Element;
|
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
@ -27,6 +23,11 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jingle content element.
|
* Jingle content element.
|
||||||
|
* <jingle>
|
||||||
|
* <content> <- Me.
|
||||||
|
* ...
|
||||||
|
* </content>
|
||||||
|
* </jingle>
|
||||||
*/
|
*/
|
||||||
public final class JingleContent implements NamedElement {
|
public final class JingleContent implements NamedElement {
|
||||||
|
|
||||||
|
@ -72,22 +73,20 @@ public final class JingleContent implements NamedElement {
|
||||||
|
|
||||||
private final JingleContentTransport transport;
|
private final JingleContentTransport transport;
|
||||||
|
|
||||||
private final List<Element> additionalElements = new ArrayList<>();
|
private final JingleContentSecurity security;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a content description..
|
* Creates a content description..
|
||||||
*/
|
*/
|
||||||
private JingleContent(Creator creator, String disposition, String name, Senders senders,
|
private JingleContent(Creator creator, String disposition, String name, Senders senders,
|
||||||
JingleContentDescription description, JingleContentTransport transport, List<Element> additionalElements) {
|
JingleContentDescription description, JingleContentTransport transport, JingleContentSecurity security) {
|
||||||
this.creator = Objects.requireNonNull(creator, "Jingle content creator must not be null");
|
this.creator = Objects.requireNonNull(creator, "Jingle content creator must not be null");
|
||||||
this.disposition = disposition;
|
this.disposition = disposition;
|
||||||
this.name = StringUtils.requireNotNullOrEmpty(name, "Jingle content name must not be null or empty");
|
this.name = StringUtils.requireNotNullOrEmpty(name, "Jingle content name must not be null or empty");
|
||||||
this.senders = senders;
|
this.senders = senders;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.transport = transport;
|
this.transport = transport;
|
||||||
if (additionalElements != null) {
|
this.security = security;
|
||||||
this.additionalElements.addAll(additionalElements);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Creator getCreator() {
|
public Creator getCreator() {
|
||||||
|
@ -120,12 +119,12 @@ public final class JingleContent implements NamedElement {
|
||||||
*
|
*
|
||||||
* @return an Iterator for the JingleTransports in the packet.
|
* @return an Iterator for the JingleTransports in the packet.
|
||||||
*/
|
*/
|
||||||
public JingleContentTransport getJingleTransport() {
|
public JingleContentTransport getTransport() {
|
||||||
return transport;
|
return transport;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Element> getAdditionalElements() {
|
public JingleContentSecurity getSecurity() {
|
||||||
return additionalElements;
|
return security;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -144,10 +143,7 @@ public final class JingleContent implements NamedElement {
|
||||||
|
|
||||||
xml.optAppend(description);
|
xml.optAppend(description);
|
||||||
xml.optElement(transport);
|
xml.optElement(transport);
|
||||||
|
xml.optElement(security);
|
||||||
for (Element element : additionalElements) {
|
|
||||||
xml.element(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
return xml;
|
return xml;
|
||||||
|
@ -170,7 +166,7 @@ public final class JingleContent implements NamedElement {
|
||||||
|
|
||||||
private JingleContentTransport transport;
|
private JingleContentTransport transport;
|
||||||
|
|
||||||
private List<Element> additionalElements = new ArrayList<>();
|
private JingleContentSecurity security;
|
||||||
|
|
||||||
private Builder() {
|
private Builder() {
|
||||||
}
|
}
|
||||||
|
@ -208,15 +204,13 @@ public final class JingleContent implements NamedElement {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder addAdditionalElements(List<Element> elements) {
|
public Builder setSecurity(JingleContentSecurity element) {
|
||||||
if (elements != null) {
|
this.security = element;
|
||||||
additionalElements.addAll(elements);
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JingleContent build() {
|
public JingleContent build() {
|
||||||
return new JingleContent(creator, disposition, name, senders, description, transport, additionalElements);
|
return new JingleContent(creator, disposition, name, senders, description, transport, security);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,13 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jingle content description.
|
* Jingle content description.
|
||||||
|
* <jingle>
|
||||||
|
* <content>
|
||||||
|
* <description/> <- This element is us.
|
||||||
|
* <transport/>
|
||||||
|
* <security/>
|
||||||
|
* </content>
|
||||||
|
* </jingle>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentDescription implements ExtensionElement {
|
public abstract class JingleContentDescription implements ExtensionElement {
|
||||||
|
|
|
@ -20,6 +20,15 @@ import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An element found usually in 'description' elements.
|
* An element found usually in 'description' elements.
|
||||||
|
* <jingle>
|
||||||
|
* <content>
|
||||||
|
* <description>
|
||||||
|
* <XYZ/> <- We live here.
|
||||||
|
* </description>
|
||||||
|
* <transport/>
|
||||||
|
* <security/>
|
||||||
|
* </content>
|
||||||
|
* </jingle>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentDescriptionChildElement implements NamedElement {
|
public abstract class JingleContentDescriptionChildElement implements NamedElement {
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 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.element;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Jingle security element.
|
||||||
|
* <jingle>
|
||||||
|
* <content>
|
||||||
|
* <description/>
|
||||||
|
* <transport/>
|
||||||
|
* <security/> <- That's me :)
|
||||||
|
* </content>
|
||||||
|
* </jingle>
|
||||||
|
*/
|
||||||
|
public abstract class JingleContentSecurity implements ExtensionElement {
|
||||||
|
|
||||||
|
public static final String ELEMENT = "security";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getElementName() {
|
||||||
|
return ELEMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -24,6 +24,13 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A jingle transport extension.
|
* A jingle transport extension.
|
||||||
|
* <jingle>
|
||||||
|
* <content>
|
||||||
|
* <description/>
|
||||||
|
* <transport/> <- Voila.
|
||||||
|
* <security/>
|
||||||
|
* </content>
|
||||||
|
* </jingle>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentTransport implements ExtensionElement {
|
public abstract class JingleContentTransport implements ExtensionElement {
|
||||||
|
|
|
@ -20,6 +20,15 @@ import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An element found usually in Jingle 'transport' elements.
|
* An element found usually in Jingle 'transport' elements.
|
||||||
|
* <jingle>
|
||||||
|
* <content>
|
||||||
|
* <description/>
|
||||||
|
* <transport>
|
||||||
|
* <candidate/> <- We are those guys.
|
||||||
|
* <candidate/> <-/
|
||||||
|
* </transport>
|
||||||
|
* </content>
|
||||||
|
* </jingle>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentTransportCandidate implements NamedElement {
|
public abstract class JingleContentTransportCandidate implements NamedElement {
|
||||||
|
|
|
@ -20,6 +20,17 @@ import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract JingleContentTransportInfo element.
|
* Abstract JingleContentTransportInfo element.
|
||||||
|
* The JingleContentTransportInfo element can have certain states defined by the respective Transport XEP.
|
||||||
|
* Examples are Jingle Socks5Bytestream's <candidate-used/> (Example 5), <candidate-error/> (Example 7) etc.
|
||||||
|
* <jingle>
|
||||||
|
* <content>
|
||||||
|
* <description/>
|
||||||
|
* <transport>
|
||||||
|
* <xyz/> <- This is us.
|
||||||
|
* </transport>
|
||||||
|
* <security/>
|
||||||
|
* </content>
|
||||||
|
* </jingle>
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentTransportInfo implements NamedElement {
|
public abstract class JingleContentTransportInfo implements NamedElement {
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public abstract class JingleTransportSession<T extends JingleContentTransport> {
|
||||||
}
|
}
|
||||||
|
|
||||||
JingleContent content = jingle.getContents().get(0);
|
JingleContent content = jingle.getContents().get(0);
|
||||||
JingleContentTransport t = content.getJingleTransport();
|
JingleContentTransport t = content.getTransport();
|
||||||
|
|
||||||
if (t != null && t.getNamespace().equals(getNamespace())) {
|
if (t != null && t.getNamespace().equals(getNamespace())) {
|
||||||
setTheirProposal(t);
|
setTheirProposal(t);
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IQ handleTransportInfo(Jingle transportInfo) {
|
public IQ handleTransportInfo(Jingle transportInfo) {
|
||||||
JingleS5BTransportInfo info = (JingleS5BTransportInfo) transportInfo.getContents().get(0).getJingleTransport().getInfo();
|
JingleS5BTransportInfo info = (JingleS5BTransportInfo) transportInfo.getContents().get(0).getTransport().getInfo();
|
||||||
|
|
||||||
switch (info.getElementName()) {
|
switch (info.getElementName()) {
|
||||||
case JingleS5BTransportInfo.CandidateUsed.ELEMENT:
|
case JingleS5BTransportInfo.CandidateUsed.ELEMENT:
|
||||||
|
@ -209,7 +209,7 @@ public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BT
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ handleCandidateUsed(Jingle jingle) {
|
public IQ handleCandidateUsed(Jingle jingle) {
|
||||||
JingleS5BTransportInfo info = (JingleS5BTransportInfo) jingle.getContents().get(0).getJingleTransport().getInfo();
|
JingleS5BTransportInfo info = (JingleS5BTransportInfo) jingle.getContents().get(0).getTransport().getInfo();
|
||||||
String candidateId = ((JingleS5BTransportInfo.CandidateUsed) info).getCandidateId();
|
String candidateId = ((JingleS5BTransportInfo.CandidateUsed) info).getCandidateId();
|
||||||
theirChoice = new UsedCandidate(ourProposal, ourProposal.getCandidate(candidateId), null);
|
theirChoice = new UsedCandidate(ourProposal, ourProposal.getCandidate(candidateId), null);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.jivesoftware.smackx.jingle3;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by vanitas on 17.07.17.
|
||||||
|
*/
|
||||||
|
public class JingleSession {
|
||||||
|
|
||||||
|
private final ArrayList<JingleContent> contents
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.jivesoftware.smackx.jingle3;
|
||||||
|
|
||||||
|
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||||
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
||||||
|
import org.jivesoftware.smackx.jingle.element.JingleContentSecurity;
|
||||||
|
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal class that holds the state of a content in a modifiable form.
|
||||||
|
*/
|
||||||
|
public class JingleSessionContent {
|
||||||
|
private JingleContent.Creator creator;
|
||||||
|
private String name;
|
||||||
|
private JingleContent.Senders senders;
|
||||||
|
private JingleContentDescription description;
|
||||||
|
private JingleContentTransport transport;
|
||||||
|
private JingleContentSecurity security;
|
||||||
|
|
||||||
|
public JingleContent.Creator getCreator() {
|
||||||
|
return creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JingleContent.Senders getSenders() {
|
||||||
|
return senders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JingleContentDescription getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JingleContentTransport getTransport() {
|
||||||
|
return transport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JingleContentSecurity getSecurity() {
|
||||||
|
return security;
|
||||||
|
}
|
||||||
|
}
|
|
@ -252,7 +252,7 @@ public class ContentNegotiator extends JingleNegotiator {
|
||||||
// // with the audio payload type and the transport
|
// // with the audio payload type and the transport
|
||||||
// // candidate
|
// // candidate
|
||||||
// result.setDescription(new JingleDescription.Audio(new PayloadType(bestCommonAudioPt)));
|
// result.setDescription(new JingleDescription.Audio(new PayloadType(bestCommonAudioPt)));
|
||||||
// result.addJingleTransport(this.getTransportNegotiator().getJingleTransport(bestRemoteCandidate));
|
// result.addJingleTransport(this.getTransportNegotiator().getTransport(bestRemoteCandidate));
|
||||||
if (mediaNeg != null) {
|
if (mediaNeg != null) {
|
||||||
result.setDescription(mediaNeg.getJingleDescription());
|
result.setDescription(mediaNeg.getJingleDescription());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue