code cleanup
This commit is contained in:
parent
77da0c6b5d
commit
d151ad9031
|
@ -239,7 +239,6 @@ public class JingleConnection {
|
||||||
|
|
||||||
private void sendAccept() {
|
private void sendAccept() {
|
||||||
status = STATUS_ACCEPTED;
|
status = STATUS_ACCEPTED;
|
||||||
connectNextCandidate();
|
|
||||||
this.mJingleConnectionManager.getPrimaryCandidate(this.account, new OnPrimaryCandidateFound() {
|
this.mJingleConnectionManager.getPrimaryCandidate(this.account, new OnPrimaryCandidateFound() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -259,6 +258,7 @@ public class JingleConnection {
|
||||||
content.socks5transport().setChildren(getCandidatesAsElements());
|
content.socks5transport().setChildren(getCandidatesAsElements());
|
||||||
packet.setContent(content);
|
packet.setContent(content);
|
||||||
sendJinglePacket(packet);
|
sendJinglePacket(packet);
|
||||||
|
connectNextCandidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -268,6 +268,7 @@ public class JingleConnection {
|
||||||
content.socks5transport().setChildren(getCandidatesAsElements());
|
content.socks5transport().setChildren(getCandidatesAsElements());
|
||||||
packet.setContent(content);
|
packet.setContent(content);
|
||||||
sendJinglePacket(packet);
|
sendJinglePacket(packet);
|
||||||
|
connectNextCandidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -275,6 +276,7 @@ public class JingleConnection {
|
||||||
content.socks5transport().setChildren(getCandidatesAsElements());
|
content.socks5transport().setChildren(getCandidatesAsElements());
|
||||||
packet.setContent(content);
|
packet.setContent(content);
|
||||||
sendJinglePacket(packet);
|
sendJinglePacket(packet);
|
||||||
|
connectNextCandidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -480,10 +482,7 @@ public class JingleConnection {
|
||||||
|
|
||||||
private void sendProxyActivated(String cid) {
|
private void sendProxyActivated(String cid) {
|
||||||
JinglePacket packet = bootstrapPacket("transport-info");
|
JinglePacket packet = bootstrapPacket("transport-info");
|
||||||
Content content = new Content();
|
Content content = new Content("inititaor","a-file-offer");
|
||||||
//TODO: put these into actual variables
|
|
||||||
content.setAttribute("creator", "initiator");
|
|
||||||
content.setAttribute("name", "a-file-offer");
|
|
||||||
content.setTransportId(this.transportId);
|
content.setTransportId(this.transportId);
|
||||||
content.socks5transport().addChild("activated").setAttribute("cid", cid);
|
content.socks5transport().addChild("activated").setAttribute("cid", cid);
|
||||||
packet.setContent(content);
|
packet.setContent(content);
|
||||||
|
@ -492,34 +491,28 @@ public class JingleConnection {
|
||||||
|
|
||||||
private void sendCandidateUsed(final String cid) {
|
private void sendCandidateUsed(final String cid) {
|
||||||
JinglePacket packet = bootstrapPacket("transport-info");
|
JinglePacket packet = bootstrapPacket("transport-info");
|
||||||
Content content = new Content();
|
Content content = new Content("initiator","a-file-offer");
|
||||||
//TODO: put these into actual variables
|
|
||||||
content.setAttribute("creator", "initiator");
|
|
||||||
content.setAttribute("name", "a-file-offer");
|
|
||||||
content.setTransportId(this.transportId);
|
content.setTransportId(this.transportId);
|
||||||
content.setUsedCandidate(cid);
|
content.socks5transport().addChild("candidate-used").setAttribute("cid", cid);
|
||||||
packet.setContent(content);
|
packet.setContent(content);
|
||||||
this.sendJinglePacket(packet);
|
|
||||||
this.sentCandidate = true;
|
this.sentCandidate = true;
|
||||||
if ((receivedCandidate)&&(status == STATUS_ACCEPTED)) {
|
if ((receivedCandidate)&&(status == STATUS_ACCEPTED)) {
|
||||||
connect();
|
connect();
|
||||||
}
|
}
|
||||||
|
this.sendJinglePacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendCandidateError() {
|
private void sendCandidateError() {
|
||||||
JinglePacket packet = bootstrapPacket("transport-info");
|
JinglePacket packet = bootstrapPacket("transport-info");
|
||||||
Content content = new Content();
|
Content content = new Content("initiator","a-file-offer");
|
||||||
//TODO: put these into actual variables
|
|
||||||
content.setAttribute("creator", "initiator");
|
|
||||||
content.setAttribute("name", "a-file-offer");
|
|
||||||
content.setTransportId(this.transportId);
|
content.setTransportId(this.transportId);
|
||||||
content.setCandidateError();
|
content.socks5transport().addChild("candidate-error");
|
||||||
packet.setContent(content);
|
packet.setContent(content);
|
||||||
this.sendJinglePacket(packet);
|
|
||||||
this.sentCandidate = true;
|
this.sentCandidate = true;
|
||||||
if ((receivedCandidate)&&(status == STATUS_ACCEPTED)) {
|
if ((receivedCandidate)&&(status == STATUS_ACCEPTED)) {
|
||||||
connect();
|
connect();
|
||||||
}
|
}
|
||||||
|
this.sendJinglePacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInitiator() {
|
public String getInitiator() {
|
||||||
|
|
|
@ -15,6 +15,12 @@ public class Content extends Element {
|
||||||
super("content");
|
super("content");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Content(String creator, String name) {
|
||||||
|
super("content");
|
||||||
|
this.setAttribute("creator", creator);
|
||||||
|
this.setAttribute("name", name);
|
||||||
|
}
|
||||||
|
|
||||||
public void setTransportId(String sid) {
|
public void setTransportId(String sid) {
|
||||||
this.transportId = sid;
|
this.transportId = sid;
|
||||||
}
|
}
|
||||||
|
@ -56,17 +62,6 @@ public class Content extends Element {
|
||||||
return this.transportId;
|
return this.transportId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsedCandidate(String cid) {
|
|
||||||
socks5transport().clearChildren();
|
|
||||||
Element usedCandidate = socks5transport().addChild("candidate-used");
|
|
||||||
usedCandidate.setAttribute("cid",cid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCandidateError() {
|
|
||||||
socks5transport().clearChildren();
|
|
||||||
socks5transport().addChild("candidate-error");
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element socks5transport() {
|
public Element socks5transport() {
|
||||||
Element transport = this.findChild("transport", "urn:xmpp:jingle:transports:s5b:1");
|
Element transport = this.findChild("transport", "urn:xmpp:jingle:transports:s5b:1");
|
||||||
if (transport==null) {
|
if (transport==null) {
|
||||||
|
|
Loading…
Reference in New Issue