From 3f403fb8a976f6cc7d135cf1eb6dd6f0789c312a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 7 Apr 2014 20:05:45 +0200 Subject: jingle connection and manager. able to trigger dialog in gajim --- .../xmpp/stanzas/jingle/JinglePacket.java | 32 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java') diff --git a/src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java b/src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java index 51c60d1f..4c444a74 100644 --- a/src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java +++ b/src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java @@ -6,6 +6,7 @@ import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class JinglePacket extends IqPacket { Content content = null; Reason reason = null; + Element jingle = new Element("jingle"); @Override public Element addChild(Element child) { @@ -22,27 +23,25 @@ public class JinglePacket extends IqPacket { this.reason.setChildren(reasonElement.getChildren()); this.reason.setAttributes(reasonElement.getAttributes()); } - this.build(); - this.findChild("jingle").setAttributes(child.getAttributes()); + this.jingle.setAttributes(child.getAttributes()); } return child; } public JinglePacket setContent(Content content) { this.content = content; - this.build(); return this; } public JinglePacket setReason(Reason reason) { this.reason = reason; - this.build(); return this; } private void build() { this.children.clear(); - Element jingle = addChild("jingle", "urn:xmpp:jingle:1"); + this.jingle.clearChildren(); + this.jingle.setAttribute("xmlns", "urn:xmpp:jingle:1"); if (this.content!=null) { jingle.addChild(this.content); } @@ -50,5 +49,28 @@ public class JinglePacket extends IqPacket { jingle.addChild(this.reason); } this.children.add(jingle); + this.setAttribute("type", "set"); + } + + public String getSessionId() { + return this.jingle.getAttribute("sid"); + } + + public void setSessionId(String sid) { + this.jingle.setAttribute("sid", sid); + } + + @Override + public String toString() { + this.build(); + return super.toString(); + } + + public void setAction(String action) { + this.jingle.setAttribute("action", action); + } + + public void setInitiator(String initiator) { + this.jingle.setAttribute("initiator", initiator); } } -- cgit v1.2.3