正在查看: bbinstant v6.24.0 应用的 MultipleAddresses.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: bbinstant v6.24.0 应用的 MultipleAddresses.java JAVA 源代码文件
本页面展示 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.jivesoftware.smackx.iot.data.element.NodeElement;
import org.jxmpp.jid.i;
public class MultipleAddresses implements ExtensionElement {
public static final String ELEMENT = "addresses";
public static final String NAMESPACE = "http://jabber.org/protocol/address";
private 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 i jid;
private String node;
private final Type type;
private String uri;
public void setDelivered(boolean z) {
this.delivered = z;
}
public void setDescription(String str) {
this.description = str;
}
public void setJid(i iVar) {
this.jid = iVar;
}
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 i 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(NodeElement.ELEMENT, 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, i iVar, String str, String str2, boolean z, String str3) {
Address address = new Address(type);
address.setJid(iVar);
address.setNode(str);
address.setDescription(str2);
address.setDelivered(z);
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;
}
}