CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e
以下内容为反编译后的 OfflineMessageRequest.java 源代码,内容仅作参考
package org.jivesoftware.smackx.offline.packet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.amp.packet.AMPExtension;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
public class OfflineMessageRequest extends IQ {
public static final String ELEMENT = "offline";
public static final String NAMESPACE = "http://jabber.org/protocol/offline";
private boolean fetch;
private final List<Item> items;
private boolean purge;
public static class Item {
private String action;
private String jid;
private String node;
public Item(String str) {
this.node = str;
}
public String getAction() {
return this.action;
}
public String getJid() {
return this.jid;
}
public String getNode() {
return this.node;
}
public void setAction(String str) {
this.action = str;
}
public void setJid(String str) {
this.jid = str;
}
public String toXML() {
StringBuilder sb2 = new StringBuilder();
sb2.append("<item");
if (getAction() != null) {
sb2.append(" action=\"");
sb2.append(getAction());
sb2.append('\"');
}
if (getJid() != null) {
sb2.append(" jid=\"");
sb2.append(getJid());
sb2.append('\"');
}
if (getNode() != null) {
sb2.append(" node=\"");
sb2.append(getNode());
sb2.append('\"');
}
sb2.append("/>");
return sb2.toString();
}
}
public static class Provider extends IQProvider<OfflineMessageRequest> {
private static Item parseItem(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
Item item = new Item(xmlPullParser.getAttributeValue("", "node"));
item.setAction(xmlPullParser.getAttributeValue("", AMPExtension.Action.ATTRIBUTE_NAME));
item.setJid(xmlPullParser.getAttributeValue("", ParserUtils.JID));
boolean z10 = false;
while (!z10) {
if (xmlPullParser.next() == 3 && xmlPullParser.getName().equals("item")) {
z10 = true;
}
}
return item;
}
@Override
public OfflineMessageRequest parse(XmlPullParser xmlPullParser, int i10) throws XmlPullParserException, IOException {
OfflineMessageRequest offlineMessageRequest = new OfflineMessageRequest();
boolean z10 = false;
while (!z10) {
int next = xmlPullParser.next();
if (next == 2) {
if (xmlPullParser.getName().equals("item")) {
offlineMessageRequest.addItem(parseItem(xmlPullParser));
} else if (xmlPullParser.getName().equals("purge")) {
offlineMessageRequest.setPurge(true);
} else if (xmlPullParser.getName().equals("fetch")) {
offlineMessageRequest.setFetch(true);
}
} else if (next == 3 && xmlPullParser.getName().equals(OfflineMessageRequest.ELEMENT)) {
z10 = true;
}
}
return offlineMessageRequest;
}
}
public OfflineMessageRequest() {
super(ELEMENT, NAMESPACE);
this.items = new ArrayList();
this.purge = false;
this.fetch = false;
}
public void addItem(Item item) {
synchronized (this.items) {
this.items.add(item);
}
}
@Override
protected IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
iQChildElementXmlStringBuilder.rightAngleBracket();
synchronized (this.items) {
Iterator<Item> it = this.items.iterator();
while (it.hasNext()) {
iQChildElementXmlStringBuilder.append((CharSequence) it.next().toXML());
}
}
if (this.purge) {
iQChildElementXmlStringBuilder.append("<purge/>");
}
if (this.fetch) {
iQChildElementXmlStringBuilder.append("<fetch/>");
}
return iQChildElementXmlStringBuilder;
}
public List<Item> getItems() {
List<Item> unmodifiableList;
synchronized (this.items) {
unmodifiableList = Collections.unmodifiableList(new ArrayList(this.items));
}
return unmodifiableList;
}
public boolean isFetch() {
return this.fetch;
}
public boolean isPurge() {
return this.purge;
}
public void setFetch(boolean z10) {
this.fetch = z10;
}
public void setPurge(boolean z10) {
this.purge = z10;
}
}