diff options
author | 2018-04-25 13:54:25 +0300 | |
---|---|---|
committer | 2018-04-25 19:04:07 +0300 | |
commit | 2bf63fc8d2a4b84e051d28e670c7c74b039e2545 (patch) | |
tree | afceff82288a45649156b0a8428999a00464ba59 /juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java | |
parent | 003ff7221782c4f0cf4a5660832e40c7ac386618 (diff) |
www: no more xmpp
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java b/juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java new file mode 100644 index 00000000..7eacfc94 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java @@ -0,0 +1,44 @@ +package com.juick.server.xmpp.router; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + +import java.io.IOException; + + +/** + * Created by vitalyster on 03.02.2017. + */ +public class StreamError { + + private String condition; + + public StreamError() {} + + public StreamError(String condition) { + this.condition = condition; + } + + public static StreamError parse(XmlPullParser parser) throws IOException, XmlPullParserException { + StreamError streamError = new StreamError(); + while (parser.next() == XmlPullParser.START_TAG) { + final String tag = parser.getName(); + final String xmlns = parser.getNamespace(); + if (xmlns.equals(StreamNamespaces.NS_XMPP_STREAMS)) { + streamError.condition = tag; + } else { + XmlUtils.skip(parser); + } + } + return streamError; + } + + public String getCondition() { + return condition; + } + + @Override + public String toString() { + return String.format("<stream:error><%s xmlns='%s'/></stream:error>", condition, StreamNamespaces.NS_XMPP_STREAMS); + } +} |