summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/isode/stroke/parser/IQParser.java')
-rw-r--r--src/com/isode/stroke/parser/IQParser.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/com/isode/stroke/parser/IQParser.java b/src/com/isode/stroke/parser/IQParser.java
new file mode 100644
index 0000000..3e8325a
--- /dev/null
+++ b/src/com/isode/stroke/parser/IQParser.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2010, Remko Tron¨on.
+ * All rights reserved.
+ */
+package com.isode.stroke.parser;
+
+import com.isode.stroke.elements.IQ;
+
+public class IQParser extends GenericStanzaParser<IQ> {
+
+ public IQParser(PayloadParserFactoryCollection factories) {
+ super(factories, new IQ());
+ }
+
+ @Override
+ void handleStanzaAttributes(AttributeMap attributes) {
+ String type = attributes.getAttribute("type");
+ if ("set".equals(type)) {
+ getStanzaGeneric().setType(IQ.Type.Set);
+ } else if ("get".equals(type)) {
+ getStanzaGeneric().setType(IQ.Type.Get);
+ } else if ("result".equals(type)) {
+ getStanzaGeneric().setType(IQ.Type.Result);
+ } else if ("error".equals(type)) {
+ getStanzaGeneric().setType(IQ.Type.Error);
+ } else {
+ getStanzaGeneric().setType(IQ.Type.Get);
+ }
+ }
+}