diff options
Diffstat (limited to 'src/eu/siacs/conversations/xmpp/jingle/stanzas')
-rw-r--r-- | src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java | 13 | ||||
-rw-r--r-- | src/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java | 7 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java b/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java index 941e6559..5ea4619f 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java +++ b/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java @@ -1,6 +1,7 @@ package eu.siacs.conversations.xmpp.jingle.stanzas; import java.io.File; +import java.util.ArrayList; import java.util.List; import eu.siacs.conversations.xml.Element; @@ -22,14 +23,24 @@ public class Content extends Element { file.addChild("name").setContent(actualFile.getName()); } - public void setCanditates(List<Element> canditates) { + public void setCandidates(String transportId, List<Element> canditates) { Element transport = this.findChild("transport", "urn:xmpp:jingle:transports:s5b:1"); if (transport==null) { transport = this.addChild("transport", "urn:xmpp:jingle:transports:s5b:1"); } + transport.setAttribute("sid", transportId); transport.clearChildren(); for(Element canditate : canditates) { transport.addChild(canditate); } } + + public List<Element> getCanditates() { + Element transport = this.findChild("transport", "urn:xmpp:jingle:transports:s5b:1"); + if (transport==null) { + return new ArrayList<Element>(); + } else { + return transport.getChildren(); + } + } } diff --git a/src/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java b/src/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java index bd912ea3..83f0aec6 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java +++ b/src/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java @@ -33,6 +33,13 @@ public class JinglePacket extends IqPacket { return this; } + public Content getJingleContent() { + if (this.content==null) { + this.content = new Content(); + } + return this.content; + } + public JinglePacket setReason(Reason reason) { this.reason = reason; return this; |