CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e
以下内容为反编译后的 SecurityOperation.java 源代码,内容仅作参考
package ak.im.module;
import ak.im.sdk.manager.f1;
import ak.im.utils.Log;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.json.JSONException;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.stringprep.XmppStringprepException;
import org.xmlpull.v1.XmlPullParser;
public class SecurityOperation extends IQ {
public static final String ELEMENT = "securityoperation";
public static final String NAMESPACE = "http://akey.im/protocol/xmpp/iq/securityoperation";
private static final String OPERATIONTYPE = "operationtype";
public static final String OPERATION_TYPE_1 = "bluetooth_shield_security_operation";
private static final String REGCODE = "regcode";
private static final String REQID = "reqid";
private static final String SECCODE = "seccode";
private static final String TAG = "SecurityOperationRequest";
boolean isSend;
private boolean isSuccess;
private String operationType;
private String regcode;
private String reqId;
private String seccode;
public static class Error {
public static final String DESCRIPTION = "description";
public static final String ERRORMSG = "errormsg";
public static final String RETURN_CODE = "return_code";
private int return_code;
private String errormsg = "";
private String description = "";
public static Error parseJson(String str) {
Error error = new Error();
if (str != null && !str.isEmpty()) {
JSONObject parseObject = JSON.parseObject(str);
error.description = parseObject.getString("description");
error.errormsg = parseObject.getString(ERRORMSG);
error.return_code = parseObject.getIntValue("return_code");
}
return error;
}
public String getDescription() {
return this.description;
}
public String getErrormsg() {
return this.errormsg;
}
public int getReturn_code() {
return this.return_code;
}
public void setDescription(String str) {
this.description = str;
}
public void setErrormsg(String str) {
this.errormsg = str;
}
public void setReturn_code(int i10) {
this.return_code = i10;
}
}
public static class Provider extends IQProvider {
@Override
public IQ parse(XmlPullParser xmlPullParser, int i10) throws Exception {
SecurityOperation securityOperation = new SecurityOperation();
Log.i(SecurityOperation.TAG, "parset :" + xmlPullParser.toString());
boolean z10 = false;
while (!z10) {
int next = xmlPullParser.next();
if (next == 4) {
securityOperation.parseResults(xmlPullParser);
} else if (next == 3 && xmlPullParser.getName().equals(SecurityOperation.ELEMENT)) {
z10 = true;
}
}
return securityOperation;
}
}
public SecurityOperation(String str) {
super(ELEMENT, NAMESPACE);
this.reqId = "";
this.isSuccess = false;
this.operationType = str;
setType(IQ.Type.get);
setTo(f1.getInstance().getServer().getXmppDomain());
this.isSend = true;
}
public static boolean checkReqid(String str) {
if (str != null && str.contains("-")) {
return true;
}
return false;
}
private void parseResultsJson(String str) {
Log.i(TAG, "parseResultsJson :" + str);
this.reqId = JSON.parseObject(str).getString(REQID);
Log.i(TAG, "parseResultsJson end " + this.reqId);
}
public IQ.IQChildElementXmlStringBuilder getChildElementXML1(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
org.json.JSONObject jSONObject = new org.json.JSONObject();
try {
jSONObject.put(SECCODE, this.seccode);
jSONObject.put(REGCODE, this.regcode);
jSONObject.put(REQID, this.reqId);
} catch (JSONException e10) {
e10.printStackTrace();
}
iQChildElementXmlStringBuilder.optElement(HiAnalyticsConstant.Direction.REQUEST, jSONObject.toString());
return iQChildElementXmlStringBuilder;
}
public IQ.IQChildElementXmlStringBuilder getChildElementXML2(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
org.json.JSONObject jSONObject = new org.json.JSONObject();
try {
jSONObject.put(OPERATIONTYPE, this.operationType);
} catch (JSONException e10) {
e10.printStackTrace();
}
iQChildElementXmlStringBuilder.optElement(HiAnalyticsConstant.Direction.REQUEST, jSONObject.toString());
return iQChildElementXmlStringBuilder;
}
@Override
protected IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
iQChildElementXmlStringBuilder.append(">");
if (this.isSend) {
if (getType() == IQ.Type.set) {
return getChildElementXML1(iQChildElementXmlStringBuilder);
}
return getChildElementXML2(iQChildElementXmlStringBuilder);
}
iQChildElementXmlStringBuilder.append((CharSequence) (this.isSuccess + ""));
return iQChildElementXmlStringBuilder;
}
public String getReqId() {
return this.reqId;
}
public boolean isSuccess() {
return this.isSuccess;
}
protected void parseResults(XmlPullParser xmlPullParser) throws Exception {
try {
String text = xmlPullParser.getText();
if (text.contains("{")) {
parseResults2(text);
} else {
parseResults1(text);
}
} catch (Exception e10) {
e10.printStackTrace();
}
}
protected void parseResults1(String str) {
try {
if (str.contains("success")) {
this.isSuccess = true;
}
} catch (Exception e10) {
e10.printStackTrace();
}
}
public void parseResults2(String str) throws Exception {
try {
parseResultsJson(str);
} catch (Exception e10) {
e10.printStackTrace();
}
}
public SecurityOperation(String str, String str2, String str3) {
super(ELEMENT, NAMESPACE);
this.isSuccess = false;
this.seccode = str;
this.regcode = str2;
this.reqId = str3;
setType(IQ.Type.set);
this.isSend = true;
try {
setTo(JidCreate.domainBareFrom(f1.getInstance().getServer().getXmppDomain()));
} catch (XmppStringprepException e10) {
e10.printStackTrace();
}
}
public SecurityOperation() {
super(ELEMENT, NAMESPACE);
this.reqId = "";
this.isSuccess = false;
}
}