2014-03-27 01:02:59 +00:00
|
|
|
package eu.siacs.conversations.xmpp.stanzas.jingle;
|
|
|
|
|
2014-04-07 18:05:45 +00:00
|
|
|
import java.io.File;
|
|
|
|
import java.util.List;
|
|
|
|
|
2014-03-27 01:02:59 +00:00
|
|
|
import eu.siacs.conversations.xml.Element;
|
|
|
|
|
|
|
|
public class Content extends Element {
|
|
|
|
private Content(String name) {
|
|
|
|
super(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Content() {
|
|
|
|
super("content");
|
|
|
|
}
|
2014-04-07 18:05:45 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2014-03-27 01:02:59 +00:00
|
|
|
}
|