Auto.java 1.7 KB
Newer Older
Alexander Ivanov's avatar
Alexander Ivanov committed
1 2
/**
 * Copyright (c) 2013, Redsolution LTD. All rights reserved.
3
 *
Alexander Ivanov's avatar
Alexander Ivanov committed
4 5
 * This file is part of Xabber project; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License, Version 3.
6
 *
Alexander Ivanov's avatar
Alexander Ivanov committed
7 8 9 10
 * Xabber is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
11
 *
Alexander Ivanov's avatar
Alexander Ivanov committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25
 * You should have received a copy of the GNU General Public License,
 * along with this program. If not, see http://www.gnu.org/licenses/.
 */
package com.xabber.xmpp.archive;

import java.io.IOException;

import org.xmlpull.v1.XmlSerializer;

import com.xabber.xmpp.IQ;
import com.xabber.xmpp.SerializerUtils;

/**
 * Packet to change automatic message archive preference.
26
 * <p/>
Alexander Ivanov's avatar
Alexander Ivanov committed
27
 * http://xmpp.org/extensions/xep-0136.html
28
 *
Alexander Ivanov's avatar
Alexander Ivanov committed
29 30 31 32
 * @author alexander.ivanov
 */
public class Auto extends IQ {

33 34
    public static final String ELEMENT_NAME = "auto";
    public static final String NAMESPACE = "urn:xmpp:archive";
Alexander Ivanov's avatar
Alexander Ivanov committed
35

36
    public static final String SAVE_ATTRIBUTE = "save";
Alexander Ivanov's avatar
Alexander Ivanov committed
37

38
    private boolean save;
Alexander Ivanov's avatar
Alexander Ivanov committed
39

40 41
    public Auto() {
    }
Alexander Ivanov's avatar
Alexander Ivanov committed
42

43 44 45 46
    @Override
    public void serializeContent(XmlSerializer serializer) throws IOException {
        SerializerUtils.setBooleanAttribute(serializer, SAVE_ATTRIBUTE, save);
    }
Alexander Ivanov's avatar
Alexander Ivanov committed
47

48 49 50 51
    @Override
    public boolean isValid() {
        return true;
    }
Alexander Ivanov's avatar
Alexander Ivanov committed
52

53 54 55 56
    @Override
    public String getElementName() {
        return ELEMENT_NAME;
    }
Alexander Ivanov's avatar
Alexander Ivanov committed
57

58 59 60 61
    @Override
    public String getNamespace() {
        return NAMESPACE;
    }
Alexander Ivanov's avatar
Alexander Ivanov committed
62

63 64 65
    public boolean isSave() {
        return save;
    }
Alexander Ivanov's avatar
Alexander Ivanov committed
66

67 68 69
    public void setSave(boolean save) {
        this.save = save;
    }
Alexander Ivanov's avatar
Alexander Ivanov committed
70 71

}