CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e
以下内容为反编译后的 MultipleAddresses.java 源代码,内容仅作参考
package org.jivesoftware.smackx.address.packet;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jxmpp.jid.Jid;
public class MultipleAddresses implements ExtensionElement {
public static final String ELEMENT = "addresses";
public static final String NAMESPACE = "http://jabber.org/protocol/address";
private final List<Address> addresses = new ArrayList();
public static final class Address implements NamedElement {
public static final String ELEMENT = "address";
private boolean delivered;
private String description;
private Jid jid;
private String node;
private final Type type;
private String uri;
public void setDelivered(boolean z10) {
this.delivered = z10;
}
public void setDescription(String str) {
this.description = str;
}
public void setJid(Jid jid) {
this.jid = jid;
}
public void setNode(String str) {
this.node = str;
}
public void setUri(String str) {
this.uri = str;
}
public String getDescription() {
return this.description;
}
@Override
public String getElementName() {
return ELEMENT;
}
public Jid getJid() {
return this.jid;
}
public String getNode() {
return this.node;
}
public Type getType() {
return this.type;
}
public String getUri() {
return this.uri;
}
public boolean isDelivered() {
return this.delivered;
}
private Address(Type type) {
this.type = type;
}
@Override
public XmlStringBuilder toXML() {
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder();
xmlStringBuilder.halfOpenElement(this).attribute("type", this.type);
xmlStringBuilder.optAttribute(ParserUtils.JID, this.jid);
xmlStringBuilder.optAttribute("node", this.node);
xmlStringBuilder.optAttribute("desc", this.description);
String str = this.description;
if (str != null && str.trim().length() > 0) {
xmlStringBuilder.append((CharSequence) " desc=\"");
xmlStringBuilder.append((CharSequence) this.description).append('\"');
}
xmlStringBuilder.optBooleanAttribute("delivered", this.delivered);
xmlStringBuilder.optAttribute("uri", this.uri);
xmlStringBuilder.closeEmptyElement();
return xmlStringBuilder;
}
}
public enum Type {
bcc,
cc,
noreply,
replyroom,
replyto,
to,
ofrom
}
public void addAddress(Type type, Jid jid, String str, String str2, boolean z10, String str3) {
Address address = new Address(type);
address.setJid(jid);
address.setNode(str);
address.setDescription(str2);
address.setDelivered(z10);
address.setUri(str3);
this.addresses.add(address);
}
public List<Address> getAddressesOfType(Type type) {
ArrayList arrayList = new ArrayList(this.addresses.size());
for (Address address : this.addresses) {
if (address.getType().equals(type)) {
arrayList.add(address);
}
}
return arrayList;
}
@Override
public String getElementName() {
return ELEMENT;
}
@Override
public String getNamespace() {
return NAMESPACE;
}
public void setNoReply() {
this.addresses.add(new Address(Type.noreply));
}
@Override
public XmlStringBuilder toXML() {
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder((ExtensionElement) this);
xmlStringBuilder.rightAngleBracket();
Iterator<Address> it = this.addresses.iterator();
while (it.hasNext()) {
xmlStringBuilder.append(it.next().toXML());
}
xmlStringBuilder.closeElement(this);
return xmlStringBuilder;
}
}