001/** 002 * 003 * Copyright 2016 Fernando Ramirez 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.muclight.element; 018 019import org.jivesoftware.smack.packet.IQ; 020import org.jivesoftware.smackx.muclight.MUCLightRoomConfiguration; 021import org.jivesoftware.smackx.muclight.MultiUserChatLight; 022import org.jivesoftware.smackx.muclight.element.MUCLightElements.ConfigurationElement; 023 024/** 025 * MUC Light configuration response IQ class. 026 * 027 * @author Fernando Ramirez 028 * 029 */ 030public class MUCLightConfigurationIQ extends IQ { 031 032 public static final String ELEMENT = QUERY_ELEMENT; 033 public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.CONFIGURATION; 034 035 private final String version; 036 private final MUCLightRoomConfiguration configuration; 037 038 /** 039 * MUC Light configuration response IQ constructor. 040 * 041 * @param version 042 * @param configuration 043 */ 044 public MUCLightConfigurationIQ(String version, MUCLightRoomConfiguration configuration) { 045 super(ELEMENT, NAMESPACE); 046 this.version = version; 047 this.configuration = configuration; 048 } 049 050 @Override 051 protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { 052 xml.rightAngleBracket(); 053 xml.optElement("version", version); 054 xml.element(new ConfigurationElement(configuration)); 055 return xml; 056 } 057 058 /** 059 * Returns the version. 060 * 061 * @return the version 062 */ 063 public String getVersion() { 064 return version; 065 } 066 067 /** 068 * Returns the room configuration. 069 * 070 * @return the configuration of the room 071 */ 072 public MUCLightRoomConfiguration getConfiguration() { 073 return configuration; 074 } 075 076}