aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-07 20:05:45 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-07 20:05:45 +0200
commit3f403fb8a976f6cc7d135cf1eb6dd6f0789c312a (patch)
tree69fb1e80e9380b337b775910798870b04c5e4037 /src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java
parentc30bf75a5d77fab21480e04ce18b46d6b2826295 (diff)
jingle connection and manager. able to trigger dialog in gajim
Diffstat (limited to 'src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java')
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java32
1 files changed, 27 insertions, 5 deletions
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);
}
}