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 | 22 |
1 files changed, 21 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 cefcde36..c9015d39 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java +++ b/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java @@ -15,13 +15,25 @@ public class Content extends Element { super("content"); } - public void offerFile(JingleFile actualFile, String hash) { + public void setFileOffer(JingleFile 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.getSize()); file.addChild("name").setContent(actualFile.getName()); } + + public Element getFileOffer() { + Element description = this.findChild("description", "urn:xmpp:jingle:apps:file-transfer:3"); + if (description==null) { + return null; + } + Element offer = description.findChild("offer"); + if (offer==null) { + return null; + } + return offer.findChild("file"); + } public void setCandidates(String transportId, List<Element> canditates) { Element transport = this.findChild("transport", "urn:xmpp:jingle:transports:s5b:1"); @@ -56,4 +68,12 @@ public class Content extends Element { return usedCandidate.getAttribute("cid"); } } + + public void addCandidate(Element candidate) { + 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.addChild(candidate); + } } |