CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e
以下内容为反编译后的 DiscoverItems.java 源代码,内容仅作参考
package org.jivesoftware.smackx.disco.packet;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.amp.packet.AMPExtension;
import org.jxmpp.jid.Jid;
public class DiscoverItems extends IQ {
public static final String ELEMENT = "query";
public static final String NAMESPACE = "http://jabber.org/protocol/disco#items";
private final List<Item> items;
private String node;
public static class Item {
public static final String REMOVE_ACTION = "remove";
public static final String UPDATE_ACTION = "update";
private String action;
private final Jid entityID;
private String name;
private String node;
public Item(Jid jid) {
this.entityID = jid;
}
public String getAction() {
return this.action;
}
public Jid getEntityID() {
return this.entityID;
}
public String getName() {
return this.name;
}
public String getNode() {
return this.node;
}
public void setAction(String str) {
this.action = str;
}
public void setName(String str) {
this.name = str;
}
public void setNode(String str) {
this.node = str;
}
public XmlStringBuilder toXML() {
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder();
xmlStringBuilder.halfOpenElement("item");
xmlStringBuilder.attribute(ParserUtils.JID, this.entityID);
xmlStringBuilder.optAttribute("name", this.name);
xmlStringBuilder.optAttribute("node", this.node);
xmlStringBuilder.optAttribute(AMPExtension.Action.ATTRIBUTE_NAME, this.action);
xmlStringBuilder.closeEmptyElement();
return xmlStringBuilder;
}
}
public DiscoverItems() {
super("query", NAMESPACE);
this.items = new LinkedList();
}
public void addItem(Item item) {
this.items.add(item);
}
public void addItems(Collection<Item> collection) {
if (collection == null) {
return;
}
Iterator<Item> it = collection.iterator();
while (it.hasNext()) {
addItem(it.next());
}
}
@Override
protected IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
iQChildElementXmlStringBuilder.optAttribute("node", getNode());
iQChildElementXmlStringBuilder.rightAngleBracket();
Iterator<Item> it = this.items.iterator();
while (it.hasNext()) {
iQChildElementXmlStringBuilder.append(it.next().toXML());
}
return iQChildElementXmlStringBuilder;
}
public List<Item> getItems() {
return Collections.unmodifiableList(this.items);
}
public String getNode() {
return this.node;
}
public void setNode(String str) {
this.node = str;
}
}