code cleanup

This commit is contained in:
Daniel Gultsch 2014-04-21 20:39:57 +02:00
parent 77da0c6b5d
commit d151ad9031
2 changed files with 16 additions and 28 deletions

View File

@ -239,7 +239,6 @@ public class JingleConnection {
private void sendAccept() {
status = STATUS_ACCEPTED;
connectNextCandidate();
this.mJingleConnectionManager.getPrimaryCandidate(this.account, new OnPrimaryCandidateFound() {
@Override
@ -259,6 +258,7 @@ public class JingleConnection {
content.socks5transport().setChildren(getCandidatesAsElements());
packet.setContent(content);
sendJinglePacket(packet);
connectNextCandidate();
}
@Override
@ -268,6 +268,7 @@ public class JingleConnection {
content.socks5transport().setChildren(getCandidatesAsElements());
packet.setContent(content);
sendJinglePacket(packet);
connectNextCandidate();
}
});
} else {
@ -275,6 +276,7 @@ public class JingleConnection {
content.socks5transport().setChildren(getCandidatesAsElements());
packet.setContent(content);
sendJinglePacket(packet);
connectNextCandidate();
}
}
});
@ -480,10 +482,7 @@ public class JingleConnection {
private void sendProxyActivated(String cid) {
JinglePacket packet = bootstrapPacket("transport-info");
Content content = new Content();
//TODO: put these into actual variables
content.setAttribute("creator", "initiator");
content.setAttribute("name", "a-file-offer");
Content content = new Content("inititaor","a-file-offer");
content.setTransportId(this.transportId);
content.socks5transport().addChild("activated").setAttribute("cid", cid);
packet.setContent(content);
@ -492,34 +491,28 @@ public class JingleConnection {
private void sendCandidateUsed(final String cid) {
JinglePacket packet = bootstrapPacket("transport-info");
Content content = new Content();
//TODO: put these into actual variables
content.setAttribute("creator", "initiator");
content.setAttribute("name", "a-file-offer");
Content content = new Content("initiator","a-file-offer");
content.setTransportId(this.transportId);
content.setUsedCandidate(cid);
content.socks5transport().addChild("candidate-used").setAttribute("cid", cid);
packet.setContent(content);
this.sendJinglePacket(packet);
this.sentCandidate = true;
if ((receivedCandidate)&&(status == STATUS_ACCEPTED)) {
connect();
}
this.sendJinglePacket(packet);
}
private void sendCandidateError() {
JinglePacket packet = bootstrapPacket("transport-info");
Content content = new Content();
//TODO: put these into actual variables
content.setAttribute("creator", "initiator");
content.setAttribute("name", "a-file-offer");
Content content = new Content("initiator","a-file-offer");
content.setTransportId(this.transportId);
content.setCandidateError();
content.socks5transport().addChild("candidate-error");
packet.setContent(content);
this.sendJinglePacket(packet);
this.sentCandidate = true;
if ((receivedCandidate)&&(status == STATUS_ACCEPTED)) {
connect();
}
this.sendJinglePacket(packet);
}
public String getInitiator() {

View File

@ -15,6 +15,12 @@ public class Content extends Element {
super("content");
}
public Content(String creator, String name) {
super("content");
this.setAttribute("creator", creator);
this.setAttribute("name", name);
}
public void setTransportId(String sid) {
this.transportId = sid;
}
@ -56,17 +62,6 @@ public class Content extends Element {
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() {
Element transport = this.findChild("transport", "urn:xmpp:jingle:transports:s5b:1");
if (transport==null) {