2004-03-29 23:29:55 +02:00
|
|
|
/**
|
2004-11-03 00:37:00 +01:00
|
|
|
*
|
2007-02-12 01:59:05 +01:00
|
|
|
* Copyright 2003-2007 Jive Software.
|
2004-11-03 00:37:00 +01:00
|
|
|
*
|
2014-02-17 18:57:38 +01:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
2004-11-03 00:37:00 +01:00
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2004-03-29 23:29:55 +02:00
|
|
|
|
2014-02-15 11:35:08 +01:00
|
|
|
package org.jivesoftware.smackx.muc.packet;
|
2006-07-18 07:14:33 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
|
|
|
|
2012-10-26 12:47:55 +02:00
|
|
|
import org.jivesoftware.smack.packet.IQ;
|
|
|
|
|
2004-03-29 23:29:55 +02:00
|
|
|
/**
|
2018-05-09 23:06:12 +02:00
|
|
|
* IQ stanza that serves for kicking users, granting and revoking voice, banning users,
|
|
|
|
* modifying the ban list, granting and revoking membership and granting and revoking
|
|
|
|
* moderator privileges. All these operations are scoped by the
|
2004-04-05 18:23:27 +02:00
|
|
|
* 'http://jabber.org/protocol/muc#admin' namespace.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2004-03-29 23:29:55 +02:00
|
|
|
* @author Gaston Dombiak
|
|
|
|
*/
|
|
|
|
public class MUCAdmin extends IQ {
|
|
|
|
|
2014-11-07 21:12:01 +01:00
|
|
|
public static final String ELEMENT = QUERY_ELEMENT;
|
2014-07-14 19:22:02 +02:00
|
|
|
public static final String NAMESPACE = MUCInitialPresence.NAMESPACE + "#admin";
|
|
|
|
|
2017-12-13 23:10:11 +01:00
|
|
|
private final List<MUCItem> items = new ArrayList<>();
|
2004-04-05 18:23:27 +02:00
|
|
|
|
2014-11-07 21:12:01 +01:00
|
|
|
public MUCAdmin() {
|
|
|
|
super(ELEMENT, NAMESPACE);
|
|
|
|
}
|
|
|
|
|
2004-04-05 18:23:27 +02:00
|
|
|
/**
|
2017-12-13 23:10:11 +01:00
|
|
|
* Returns a List of item children that holds information about roles, affiliation,
|
2004-04-05 18:23:27 +02:00
|
|
|
* jids and nicks.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2017-12-13 23:10:11 +01:00
|
|
|
* @return a List of item children that holds information about roles, affiliation,
|
2004-04-05 18:23:27 +02:00
|
|
|
* jids and nicks.
|
|
|
|
*/
|
2014-07-14 19:22:02 +02:00
|
|
|
public List<MUCItem> getItems() {
|
2004-04-05 18:23:27 +02:00
|
|
|
synchronized (items) {
|
2017-12-13 23:10:11 +01:00
|
|
|
return Collections.unmodifiableList(new ArrayList<>(items));
|
2004-04-05 18:23:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds an item child that holds information about roles, affiliation, jids and nicks.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2004-04-05 18:23:27 +02:00
|
|
|
* @param item the item child that holds information about roles, affiliation, jids and nicks.
|
|
|
|
*/
|
2014-07-14 19:22:02 +02:00
|
|
|
public void addItem(MUCItem item) {
|
2004-04-05 18:23:27 +02:00
|
|
|
synchronized (items) {
|
|
|
|
items.add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-14 19:22:02 +02:00
|
|
|
@Override
|
2014-11-07 21:12:01 +01:00
|
|
|
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
|
2014-08-20 21:25:14 +02:00
|
|
|
xml.rightAngleBracket();
|
2014-11-07 21:12:01 +01:00
|
|
|
|
2004-04-05 18:23:27 +02:00
|
|
|
synchronized (items) {
|
2014-07-14 19:22:02 +02:00
|
|
|
for (MUCItem item : items) {
|
2019-02-04 13:27:41 +01:00
|
|
|
xml.append(item.toXML());
|
2004-04-05 18:23:27 +02:00
|
|
|
}
|
|
|
|
}
|
2014-11-07 21:12:01 +01:00
|
|
|
|
2014-07-14 19:22:02 +02:00
|
|
|
return xml;
|
2004-03-29 23:29:55 +02:00
|
|
|
}
|
|
|
|
}
|