aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-21 20:39:57 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-21 20:39:57 +0200
commitd151ad90311f74df8bcd49ad3c9b1e0bc71423ec (patch)
tree430e18eb802b29606b1b26b9ed4494b2e3ae46fe /src
parent77da0c6b5d3d6925c8018c1eb57fb26d102a937d (diff)
code cleanup
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java27
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java17
2 files changed, 16 insertions, 28 deletions
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
index 24831d6c..75cc94e1 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
@@ -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() {
diff --git a/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java b/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java
index dbd2a9fc..abede91a 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java
@@ -14,6 +14,12 @@ public class Content extends Element {
public Content() {
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) {