aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xmpp/stanzas
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-03-27 02:02:59 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-03-27 02:02:59 +0100
commit4864f7200bbdb3e8d45eb7f165d62274f19e2e7b (patch)
tree54da6eeef9f9114dfb9e89c4342bdcee266414e2 /src/eu/siacs/conversations/xmpp/stanzas
parentf4c9c19ec0f50fa7a80f4aa7dd28269335188f55 (diff)
fixed a couple of muc issues. added jingle listener (which doesn't do anything for now)
Diffstat (limited to 'src/eu/siacs/conversations/xmpp/stanzas')
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/jingle/Content.java13
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java54
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/jingle/Reason.java13
3 files changed, 80 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/jingle/Content.java b/src/eu/siacs/conversations/xmpp/stanzas/jingle/Content.java
new file mode 100644
index 00000000..ebd212b8
--- /dev/null
+++ b/src/eu/siacs/conversations/xmpp/stanzas/jingle/Content.java
@@ -0,0 +1,13 @@
+package eu.siacs.conversations.xmpp.stanzas.jingle;
+
+import eu.siacs.conversations.xml.Element;
+
+public class Content extends Element {
+ private Content(String name) {
+ super(name);
+ }
+
+ public Content() {
+ super("content");
+ }
+}
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java b/src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java
new file mode 100644
index 00000000..51c60d1f
--- /dev/null
+++ b/src/eu/siacs/conversations/xmpp/stanzas/jingle/JinglePacket.java
@@ -0,0 +1,54 @@
+package eu.siacs.conversations.xmpp.stanzas.jingle;
+
+import eu.siacs.conversations.xml.Element;
+import eu.siacs.conversations.xmpp.stanzas.IqPacket;
+
+public class JinglePacket extends IqPacket {
+ Content content = null;
+ Reason reason = null;
+
+ @Override
+ public Element addChild(Element child) {
+ if ("jingle".equals(child.getName())) {
+ Element contentElement = child.findChild("content");
+ if (contentElement!=null) {
+ this.content = new Content();
+ this.content.setChildren(contentElement.getChildren());
+ this.content.setAttributes(contentElement.getAttributes());
+ }
+ Element reasonElement = child.findChild("reason");
+ if (reasonElement!=null) {
+ this.reason = new Reason();
+ this.reason.setChildren(reasonElement.getChildren());
+ this.reason.setAttributes(reasonElement.getAttributes());
+ }
+ this.build();
+ this.findChild("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");
+ if (this.content!=null) {
+ jingle.addChild(this.content);
+ }
+ if (this.reason != null) {
+ jingle.addChild(this.reason);
+ }
+ this.children.add(jingle);
+ }
+}
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/jingle/Reason.java b/src/eu/siacs/conversations/xmpp/stanzas/jingle/Reason.java
new file mode 100644
index 00000000..35b81655
--- /dev/null
+++ b/src/eu/siacs/conversations/xmpp/stanzas/jingle/Reason.java
@@ -0,0 +1,13 @@
+package eu.siacs.conversations.xmpp.stanzas.jingle;
+
+import eu.siacs.conversations.xml.Element;
+
+public class Reason extends Element {
+ private Reason(String name) {
+ super(name);
+ }
+
+ public Reason() {
+ super("reason");
+ }
+}