ClientStateIndication.java

  1. /**
  2.  *
  3.  * Copyright © 2014 Florian Schmaus
  4.  *
  5.  * Licensed under the Apache License, Version 2.0 (the "License");
  6.  * you may not use this file except in compliance with the License.
  7.  * You may obtain a copy of the License at
  8.  *
  9.  *     http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.jivesoftware.smackx.csi.packet;

  18. import org.jivesoftware.smack.packet.FullStreamElement;
  19. import org.jivesoftware.smack.packet.ExtensionElement;

  20. /**
  21.  *
  22.  * @see <a href="http://xmpp.org/extensions/xep-0352.html">XEP-0352: Client State Indication</a>
  23.  *
  24.  */
  25. public class ClientStateIndication {
  26.     public static final String NAMESPACE = "urn:xmpp:csi:0";

  27.     public static class Active extends FullStreamElement {
  28.         public static final Active INSTANCE = new Active();
  29.         public static final String ELEMENT = "active";

  30.         private Active() {
  31.         }

  32.         @Override
  33.         public String getNamespace() {
  34.             return NAMESPACE;
  35.         }

  36.         @Override
  37.         public String getElementName() {
  38.             return ELEMENT;
  39.         }

  40.         @Override
  41.         public String toXML() {
  42.             return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
  43.         }
  44.     }

  45.     public static class Inactive extends FullStreamElement {
  46.         public static final Inactive INSTANCE = new Inactive();
  47.         public static final String ELEMENT = "inactive";

  48.         private Inactive() {
  49.         }

  50.         @Override
  51.         public String getNamespace() {
  52.             return NAMESPACE;
  53.         }

  54.         @Override
  55.         public String getElementName() {
  56.             return ELEMENT;
  57.         }

  58.         @Override
  59.         public String toXML() {
  60.             return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
  61.         }
  62.     }

  63.     public static class Feature implements ExtensionElement {
  64.         public static final Feature INSTANCE = new Feature();
  65.         public static final String ELEMENT = "csi";

  66.         private Feature() {
  67.         }

  68.         @Override
  69.         public String getElementName() {
  70.             return ELEMENT;
  71.         }

  72.         @Override
  73.         public String toXML() {
  74.             return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
  75.         }

  76.         @Override
  77.         public String getNamespace() {
  78.             return NAMESPACE;
  79.         }
  80.     }
  81. }