CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05

以下内容为反编译后的 y2.java 源代码,内容仅作参考


package ak.smack;

import ak.im.BuildConfig;
import ak.im.module.GroupUser;
import ak.im.sdk.manager.BadgeManager;
import ak.im.sdk.manager.ye;
import ak.im.utils.Log;
import ak.push.AKPushManager;
import android.text.TextUtils;
import com.alibaba.fastjson.JSONObject;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.kinggrid.iapppdf.droids.mupdf.codec.cosobject.PdfBoolean;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
public class y2 extends IQ {
    private static String a = "pushServiceType";
    private final String f4806b;
    private final String f4807c;
    private final String f4808d;
    private final String f4809e;
    private final String f;
    private final String g;
    private final String h;
    private final String i;
    private final String j;
    private String k;
    private String l;
    private String m;
    private boolean n;
    private boolean o;
    private String p;
    private boolean q;
    private boolean r;
    private boolean s;
    private boolean t;
    private boolean u;

    public y2(boolean z, String str) {
        super("xiaomipush", "http://akey.im/protocol/xmpp/iq/xiaomipush");
        this.f4806b = "PushClientExtension";
        this.f4807c = GroupUser.USER_NAME;
        this.f4808d = "phonetype";
        this.f4809e = "operation";
        this.f = "android";
        this.g = "add";
        this.h = DiscoverItems.Item.REMOVE_ACTION;
        this.i = "chat";
        this.j = "away";
        this.k = "deviceToken";
        this.l = "pushKitDeviceToken";
        this.m = "supportMCU";
        this.n = false;
        this.o = true;
        this.q = true;
        this.r = true;
        this.s = true;
        this.t = true;
        this.u = false;
        this.p = str;
        setType(IQ.Type.set);
        setTo(ye.getInstance().getServer().getXmppDomain());
        setFrom(ak.im.utils.n5.getJidByName(ye.getInstance().getUsername()));
        this.n = z;
        a();
    }

    void a() {
        this.r = ye.getInstance().isNormalMessageSwitch();
        this.s = ye.getInstance().isSipMessageSwitch();
        this.q = ye.getInstance().isSipMessageSwitch();
    }

    String b(String str) {
        return (BadgeManager.MANUFACTURER_OF_HARDWARE_HUAWEI.equals(str) || "oppo".equals(str) || BadgeManager.MANUFACTURER_OF_HARDWARE_VIVO.equals(str) || "meizu".equals(str) || "fcm".equals(str)) ? str : "xiaomi";
    }

    @Override
    protected IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
        iQChildElementXmlStringBuilder.append(">");
        if (!TextUtils.isEmpty(this.p)) {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put(GroupUser.USER_NAME, (Object) ye.getInstance().getUsername());
            if (this.n) {
                jSONObject.put("operation", (Object) "add");
                jSONObject.put("phonetype", (Object) "android");
                jSONObject.put(this.l, (Object) "");
                jSONObject.put("product_type", (Object) BuildConfig.PRODUCT_TYPE);
                if (!"xiaomi".equals(b(this.p))) {
                    jSONObject.put(a, (Object) b(this.p));
                }
                String obtainId = AKPushManager.a.getInstance().obtainId();
                jSONObject.put(this.k, (Object) obtainId);
                jSONObject.put("supportDesktopVoip", (Object) Boolean.TRUE);
                jSONObject.put("im_push_type", (Object) b(this.p));
                jSONObject.put("im_push_token", (Object) obtainId);
                jSONObject.put("cp_resend_count", (Object) 2);
                jSONObject.put("cp_resend_interval", (Object) 20);
                jSONObject.put("call_push_type", (Object) ("fcm".equals(this.p) ? "fcm_data" : "xiaomi"));
                jSONObject.put("call_push_token", (Object) ("fcm".equals(this.p) ? obtainId : ""));
                jSONObject.put("supportIM", (Object) Boolean.valueOf(this.r));
                jSONObject.put("supportVoIP", (Object) Boolean.valueOf(this.q));
                jSONObject.put(this.m, (Object) Boolean.valueOf(this.s));
                jSONObject.put("call_push_token_xiaomi", (Object) ("xiaomi".equals(this.p) ? obtainId : ""));
                jSONObject.put("version", (Object) ye.getInstance().getVersion());
                jSONObject.put("package", (Object) BuildConfig.PRODUCT_PKG_NAME);
                if (this.u) {
                    jSONObject.put("feedback", (Object) PdfBoolean.TRUE);
                }
            } else {
                jSONObject.put("operation", (Object) DiscoverItems.Item.REMOVE_ACTION);
            }
            Log.debug("xiaomipush", jSONObject.toJSONString());
            iQChildElementXmlStringBuilder.optElement(HiAnalyticsConstant.Direction.REQUEST, jSONObject.toString());
        } else if (this.n) {
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put(GroupUser.USER_NAME, (Object) ye.getInstance().getUsername());
            jSONObject2.put("operation", (Object) (this.o ? "chat" : "away"));
            jSONObject2.put("phonetype", (Object) "android");
            iQChildElementXmlStringBuilder.optElement(HiAnalyticsConstant.Direction.REQUEST, jSONObject2.toString());
            Log.i("PushClientExtension", "generate online status push iq " + this.o);
        } else {
            Log.i("PushClientExtension", "invalid push iq params: online " + this.n + ", type " + this.p + ", gochat " + this.o);
        }
        return iQChildElementXmlStringBuilder;
    }

    public void setFeedback(boolean z) {
        this.u = z;
    }

    public void setNormalPush(boolean z) {
        this.t = z;
    }

    public void setSupportIM(boolean z) {
        this.r = z;
    }

    public void setSupportMcu(boolean z) {
        this.s = z;
    }

    public void setSupportVoIP(boolean z) {
        this.q = z;
    }

    public y2(boolean z) {
        super("xiaomipush", "http://akey.im/protocol/xmpp/iq/xiaomipush");
        this.f4806b = "PushClientExtension";
        this.f4807c = GroupUser.USER_NAME;
        this.f4808d = "phonetype";
        this.f4809e = "operation";
        this.f = "android";
        this.g = "add";
        this.h = DiscoverItems.Item.REMOVE_ACTION;
        this.i = "chat";
        this.j = "away";
        this.k = "deviceToken";
        this.l = "pushKitDeviceToken";
        this.m = "supportMCU";
        this.n = false;
        this.o = true;
        this.q = true;
        this.r = true;
        this.s = true;
        this.t = true;
        this.u = false;
        setType(IQ.Type.set);
        setTo(ye.getInstance().getServer().getXmppDomain());
        setFrom(ak.im.utils.n5.getJidByName(ye.getInstance().getUsername()));
        this.n = true;
        this.o = z;
        a();
    }

    public y2() {
        super("xiaomipush", "http://akey.im/protocol/xmpp/iq/xiaomipush");
        this.f4806b = "PushClientExtension";
        this.f4807c = GroupUser.USER_NAME;
        this.f4808d = "phonetype";
        this.f4809e = "operation";
        this.f = "android";
        this.g = "add";
        this.h = DiscoverItems.Item.REMOVE_ACTION;
        this.i = "chat";
        this.j = "away";
        this.k = "deviceToken";
        this.l = "pushKitDeviceToken";
        this.m = "supportMCU";
        this.n = false;
        this.o = true;
        this.q = true;
        this.r = true;
        this.s = true;
        this.t = true;
        this.u = false;
    }
}