MUCLightInfoIQ.java

  1. /**
  2.  *
  3.  * Copyright 2016 Fernando Ramirez
  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.muclight.element;

  18. import java.util.HashMap;

  19. import org.jivesoftware.smack.packet.IQ;

  20. import org.jivesoftware.smackx.muclight.MUCLightAffiliation;
  21. import org.jivesoftware.smackx.muclight.MUCLightRoomConfiguration;
  22. import org.jivesoftware.smackx.muclight.MultiUserChatLight;
  23. import org.jivesoftware.smackx.muclight.element.MUCLightElements.ConfigurationElement;
  24. import org.jivesoftware.smackx.muclight.element.MUCLightElements.OccupantsElement;

  25. import org.jxmpp.jid.Jid;

  26. /**
  27.  * MUC Light info response IQ class.
  28.  *
  29.  * @author Fernando Ramirez
  30.  *
  31.  */
  32. public class MUCLightInfoIQ extends IQ {

  33.     public static final String ELEMENT = QUERY_ELEMENT;
  34.     public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.INFO;

  35.     private final String version;
  36.     private final MUCLightRoomConfiguration configuration;
  37.     private final HashMap<Jid, MUCLightAffiliation> occupants;

  38.     /**
  39.      * MUCLight info response IQ constructor.
  40.      *
  41.      * @param version TODO javadoc me please
  42.      * @param configuration TODO javadoc me please
  43.      * @param occupants TODO javadoc me please
  44.      */
  45.     public MUCLightInfoIQ(String version, MUCLightRoomConfiguration configuration,
  46.             HashMap<Jid, MUCLightAffiliation> occupants) {
  47.         super(ELEMENT, NAMESPACE);
  48.         this.version = version;
  49.         this.configuration = configuration;
  50.         this.occupants = occupants;
  51.     }

  52.     @Override
  53.     protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
  54.         xml.rightAngleBracket();
  55.         xml.optElement("version", version);
  56.         xml.append(new ConfigurationElement(configuration));
  57.         xml.append(new OccupantsElement(occupants));
  58.         return xml;
  59.     }

  60.     /**
  61.      * Returns the version.
  62.      *
  63.      * @return the version
  64.      */
  65.     public String getVersion() {
  66.         return version;
  67.     }

  68.     /**
  69.      * Returns the room configuration.
  70.      *
  71.      * @return the configuration of the room
  72.      */
  73.     public MUCLightRoomConfiguration getConfiguration() {
  74.         return configuration;
  75.     }

  76.     /**
  77.      * Returns the room occupants.
  78.      *
  79.      * @return the occupants of the room
  80.      */
  81.     public HashMap<Jid, MUCLightAffiliation> getOccupants() {
  82.         return occupants;
  83.     }

  84. }