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.MultiUserChatLight;
021import org.jxmpp.jid.Jid;
022
023/**
024 * MUC Light get affiliations IQ class.
025 * 
026 * @author Fernando Ramirez
027 *
028 */
029public class MUCLightGetAffiliationsIQ extends IQ {
030
031    public static final String ELEMENT = QUERY_ELEMENT;
032    public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
033
034    private String version;
035
036    /**
037     * MUC Light get affiliations IQ constructor.
038     * 
039     * @param roomJid
040     * @param version
041     */
042    public MUCLightGetAffiliationsIQ(Jid roomJid, String version) {
043        super(ELEMENT, NAMESPACE);
044        this.version = version;
045        this.setType(Type.get);
046        this.setTo(roomJid);
047    }
048
049    /**
050     * MUC Light get affiliations IQ constructor.
051     * 
052     * @param roomJid
053     */
054    public MUCLightGetAffiliationsIQ(Jid roomJid) {
055        this(roomJid, null);
056    }
057
058    @Override
059    protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
060        xml.rightAngleBracket();
061        xml.optElement("version", version);
062        return xml;
063    }
064
065}