CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05
以下内容为反编译后的 u4.java 源代码,内容仅作参考
package ak.smack;
import ak.im.module.User;
import ak.im.sdk.manager.nf;
import ak.im.sdk.manager.ye;
import ak.im.utils.Log;
import com.asim.protobuf.Akeychat;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import java.util.HashMap;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.xmlpull.v1.XmlPullParser;
public class u4 extends IQ {
private final String a;
private Akeychat.UserBasicGetResponse f4713b;
private String f4714c;
private HashMap<String, User> f4715d;
public static class a extends IQProvider {
@Override
public IQ parse(XmlPullParser xmlPullParser, int i) throws Exception {
u4 u4Var = new u4();
boolean z = false;
while (!z) {
int next = xmlPullParser.next();
if (next == 4) {
u4Var.parseResults(xmlPullParser);
} else if (next == 3 && xmlPullParser.getName().equals("userbasic")) {
z = true;
}
}
return u4Var;
}
}
public u4(String str) {
super("userbasic", "http://akey.im/protocol/xmpp/iq/userbasic");
setType(IQ.Type.get);
setFrom(nf.getInstance().getUserMe().getJID());
if (ak.im.utils.n5.isContainsSplicer(str)) {
String[] split = str.split("#");
this.a = split[0];
Akeychat.ServerSyncResponseV2 serverById = ye.getInstance().getServerById(split[1]);
if (serverById != null) {
setTo(serverById.getDomain());
return;
} else {
Log.i("QueryUserBasicStranger", "serverById is null");
return;
}
}
this.a = str;
setTo(ye.getInstance().getServer().getXmppDomain());
}
private User a(Akeychat.UserBasicSearchInfo userBasicSearchInfo) {
User generateAStranger = userBasicSearchInfo.hasUser() ? nf.getInstance().generateAStranger(userBasicSearchInfo.getUser(), null) : null;
userBasicSearchInfo.hasIsFriend();
if (userBasicSearchInfo.hasAkeyid()) {
generateAStranger.setAkeyId(userBasicSearchInfo.getAkeyid());
}
return generateAStranger;
}
@Override
protected IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
iQChildElementXmlStringBuilder.append(">");
if (this.a != null) {
Akeychat.UserBasicGetRequest.b newBuilder = Akeychat.UserBasicGetRequest.newBuilder();
newBuilder.setFilter(this.a);
iQChildElementXmlStringBuilder.optElement(HiAnalyticsConstant.Direction.REQUEST, ak.comm.d.encodeBytes(newBuilder.build().toByteArray()));
} else {
String str = this.f4714c;
if (str != null) {
iQChildElementXmlStringBuilder.optElement("result", str);
}
}
return iQChildElementXmlStringBuilder;
}
public Akeychat.UserBasicGetResponse getStrangersResponse() {
return this.f4713b;
}
public User getUser(String str) {
HashMap<String, User> hashMap;
if (ak.im.utils.n5.isEmptyString(str) || (hashMap = this.f4715d) == null) {
return null;
}
return hashMap.get(str);
}
public HashMap<String, User> getmQueryedUsers() {
if (!getTo().getDomain().toString().equals(ye.getInstance().getCurrentServerDomain())) {
HashMap<String, User> hashMap = null;
for (String str : this.f4715d.keySet()) {
User user = this.f4715d.get(str);
if (user != null) {
if (!user.getName().contains("#")) {
Log.i("lwxtest", "user is " + user.getJID() + "\n" + user.getName());
StringBuilder sb = new StringBuilder();
sb.append(user.getName());
sb.append("@");
sb.append(getTo().getDomain().toString());
user.setJID(sb.toString());
user.setName(nf.getInstance().getUserNameByJid(user.getJID()));
}
Log.i("lwxtest", "user1 is " + user.getJID() + "\n" + user.getName());
if (hashMap == null) {
hashMap = new HashMap<>();
}
hashMap.put(user.getName(), user);
}
}
if (hashMap != null) {
return hashMap;
}
}
return this.f4715d;
}
protected void parseResults(XmlPullParser xmlPullParser) throws Exception {
try {
String text = xmlPullParser.getText();
this.f4714c = text;
Akeychat.UserBasicGetResponse parseFrom = Akeychat.UserBasicGetResponse.parseFrom(ak.comm.d.decode(text));
this.f4713b = parseFrom;
for (Akeychat.UserBasicSearchInfo userBasicSearchInfo : parseFrom.getUsersList()) {
if (userBasicSearchInfo.getUser() != null) {
User a2 = a(userBasicSearchInfo);
if (this.f4715d == null) {
this.f4715d = new HashMap<>();
}
if (a2 != null) {
this.f4715d.put(a2.getName(), a2);
}
}
}
if (this.f4715d != null) {
Log.i("QueryUserBasicStranger", "result:" + this.f4713b.getResult() + " userList size:" + this.f4715d.size());
return;
}
Log.w("QueryUserBasicStranger", "emtpy result or some err");
} catch (Exception e2) {
e2.printStackTrace();
}
}
public u4(String str, q1 q1Var) {
super("userbasic", "http://akey.im/protocol/xmpp/iq/userbasic");
setType(IQ.Type.get);
setTo(q1Var.getTo());
setFrom(nf.getInstance().getUserMe().getJID());
this.a = str;
}
public u4() {
super("userbasic", "http://akey.im/protocol/xmpp/iq/userbasic");
setType(IQ.Type.get);
setTo(ye.getInstance().getServer().getXmppDomain());
setFrom(nf.getInstance().getUserMe().getJID());
this.a = null;
}
}