CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e
以下内容为反编译后的 StreamInitiation.java 源代码,内容仅作参考
package org.jivesoftware.smackx.si.packet;
import ak.im.module.ChatMessage;
import java.util.Date;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.filetransfer.FileTransferNegotiator;
import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.jxmpp.util.XmppDateTime;
public class StreamInitiation extends IQ {
public static final String ELEMENT = "si";
public static final String NAMESPACE = "http://jabber.org/protocol/si";
private Feature featureNegotiation;
private File file;
private String f44535id;
private String mimeType;
static class AnonymousClass1 {
static final int[] $SwitchMap$org$jivesoftware$smack$packet$IQ$Type;
static {
int[] iArr = new int[IQ.Type.values().length];
$SwitchMap$org$jivesoftware$smack$packet$IQ$Type = iArr;
try {
iArr[IQ.Type.set.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$org$jivesoftware$smack$packet$IQ$Type[IQ.Type.result.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
public static class Feature implements ExtensionElement {
private final DataForm data;
public Feature(DataForm dataForm) {
this.data = dataForm;
}
public DataForm getData() {
return this.data;
}
@Override
public String getElementName() {
return "feature";
}
@Override
public String getNamespace() {
return "http://jabber.org/protocol/feature-neg";
}
@Override
public String toXML() {
return "<feature xmlns=\"http://jabber.org/protocol/feature-neg\">" + ((CharSequence) this.data.toXML()) + "</feature>";
}
}
public static class File implements ExtensionElement {
private Date date;
private String desc;
private String hash;
private boolean isRanged;
private final String name;
private final long size;
public File(String str, long j10) {
if (str != null) {
this.name = str;
this.size = j10;
return;
}
throw new NullPointerException("name cannot be null");
}
public Date getDate() {
return this.date;
}
public String getDesc() {
return this.desc;
}
@Override
public String getElementName() {
return ChatMessage.CHAT_FILE;
}
public String getHash() {
return this.hash;
}
public String getName() {
return this.name;
}
@Override
public String getNamespace() {
return FileTransferNegotiator.SI_PROFILE_FILE_TRANSFER_NAMESPACE;
}
public long getSize() {
return this.size;
}
public boolean isRanged() {
return this.isRanged;
}
public void setDate(Date date) {
this.date = date;
}
public void setDesc(String str) {
this.desc = str;
}
public void setHash(String str) {
this.hash = str;
}
public void setRanged(boolean z10) {
this.isRanged = z10;
}
@Override
public String toXML() {
StringBuilder sb2 = new StringBuilder();
sb2.append('<');
sb2.append(getElementName());
sb2.append(" xmlns=\"");
sb2.append(getNamespace());
sb2.append("\" ");
if (getName() != null) {
sb2.append("name=\"");
sb2.append(StringUtils.escapeForXmlAttribute(getName()));
sb2.append("\" ");
}
if (getSize() > 0) {
sb2.append("size=\"");
sb2.append(getSize());
sb2.append("\" ");
}
if (getDate() != null) {
sb2.append("date=\"");
sb2.append(XmppDateTime.formatXEP0082Date(this.date));
sb2.append("\" ");
}
if (getHash() != null) {
sb2.append("hash=\"");
sb2.append(getHash());
sb2.append("\" ");
}
String str = this.desc;
if ((str != null && str.length() > 0) || this.isRanged) {
sb2.append('>');
if (getDesc() != null && this.desc.length() > 0) {
sb2.append("<desc>");
sb2.append(StringUtils.escapeForXmlText(getDesc()));
sb2.append("</desc>");
}
if (isRanged()) {
sb2.append("<range/>");
}
sb2.append("</");
sb2.append(getElementName());
sb2.append('>');
} else {
sb2.append("/>");
}
return sb2.toString();
}
}
public StreamInitiation() {
super(ELEMENT, "http://jabber.org/protocol/si");
}
public DataForm getFeatureNegotiationForm() {
return this.featureNegotiation.getData();
}
public File getFile() {
return this.file;
}
@Override
protected IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
int i10 = AnonymousClass1.$SwitchMap$org$jivesoftware$smack$packet$IQ$Type[getType().ordinal()];
if (i10 != 1) {
if (i10 == 2) {
iQChildElementXmlStringBuilder.rightAngleBracket();
} else {
throw new IllegalArgumentException("IQ Type not understood");
}
} else {
iQChildElementXmlStringBuilder.optAttribute("id", getSessionID());
iQChildElementXmlStringBuilder.optAttribute("mime-type", getMimeType());
iQChildElementXmlStringBuilder.attribute("profile", FileTransferNegotiator.SI_PROFILE_FILE_TRANSFER_NAMESPACE);
iQChildElementXmlStringBuilder.rightAngleBracket();
iQChildElementXmlStringBuilder.optAppend(this.file.toXML());
}
Feature feature = this.featureNegotiation;
if (feature != null) {
iQChildElementXmlStringBuilder.append((CharSequence) feature.toXML());
}
return iQChildElementXmlStringBuilder;
}
public String getMimeType() {
return this.mimeType;
}
public String getSessionID() {
return this.f44535id;
}
public void setFeatureNegotiationForm(DataForm dataForm) {
this.featureNegotiation = new Feature(dataForm);
}
public void setFile(File file) {
this.file = file;
}
public void setMimeType(String str) {
this.mimeType = str;
}
public void setSessionID(String str) {
this.f44535id = str;
}
}