From 678dbd37c660c0754f75ef0fd882bfe049859344 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 13 Mar 2014 17:29:22 +0100 Subject: finished registration --- .../siacs/conversations/xmpp/stanzas/IqPacket.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/eu/siacs/conversations/xmpp/stanzas') diff --git a/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java b/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java index 1675d19d6..f70a74ddc 100644 --- a/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java +++ b/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java @@ -1,8 +1,12 @@ package eu.siacs.conversations.xmpp.stanzas; +import android.graphics.YuvImage; +import eu.siacs.conversations.xml.Element; + public class IqPacket extends AbstractStanza { + public static final int TYPE_ERROR = -1; public static final int TYPE_SET = 0; public static final int TYPE_RESULT = 1; public static final int TYPE_GET = 2; @@ -31,5 +35,35 @@ public class IqPacket extends AbstractStanza { public IqPacket() { super("iq"); } + + public Element query() { + Element query = findChild("query"); + if (query==null) { + query = new Element("query"); + addChild(query); + } + return query; + } + + public Element query(String xmlns) { + Element query = query(); + query.setAttribute("xmlns", xmlns); + return query(); + } + + public int getType() { + String type = getAttribute("type"); + if ("error".equals(type)) { + return TYPE_ERROR; + } else if ("result".equals(type)) { + return TYPE_RESULT; + } else if ("set".equals(type)) { + return TYPE_SET; + } else if ("get".equals(type)) { + return TYPE_GET; + } else { + return 1000; + } + } } -- cgit v1.2.3