001/**
002 *
003 * Copyright © 2014-2021 Florian Schmaus
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smackx.csi.packet;
018
019import javax.xml.namespace.QName;
020
021import org.jivesoftware.smack.packet.ExtensionElement;
022import org.jivesoftware.smack.packet.Nonza;
023
024/**
025 * Client State Indication.
026 * @see <a href="http://xmpp.org/extensions/xep-0352.html">XEP-0352: Client State Indication</a>
027 *
028 */
029public class ClientStateIndication {
030    public static final String NAMESPACE = "urn:xmpp:csi:0";
031
032    public static final class Active implements Nonza {
033        public static final Active INSTANCE = new Active();
034        public static final String ELEMENT = "active";
035
036        private Active() {
037        }
038
039        @Override
040        public String getNamespace() {
041            return NAMESPACE;
042        }
043
044        @Override
045        public String getElementName() {
046            return ELEMENT;
047        }
048
049        @Override
050        public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
051            return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
052        }
053    }
054
055    public static final class Inactive implements Nonza {
056        public static final Inactive INSTANCE = new Inactive();
057        public static final String ELEMENT = "inactive";
058
059        private Inactive() {
060        }
061
062        @Override
063        public String getNamespace() {
064            return NAMESPACE;
065        }
066
067        @Override
068        public String getElementName() {
069            return ELEMENT;
070        }
071
072        @Override
073        public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
074            return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
075        }
076    }
077
078    public static final class Feature implements ExtensionElement {
079        public static final Feature INSTANCE = new Feature();
080        public static final String ELEMENT = "csi";
081
082        public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
083
084        private Feature() {
085        }
086
087        @Override
088        public String getElementName() {
089            return QNAME.getLocalPart();
090        }
091
092        @Override
093        public String getNamespace() {
094            return QNAME.getNamespaceURI();
095        }
096
097        @Override
098        public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
099            return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
100        }
101
102    }
103}