diff options
Diffstat (limited to 'src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java')
-rw-r--r-- | src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java b/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java new file mode 100644 index 000000000..941e6559e --- /dev/null +++ b/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java @@ -0,0 +1,35 @@ +package eu.siacs.conversations.xmpp.jingle.stanzas; + +import java.io.File; +import java.util.List; + +import eu.siacs.conversations.xml.Element; + +public class Content extends Element { + private Content(String name) { + super(name); + } + + public Content() { + super("content"); + } + + public void offerFile(File actualFile) { + Element description = this.addChild("description", "urn:xmpp:jingle:apps:file-transfer:3"); + Element offer = description.addChild("offer"); + Element file = offer.addChild("file"); + file.addChild("size").setContent(""+actualFile.length()); + file.addChild("name").setContent(actualFile.getName()); + } + + public void setCanditates(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.clearChildren(); + for(Element canditate : canditates) { + transport.addChild(canditate); + } + } +} |