CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e
以下内容为反编译后的 MUCInitialPresence.java 源代码,内容仅作参考
package org.jivesoftware.smackx.muc.packet;
import java.util.Date;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jxmpp.util.XmppDateTime;
public class MUCInitialPresence implements ExtensionElement {
public static final String ELEMENT = "x";
public static final String NAMESPACE = "http://jabber.org/protocol/muc";
private History history;
private String password;
public static class History implements NamedElement {
public static final String ELEMENT = "history";
private int maxChars;
private int maxStanzas;
private int seconds;
private Date since;
@Deprecated
public History() {
this.maxChars = -1;
this.maxStanzas = -1;
this.seconds = -1;
}
@Override
public String getElementName() {
return ELEMENT;
}
public int getMaxChars() {
return this.maxChars;
}
public int getMaxStanzas() {
return this.maxStanzas;
}
public int getSeconds() {
return this.seconds;
}
public Date getSince() {
return this.since;
}
@Deprecated
public void setMaxChars(int i10) {
this.maxChars = i10;
}
@Deprecated
public void setMaxStanzas(int i10) {
this.maxStanzas = i10;
}
@Deprecated
public void setSeconds(int i10) {
this.seconds = i10;
}
@Deprecated
public void setSince(Date date) {
this.since = date;
}
@Override
public XmlStringBuilder toXML() {
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder(this);
xmlStringBuilder.optIntAttribute("maxchars", getMaxChars());
xmlStringBuilder.optIntAttribute("maxstanzas", getMaxStanzas());
xmlStringBuilder.optIntAttribute("seconds", getSeconds());
if (getSince() != null) {
xmlStringBuilder.attribute("since", XmppDateTime.formatXEP0082Date(getSince()));
}
xmlStringBuilder.closeEmptyElement();
return xmlStringBuilder;
}
public History(int i10, int i11, int i12, Date date) {
if (i10 < 0 && i11 < 0 && i12 < 0 && date == null) {
throw new IllegalArgumentException();
}
this.maxChars = i10;
this.maxStanzas = i11;
this.seconds = i12;
this.since = date;
}
}
@Deprecated
public MUCInitialPresence() {
}
public static MUCInitialPresence from(Stanza stanza) {
return (MUCInitialPresence) stanza.getExtension("x", NAMESPACE);
}
@Deprecated
public static MUCInitialPresence getFrom(Stanza stanza) {
return from(stanza);
}
@Override
public String getElementName() {
return "x";
}
public History getHistory() {
return this.history;
}
@Override
public String getNamespace() {
return NAMESPACE;
}
public String getPassword() {
return this.password;
}
@Deprecated
public void setHistory(History history) {
this.history = history;
}
@Deprecated
public void setPassword(String str) {
this.password = str;
}
public MUCInitialPresence(String str, int i10, int i11, int i12, Date date) {
this.password = str;
if (i10 <= -1 && i11 <= -1 && i12 <= -1 && date == null) {
this.history = null;
} else {
this.history = new History(i10, i11, i12, date);
}
}
@Override
public XmlStringBuilder toXML() {
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder((ExtensionElement) this);
xmlStringBuilder.rightAngleBracket();
xmlStringBuilder.optElement("password", getPassword());
xmlStringBuilder.optElement(getHistory());
xmlStringBuilder.closeElement(this);
return xmlStringBuilder;
}
}