mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
Merge branch 'jingleS5B' into jingle2
This commit is contained in:
commit
d0701f8fd1
3 changed files with 57 additions and 55 deletions
|
@ -41,6 +41,7 @@ public class JingleS5BTransport extends JingleContentTransport {
|
|||
|
||||
protected JingleS5BTransport(List<JingleContentTransportCandidate> candidates, List<JingleContentTransportInfo> infos, String streamId, String dstAddr, Bytestream.Mode mode) {
|
||||
super(candidates, infos);
|
||||
StringUtils.requireNotNullOrEmpty(streamId, "sid MUST be neither null, nor empty.");
|
||||
this.streamId = streamId;
|
||||
this.dstAddr = dstAddr;
|
||||
this.mode = mode;
|
||||
|
@ -137,7 +138,6 @@ public class JingleS5BTransport extends JingleContentTransport {
|
|||
}
|
||||
|
||||
public JingleS5BTransport build() {
|
||||
StringUtils.requireNotNullOrEmpty(streamId, "sid MUST be neither null, nor empty.");
|
||||
return new JingleS5BTransport(candidates, infos, streamId, dstAddr, mode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,14 @@ public final class JingleS5BTransportCandidate extends JingleContentTransportCan
|
|||
private final Type type;
|
||||
|
||||
public JingleS5BTransportCandidate(String candidateId, String host, Jid jid, int port, int priority, Type type) {
|
||||
|
||||
Objects.requireNonNull(candidateId);
|
||||
Objects.requireNonNull(host);
|
||||
Objects.requireNonNull(jid);
|
||||
if (priority < 0) {
|
||||
throw new IllegalArgumentException("Priority MUST be present and NOT less than 0.");
|
||||
}
|
||||
|
||||
this.cid = candidateId;
|
||||
this.host = host;
|
||||
this.jid = jid;
|
||||
|
@ -59,12 +67,7 @@ public final class JingleS5BTransportCandidate extends JingleContentTransportCan
|
|||
}
|
||||
|
||||
public JingleS5BTransportCandidate(Bytestream.StreamHost streamHost, int priority) {
|
||||
this.cid = StringUtils.randomString(24);
|
||||
this.host = streamHost.getAddress();
|
||||
this.jid = streamHost.getJID();
|
||||
this.port = streamHost.getPort();
|
||||
this.priority = priority;
|
||||
this.type = Type.proxy;
|
||||
this(StringUtils.randomString(24), streamHost.getAddress(), streamHost.getJID(), streamHost.getPort(), priority, Type.proxy);
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
|
@ -191,12 +194,6 @@ public final class JingleS5BTransportCandidate extends JingleContentTransportCan
|
|||
}
|
||||
|
||||
public JingleS5BTransportCandidate build() {
|
||||
Objects.requireNonNull(cid);
|
||||
Objects.requireNonNull(host);
|
||||
Objects.requireNonNull(jid);
|
||||
if (priority < 0) {
|
||||
throw new IllegalArgumentException("Priority MUST be present and NOT less than 0.");
|
||||
}
|
||||
return new JingleS5BTransportCandidate(cid, host, jid, port, priority, type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,10 +56,11 @@ public class JingleS5BTransportProvider extends JingleContentTransportProvider<J
|
|||
}
|
||||
|
||||
JingleS5BTransportCandidate.Builder cb;
|
||||
while (true) {
|
||||
outerloop: while (true) {
|
||||
int tag = parser.nextTag();
|
||||
String name = parser.getName();
|
||||
if (tag == START_TAG) {
|
||||
switch (tag) {
|
||||
case START_TAG: {
|
||||
switch (name) {
|
||||
|
||||
case JingleS5BTransportCandidate.ELEMENT:
|
||||
|
@ -102,12 +103,16 @@ public class JingleS5BTransportProvider extends JingleContentTransportProvider<J
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tag == END_TAG && name.equals(JingleContentTransport.ELEMENT)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case END_TAG: {
|
||||
switch (name) {
|
||||
case JingleContentTransport.ELEMENT:
|
||||
break outerloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue