aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/xmpp/chatstate
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2015-03-30 22:12:49 +0200
committersteckbrief <steckbrief@chefmail.de>2015-03-30 22:12:49 +0200
commit75c5275f7e9a27019b9517770603ca4c77f1fbd9 (patch)
tree567d10bd9e559089487f5627c436000e2a1a8fc8 /src/main/java/eu/siacs/conversations/xmpp/chatstate
parentc8fe93cf0a99481bfe7a30bbc1cd98383205bcaa (diff)
parent7eabdfd80f50634282307f45c5f99ab46181805d (diff)
Merge tag '1.2.0' into trz/master
Conflicts: src/main/java/eu/siacs/conversations/parser/AbstractParser.java src/main/java/eu/siacs/conversations/ui/SettingsActivity.java src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java src/main/res/values-de/strings.xml src/main/res/xml/preferences.xml
Diffstat (limited to 'src/main/java/eu/siacs/conversations/xmpp/chatstate')
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/chatstate/ChatState.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/chatstate/ChatState.java b/src/main/java/eu/siacs/conversations/xmpp/chatstate/ChatState.java
new file mode 100644
index 00000000..f85efbdb
--- /dev/null
+++ b/src/main/java/eu/siacs/conversations/xmpp/chatstate/ChatState.java
@@ -0,0 +1,32 @@
+package eu.siacs.conversations.xmpp.chatstate;
+
+import eu.siacs.conversations.xml.Element;
+
+public enum ChatState {
+
+ ACTIVE, INACTIVE, GONE, COMPOSING, PAUSED, mIncomingChatState;
+
+ public static ChatState parse(Element element) {
+ final String NAMESPACE = "http://jabber.org/protocol/chatstates";
+ if (element.hasChild("active",NAMESPACE)) {
+ return ACTIVE;
+ } else if (element.hasChild("inactive",NAMESPACE)) {
+ return INACTIVE;
+ } else if (element.hasChild("composing",NAMESPACE)) {
+ return COMPOSING;
+ } else if (element.hasChild("gone",NAMESPACE)) {
+ return GONE;
+ } else if (element.hasChild("paused",NAMESPACE)) {
+ return PAUSED;
+ } else {
+ return null;
+ }
+ }
+
+ public static Element toElement(ChatState state) {
+ final String NAMESPACE = "http://jabber.org/protocol/chatstates";
+ final Element element = new Element(state.toString().toLowerCase());
+ element.setAttribute("xmlns",NAMESPACE);
+ return element;
+ }
+}