summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2015-03-18 10:36:41 (GMT)
committerKevin Smith <git@kismith.co.uk>2015-03-19 18:28:55 (GMT)
commitd62c9ba2dad0d9833c76452b5aa780a215548a5e (patch)
treeff0ad21e1394dc2202c1d1e14d169c577a313b96 /src/com/isode/stroke/parser/payloadparsers/ChatStateParserFactory.java
parent07117577091cee230bb0da8245856e19a9c7da8c (diff)
downloadstroke-d62c9ba2dad0d9833c76452b5aa780a215548a5e.zip
stroke-d62c9ba2dad0d9833c76452b5aa780a215548a5e.tar.bz2
Add functionality for ChatState.
Adds the Element, Parser, Serializer, ChatStateTracker and ChatStateSerializerTest. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Ported serializer test from Swiften, which passes. Change-Id: I314eda2db0f2be0499f8aa74d043319fb5cf57a8
Diffstat (limited to 'src/com/isode/stroke/parser/payloadparsers/ChatStateParserFactory.java')
-rw-r--r--src/com/isode/stroke/parser/payloadparsers/ChatStateParserFactory.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/com/isode/stroke/parser/payloadparsers/ChatStateParserFactory.java b/src/com/isode/stroke/parser/payloadparsers/ChatStateParserFactory.java
new file mode 100644
index 0000000..406ffef
--- /dev/null
+++ b/src/com/isode/stroke/parser/payloadparsers/ChatStateParserFactory.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+/*
+ * Copyright (c) 2015 Tarun Gupta.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+package com.isode.stroke.parser.payloadparsers;
+
+import com.isode.stroke.parser.PayloadParserFactory;
+import com.isode.stroke.parser.payloadparsers.ChatStateParser;
+import com.isode.stroke.parser.AttributeMap;
+import com.isode.stroke.parser.PayloadParser;
+
+public class ChatStateParserFactory implements PayloadParserFactory {
+
+ /**
+ * ChatStateParserFactory();
+ */
+ public ChatStateParserFactory() {
+
+ }
+
+ /**
+ * @param attributes, notnull
+ */
+ public boolean canParse(String element, String ns, AttributeMap attributes) {
+ return ((ns.equals("http://jabber.org/protocol/chatstates")) &&
+ (element.equals("active") || element.equals("composing") || element.equals("paused") || element.equals("inactive") || element.equals("gone")));
+ }
+
+ /**
+ * @return PayloadParser()
+ */
+ public PayloadParser createPayloadParser() {
+ return (new ChatStateParser());
+ }
+}
+