CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e
以下内容为反编译后的 XMPPConnectionManager.java 源代码,内容仅作参考
package ak.im.sdk.manager;
import ak.application.AKApplication;
import ak.event.DefineXmppErrorEvent;
import ak.im.module.AkeyChatX509PrivateCA;
import ak.im.module.BaseField;
import ak.im.module.BleConstant;
import ak.im.module.DelMessagePresence;
import ak.im.module.DelSession;
import ak.im.module.IQException;
import ak.im.module.MUCMemberAliasUpdate;
import ak.im.module.SecurityOperation;
import ak.im.module.Server;
import ak.im.ui.activity.UserConflictActivity;
import ak.im.uitls.AKCAppConfiguration;
import ak.im.uitls.AKCCheckPoint;
import ak.im.utils.AkeyChatUtils;
import ak.im.utils.FileUtil;
import ak.im.utils.HttpURLTools;
import ak.im.utils.Log;
import ak.smack.AKLoginException;
import ak.smack.AKSASLMechanism;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.asim.protobuf.Akeychat;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.meizu.cloud.pushsdk.notification.model.NotifyType;
import com.view.universalping.UniversalPing;
import java.io.File;
import java.lang.ref.WeakReference;
import java.net.InetAddress;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import kotlin.Metadata;
import org.jetbrains.anko.AnkoAsyncContext;
import org.jetbrains.anko.AsyncKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.SASLAuthentication;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.StanzaListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.bosh.BOSHConfiguration;
import org.jivesoftware.smack.bosh.XMPPBOSHConnection;
import org.jivesoftware.smack.debugger.ReflectionDebuggerFactory;
import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.filter.StanzaIdFilter;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Session;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.StreamError;
import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.roster.Roster;
import org.jivesoftware.smack.roster.provider.RosterPacketProvider;
import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
import org.jivesoftware.smack.sm.packet.StreamManagement;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
import org.jivesoftware.smack.util.TLSUtils;
import org.jivesoftware.smackx.address.packet.MultipleAddresses;
import org.jivesoftware.smackx.address.provider.MultipleAddressesProvider;
import org.jivesoftware.smackx.chatstates.provider.ChatStateExtensionProvider;
import org.jivesoftware.smackx.delay.DelayInformationManager;
import org.jivesoftware.smackx.delay.packet.DelayInformation;
import org.jivesoftware.smackx.delay.provider.DelayInformationProvider;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
import org.jivesoftware.smackx.disco.provider.DiscoverInfoProvider;
import org.jivesoftware.smackx.disco.provider.DiscoverItemsProvider;
import org.jivesoftware.smackx.iqlast.packet.LastActivity;
import org.jivesoftware.smackx.iqprivate.PrivateDataManager;
import org.jivesoftware.smackx.iqprivate.packet.PrivateDataIQ;
import org.jivesoftware.smackx.iqversion.packet.Version;
import org.jivesoftware.smackx.muc.packet.Destroy;
import org.jivesoftware.smackx.muc.packet.GroupChatInvitation;
import org.jivesoftware.smackx.muc.packet.MUCAdmin;
import org.jivesoftware.smackx.muc.packet.MUCOwner;
import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.jivesoftware.smackx.muc.provider.MUCAdminProvider;
import org.jivesoftware.smackx.muc.provider.MUCOwnerProvider;
import org.jivesoftware.smackx.offline.packet.OfflineMessageInfo;
import org.jivesoftware.smackx.offline.packet.OfflineMessageRequest;
import org.jivesoftware.smackx.ping.PingManager;
import org.jivesoftware.smackx.receipts.DeliveryReceipt;
import org.jivesoftware.smackx.receipts.DeliveryReceiptRequest;
import org.jivesoftware.smackx.search.UserSearch;
import org.jivesoftware.smackx.sharedgroups.packet.SharedGroupsInfo;
import org.jivesoftware.smackx.si.packet.StreamInitiation;
import org.jivesoftware.smackx.si.provider.StreamInitiationProvider;
import org.jivesoftware.smackx.vcardtemp.provider.VCardProvider;
import org.jivesoftware.smackx.xdata.provider.DataFormProvider;
import org.jivesoftware.smackx.xhtmlim.XHTMLText;
import org.jivesoftware.smackx.xhtmlim.packet.XHTMLExtension;
import org.jivesoftware.smackx.xhtmlim.provider.XHTMLExtensionProvider;
import org.pjsip.pjsua2.app.SipCall;
import org.pjsip.pjsua2.app.VoIpManager;
import y0.a0;
import y0.a1;
import y0.a3;
import y0.a4;
import y0.a5;
import y0.b0;
import y0.b1;
import y0.b3;
import y0.b4;
import y0.b5;
import y0.b6;
import y0.c0;
import y0.c1;
import y0.c2;
import y0.c3;
import y0.c4;
import y0.c5;
import y0.c6;
import y0.d0;
import y0.d1;
import y0.d2;
import y0.d3;
import y0.d4;
import y0.d5;
import y0.d6;
import y0.e;
import y0.e0;
import y0.e1;
import y0.e2;
import y0.e3;
import y0.e4;
import y0.e6;
import y0.f;
import y0.f0;
import y0.f1;
import y0.f2;
import y0.f3;
import y0.f4;
import y0.f6;
import y0.g;
import y0.g0;
import y0.g1;
import y0.g2;
import y0.g3;
import y0.g4;
import y0.g5;
import y0.g6;
import y0.h;
import y0.h0;
import y0.h1;
import y0.h2;
import y0.h3;
import y0.h4;
import y0.h6;
import y0.i;
import y0.i0;
import y0.i1;
import y0.i2;
import y0.i3;
import y0.i4;
import y0.i5;
import y0.i6;
import y0.j;
import y0.j1;
import y0.j2;
import y0.j3;
import y0.j4;
import y0.j6;
import y0.k;
import y0.k1;
import y0.k2;
import y0.k3;
import y0.k4;
import y0.k5;
import y0.k6;
import y0.l;
import y0.l0;
import y0.l1;
import y0.l2;
import y0.l3;
import y0.l4;
import y0.l5;
import y0.l6;
import y0.m;
import y0.m0;
import y0.m1;
import y0.m2;
import y0.m3;
import y0.m4;
import y0.m5;
import y0.m6;
import y0.n;
import y0.n0;
import y0.n1;
import y0.n2;
import y0.n3;
import y0.n4;
import y0.n5;
import y0.n6;
import y0.o;
import y0.o0;
import y0.o1;
import y0.o2;
import y0.o3;
import y0.o4;
import y0.o5;
import y0.o6;
import y0.p0;
import y0.p1;
import y0.p2;
import y0.p3;
import y0.p4;
import y0.p5;
import y0.p6;
import y0.q0;
import y0.q2;
import y0.q3;
import y0.q4;
import y0.q5;
import y0.q6;
import y0.r;
import y0.r0;
import y0.r1;
import y0.r2;
import y0.r3;
import y0.r4;
import y0.r5;
import y0.r6;
import y0.s;
import y0.s1;
import y0.s2;
import y0.s3;
import y0.s4;
import y0.s5;
import y0.s6;
import y0.t;
import y0.t1;
import y0.t3;
import y0.t4;
import y0.t5;
import y0.t6;
import y0.u;
import y0.u1;
import y0.u2;
import y0.u3;
import y0.u4;
import y0.u5;
import y0.v;
import y0.v0;
import y0.v1;
import y0.v2;
import y0.v3;
import y0.v4;
import y0.w;
import y0.w0;
import y0.w2;
import y0.w3;
import y0.w4;
import y0.w5;
import y0.x;
import y0.x0;
import y0.x1;
import y0.x2;
import y0.x4;
import y0.x5;
import y0.y;
import y0.y0;
import y0.y1;
import y0.y3;
import y0.y5;
import y0.z;
import y0.z2;
import y0.z3;
import y0.z4;
import y0.z5;
@Metadata(bv = {}, d1 = {"\u0000\u0092\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0010\t\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0010%\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\b\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0007\u0018\u0000 \n2\u00020\u0001:\u00012B\t\b\u0002¢\u0006\u0004\bc\u0010dJ\n\u0010\u0003\u001a\u0004\u0018\u00010\u0002H\u0002J\u001a\u0010\u0007\u001a\u00020\u00052\b\u0010\u0004\u001a\u0004\u0018\u00010\u00022\u0006\u0010\u0006\u001a\u00020\u0005H\u0002J\u0012\u0010\n\u001a\u00020\t2\b\u0010\b\u001a\u0004\u0018\u00010\u0002H\u0003J\b\u0010\u000b\u001a\u00020\tH\u0002J\u0012\u0010\r\u001a\u00020\t2\b\u0010\b\u001a\u0004\u0018\u00010\fH\u0002J\u0010\u0010\u0010\u001a\u00020\t2\u0006\u0010\u000f\u001a\u00020\u000eH\u0002J\b\u0010\u0011\u001a\u00020\tH\u0002J\u000e\u0010\u0013\u001a\u00020\t2\u0006\u0010\u0012\u001a\u00020\u0005J\u000e\u0010\u0016\u001a\u00020\t2\u0006\u0010\u0015\u001a\u00020\u0014J\u0006\u0010\u0017\u001a\u00020\tJ\u000e\u0010\u0018\u001a\u00020\t2\u0006\u0010\u0006\u001a\u00020\u0005J\u0010\u0010\u001a\u001a\u00020\t2\u0006\u0010\u0019\u001a\u00020\u0005H\u0007J\u0010\u0010\u001c\u001a\u00020\t2\b\u0010\u001b\u001a\u0004\u0018\u00010\u000eJ\u0006\u0010\u001d\u001a\u00020\tJ\u000e\u0010\u001e\u001a\u00020\t2\u0006\u0010\u0006\u001a\u00020\u0005J\u000e\u0010!\u001a\u00020\t2\u0006\u0010 \u001a\u00020\u001fJ\u0006\u0010\"\u001a\u00020\tJ\u0006\u0010#\u001a\u00020\tJ\u000e\u0010'\u001a\u00020&2\u0006\u0010%\u001a\u00020$J\u0016\u0010'\u001a\u00020&2\u0006\u0010%\u001a\u00020$2\u0006\u0010(\u001a\u00020\u001fJ\u000e\u0010*\u001a\u00020\u00052\u0006\u0010%\u001a\u00020)J\u0014\u0010,\u001a\b\u0012\u0004\u0012\u00020&0+2\u0006\u0010%\u001a\u00020$J\u001c\u0010,\u001a\b\u0012\u0004\u0012\u00020&0+2\u0006\u0010%\u001a\u00020$2\u0006\u0010(\u001a\u00020\u001fJ\u000e\u0010.\u001a\u00020\t2\u0006\u0010-\u001a\u00020)J\u0006\u0010/\u001a\u00020\tJ\u0006\u00100\u001a\u00020\tR(\u0010\u0004\u001a\u0004\u0018\u00010\u00022\b\u00101\u001a\u0004\u0018\u00010\u00028\u0006@BX\u0086\u000e¢\u0006\f\n\u0004\b2\u00103\u001a\u0004\b4\u00105R \u00109\u001a\u000e\u0012\u0004\u0012\u00020\u000e\u0012\u0004\u0012\u00020\u0014068\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b7\u00108R\u0018\u0010=\u001a\u0004\u0018\u00010:8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b;\u0010<R\u0014\u0010A\u001a\u00020>8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b?\u0010@R$\u0010\u000f\u001a\u00020\u000e2\u0006\u00101\u001a\u00020\u000e8\u0006@BX\u0086\u000e¢\u0006\f\n\u0004\bB\u0010C\u001a\u0004\bD\u0010ER\u0016\u0010I\u001a\u00020F8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bG\u0010HR(\u0010L\u001a\u0004\u0018\u00010\u000e2\b\u00101\u001a\u0004\u0018\u00010\u000e8\u0006@BX\u0086\u000e¢\u0006\f\n\u0004\bJ\u0010C\u001a\u0004\bK\u0010ER\"\u0010N\u001a\u00020\u00058\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b\u0011\u0010M\u001a\u0004\bN\u0010O\"\u0004\bP\u0010QR\u0016\u0010R\u001a\u00020F8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0007\u0010HR\u001c\u0010U\u001a\b\u0012\u0002\b\u0003\u0018\u00010S8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0003\u0010TR\u0014\u0010Y\u001a\u00020V8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bW\u0010XR\u0016\u0010[\u001a\u00020F8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bZ\u0010HR\u0016\u0010\\\u001a\u00020F8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\r\u0010HR\u0011\u0010]\u001a\u00020\u00058F¢\u0006\u0006\u001a\u0004\b]\u0010OR\u0013\u0010a\u001a\u0004\u0018\u00010^8F¢\u0006\u0006\u001a\u0004\b_\u0010`R\u0011\u0010b\u001a\u00020\u00058F¢\u0006\u0006\u001a\u0004\bb\u0010O¨\u0006e"}, d2 = {"Lak/im/sdk/manager/XMPPConnectionManager;", "", "Lorg/jivesoftware/smack/AbstractXMPPConnection;", "j", "connection", "", "isManualLogin", "i", "conn", "Lkd/s;", "o", XHTMLText.P, "Lorg/jivesoftware/smack/XMPPConnection;", "n", "", "status", XHTMLText.Q, XHTMLText.H, "needResetConn", Destroy.ELEMENT, "Ll/b0;", "listener", "registerConnectionChangeListener", "unregisterConnectionChangeListeners", "connect", "needDelay", "maybeStartReconnect", "type", "disconnect", "instantDisconnect", "reconnect", "", DelayInformation.ELEMENT, "startPing", "forceStartPing", "resetConnection", "Lorg/jivesoftware/smack/packet/IQ;", HiAnalyticsConstant.Direction.REQUEST, "Lorg/jivesoftware/smack/packet/Stanza;", "sendIQDirectly", "time", "Lorg/jivesoftware/smack/packet/Presence;", "sendPresenceWithResponse", "Lfc/z;", "sendIQWithRx", Presence.ELEMENT, "sendPresence", "increaseLoginFailedTimes", "resetLoginFailedTimes", "<set-?>", "a", "Lorg/jivesoftware/smack/AbstractXMPPConnection;", "getConnection", "()Lorg/jivesoftware/smack/AbstractXMPPConnection;", "", "b", "Ljava/util/Map;", "mConnectionChangeListeners", "Lorg/jivesoftware/smack/ConnectionListener;", "c", "Lorg/jivesoftware/smack/ConnectionListener;", "mConnectionListener", "Landroid/content/Context;", "d", "Landroid/content/Context;", "context", "e", "Ljava/lang/String;", "getStatus", "()Ljava/lang/String;", "", "f", "I", "mLoginFailedTimes", "g", "getConflictHint", "conflictHint", "Z", "isDoLogin", "()Z", "setDoLogin", "(Z)V", "pingFailedTime", "Ljava/util/concurrent/ScheduledFuture;", "Ljava/util/concurrent/ScheduledFuture;", "nextAutomaticPing", "Ljava/util/concurrent/ScheduledExecutorService;", NotifyType.LIGHTS, "Ljava/util/concurrent/ScheduledExecutorService;", "executorService", "m", "pingTime", "pingContinuousSuccessTime", "isEffective", "Lorg/jivesoftware/smack/roster/Roster;", "getRoster", "()Lorg/jivesoftware/smack/roster/Roster;", "roster", "isFailedTimesOverflow", "<init>", "()V", "ak-im_carrotArmV7Release"}, k = 1, mv = {1, 6, 0})
public final class XMPPConnectionManager {
@Nullable
private static XMPPTCPConnectionConfiguration f1784p;
private static int f1786r;
@NotNull
private static String f1787s;
@NotNull
private static String f1788t;
private static volatile boolean f1789u;
@Nullable
private AbstractXMPPConnection connection;
@NotNull
private final Map<String, l.b0> mConnectionChangeListeners;
@Nullable
private ConnectionListener mConnectionListener;
@NotNull
private final Context context;
@NotNull
private String status;
private int mLoginFailedTimes;
@Nullable
private String conflictHint;
private boolean isDoLogin;
private int pingFailedTime;
@Nullable
private ScheduledFuture<?> nextAutomaticPing;
@NotNull
private final vd.a<kd.s> f1800k;
@NotNull
private final ScheduledExecutorService executorService;
private int pingTime;
private int pingContinuousSuccessTime;
@NotNull
public static final Companion INSTANCE = new Companion(null);
@NotNull
private static final kd.f<XMPPConnectionManager> f1785q = kotlin.a.lazy(new vd.a<XMPPConnectionManager>() {
@Override
@NotNull
public final XMPPConnectionManager invoke() {
return new XMPPConnectionManager(null);
}
});
@Metadata(bv = {}, d1 = {"\u0000<\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0014\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0010\t\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b4\u0010\u0016J\u000e\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002J\u000e\u0010\b\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0006J\u000e\u0010\t\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0006R\u001b\u0010\u000f\u001a\u00020\n8FX\u0086\u0084\u0002¢\u0006\f\n\u0004\b\u000b\u0010\f\u001a\u0004\b\r\u0010\u000eR*\u0010\u0011\u001a\u00020\u00022\u0006\u0010\u0010\u001a\u00020\u00028F@BX\u0087\u000e¢\u0006\u0012\n\u0004\b\u0011\u0010\u0012\u0012\u0004\b\u0015\u0010\u0016\u001a\u0004\b\u0013\u0010\u0014R$\u0010\u0017\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u00068\u0006@BX\u0086\u000e¢\u0006\f\n\u0004\b\u0017\u0010\u0018\u001a\u0004\b\u0019\u0010\u001aR\"\u0010\u001b\u001a\u00020\u00068\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b\u001b\u0010\u0018\u001a\u0004\b\u001c\u0010\u001a\"\u0004\b\u001d\u0010\u001eR\"\u0010 \u001a\u00020\u001f8\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b \u0010!\u001a\u0004\b \u0010\"\"\u0004\b#\u0010$R\u0014\u0010%\u001a\u00020\u00068\u0006X\u0086T¢\u0006\u0006\n\u0004\b%\u0010\u0018R\u0014\u0010&\u001a\u00020\u00068\u0006X\u0086T¢\u0006\u0006\n\u0004\b&\u0010\u0018R\u0014\u0010'\u001a\u00020\u00068\u0006X\u0086T¢\u0006\u0006\n\u0004\b'\u0010\u0018R\u0014\u0010)\u001a\u00020(8\u0006X\u0086T¢\u0006\u0006\n\u0004\b)\u0010*R\u0014\u0010+\u001a\u00020(8\u0006X\u0086T¢\u0006\u0006\n\u0004\b+\u0010*R\u0014\u0010,\u001a\u00020(8\u0006X\u0086T¢\u0006\u0006\n\u0004\b,\u0010*R\u0014\u0010-\u001a\u00020(8\u0006X\u0086T¢\u0006\u0006\n\u0004\b-\u0010*R\u0014\u0010.\u001a\u00020(8\u0006X\u0086T¢\u0006\u0006\n\u0004\b.\u0010*R\u0014\u0010/\u001a\u00020\u00028\u0006X\u0086T¢\u0006\u0006\n\u0004\b/\u0010\u0012R\u0014\u00100\u001a\u00020\u00068\u0006X\u0086T¢\u0006\u0006\n\u0004\b0\u0010\u0018R\u0018\u00102\u001a\u0004\u0018\u0001018\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b2\u00103¨\u00065"}, d2 = {"Lak/im/sdk/manager/XMPPConnectionManager$a;", "", "", "code", "Lkd/s;", "setmLoginCode", "", "res", "setmLoginType", "setmVerifyCode", "Lak/im/sdk/manager/XMPPConnectionManager;", "instance$delegate", "Lkd/f;", "getInstance", "()Lak/im/sdk/manager/XMPPConnectionManager;", "instance", "<set-?>", "loginCode", "I", "getLoginCode", "()I", "getLoginCode$annotations", "()V", "mLoginType", "Ljava/lang/String;", "getMLoginType", "()Ljava/lang/String;", "mVerifyCode", "getMVerifyCode", "setMVerifyCode", "(Ljava/lang/String;)V", "", "isClearAllMessages", "Z", "()Z", "setClearAllMessages", "(Z)V", "CONNECTED", "CONNECTING", "DISCONNECTED", "", "PING_DELAY_AMPLITUDE", "J", "PING_INTERVAL_LEVEL1", "PING_INTERVAL_LEVEL2", "PING_INTERVAL_LEVEL3", "PING_MAX_DELAY", "REPLY_TIMEOUT", "TAG", "Lorg/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration;", "connectionConfig", "Lorg/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration;", "<init>", "ak-im_carrotArmV7Release"}, k = 1, mv = {1, 6, 0})
public static final class Companion {
private Companion() {
}
public Companion(kotlin.jvm.internal.o oVar) {
this();
}
public static void getLoginCode$annotations() {
}
@NotNull
public final XMPPConnectionManager getInstance() {
return (XMPPConnectionManager) XMPPConnectionManager.f1785q.getValue();
}
public final synchronized int getLoginCode() {
return XMPPConnectionManager.f1786r;
}
@NotNull
public final String getMLoginType() {
return XMPPConnectionManager.f1787s;
}
@NotNull
public final String getMVerifyCode() {
return XMPPConnectionManager.f1788t;
}
public final boolean isClearAllMessages() {
return XMPPConnectionManager.f1789u;
}
public final void setClearAllMessages(boolean z10) {
XMPPConnectionManager.f1789u = z10;
}
public final void setMVerifyCode(@NotNull String str) {
kotlin.jvm.internal.r.checkNotNullParameter(str, "<set-?>");
XMPPConnectionManager.f1788t = str;
}
public final synchronized void setmLoginCode(int i10) {
XMPPConnectionManager.f1786r = i10;
}
public final synchronized void setmLoginType(@NotNull String res) {
kotlin.jvm.internal.r.checkNotNullParameter(res, "res");
XMPPConnectionManager.f1787s = res;
}
public final synchronized void setmVerifyCode(@NotNull String res) {
kotlin.jvm.internal.r.checkNotNullParameter(res, "res");
setMVerifyCode(res);
}
}
@Metadata(bv = {}, d1 = {"\u00001\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0005*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016J\u0018\u0010\b\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0007\u001a\u00020\u0006H\u0016J\b\u0010\t\u001a\u00020\u0004H\u0016J\u0014\u0010\r\u001a\u00020\u00042\n\u0010\f\u001a\u00060\nj\u0002`\u000bH\u0016J\u0010\u0010\u0010\u001a\u00020\u00042\u0006\u0010\u000f\u001a\u00020\u000eH\u0016J\u0014\u0010\u0011\u001a\u00020\u00042\n\u0010\u000f\u001a\u00060\nj\u0002`\u000bH\u0016J\b\u0010\u0012\u001a\u00020\u0004H\u0016¨\u0006\u0013"}, d2 = {"ak/im/sdk/manager/XMPPConnectionManager$b", "Lorg/jivesoftware/smack/ConnectionListener;", "Lorg/jivesoftware/smack/XMPPConnection;", "connection", "Lkd/s;", "connected", "", StreamManagement.Resumed.ELEMENT, "authenticated", "connectionClosed", "Ljava/lang/Exception;", "Lkotlin/Exception;", "e", "connectionClosedOnError", "", "arg0", "reconnectingIn", "reconnectionFailed", "reconnectionSuccessful", "ak-im_carrotArmV7Release"}, k = 1, mv = {1, 6, 0})
public static final class b implements ConnectionListener {
b() {
}
@Override
public void authenticated(@NotNull XMPPConnection connection, boolean z10) {
kotlin.jvm.internal.r.checkNotNullParameter(connection, "connection");
Log.i("XMPPConnectionManager", "xmpp authenticated:" + z10);
if (AKCCheckPoint.isChecking("CHECKPOINT_LOGIN") != null) {
AKCCheckPoint.actionPointEnd("CHECKPOINT_LOGIN", SaslStreamElements.AuthMechanism.ELEMENT);
}
ak.im.utils.s3.sendEvent(g.h3.getInstance("xmpp-mgr-conn-authenticated"));
}
@Override
public void connected(@NotNull XMPPConnection connection) {
kotlin.jvm.internal.r.checkNotNullParameter(connection, "connection");
Log.i("XMPPConnectionManager", "xmpp connected");
if (AKCCheckPoint.isChecking("CHECKPOINT_LOGIN") != null) {
AKCCheckPoint.actionPointStart("CHECKPOINT_LOGIN", SaslStreamElements.AuthMechanism.ELEMENT);
}
}
@Override
public void connectionClosed() {
if (AKCCheckPoint.isChecking("CHECKPOINT_LOGIN") != null) {
AKCCheckPoint.actionPointEnd("CHECKPOINT_LOGIN", SaslStreamElements.AuthMechanism.ELEMENT);
}
Log.w("XMPPConnectionManager", "ConnectionListener: connectionClosed() called - connection was shutdown by foreign host or by us");
f1.getInstance().setOnline(false);
XMPPConnectionManager.this.p();
ak.im.utils.s3.sendEvent(g.h3.getInstance("xmpp-mgr-conn-close"));
if (!AKApplication.f777d) {
XMPPConnectionManager.this.setDoLogin(false);
if (AKApplication.isAppHadLogin()) {
XMPPConnectionManager.this.maybeStartReconnect(false);
}
}
}
@Override
public void connectionClosedOnError(@NotNull Exception e10) {
boolean z10;
boolean z11;
int i10;
boolean z12;
boolean z13;
boolean z14;
boolean z15;
boolean z16;
boolean z17;
boolean z18;
boolean z19;
boolean z20;
boolean z21;
boolean z22;
boolean z23;
boolean z24;
boolean z25;
boolean z26;
boolean z27;
j0.a endCheckAction;
String str;
Akeychat.SessionEndReason sessionEndReason;
Akeychat.SessionEndReason sessionEndReason2;
String str2;
String str3;
Akeychat.SessionEndReason sessionEndReason3;
long j10;
kotlin.jvm.internal.r.checkNotNullParameter(e10, "e");
if (AKCCheckPoint.isChecking("CHECKPOINT_LOGIN") != null) {
AKCCheckPoint.actionPointEnd("CHECKPOINT_LOGIN", SaslStreamElements.AuthMechanism.ELEMENT);
}
try {
AkeyChatUtils.logException(e10);
XMPPConnectionManager.this.p();
Log.i("XMPPConnectionManager", "we get connectionClosedOnError :" + e10.getMessage());
f1.getInstance().setOnline(false);
ak.im.utils.s3.sendEvent(g.h3.getInstance("XMPP-mgr-conn-close on error"));
XMPPConnectionManager.this.setDoLogin(false);
if (e10 instanceof XMPPException.StreamErrorException) {
StreamError.Condition condition = ((XMPPException.StreamErrorException) e10).getStreamError().getCondition();
StreamError streamError = ((XMPPException.StreamErrorException) e10).getStreamError();
if (StreamError.Condition.conflict != condition && StreamError.Condition.not_authorized != condition) {
XMPPConnectionManager.this.maybeStartReconnect(false);
Log.i("XMPPConnectionManager", "cant deal the stream error ,reconnect");
return;
}
VoIpManager voIpManager = VoIpManager.getInstance();
SipCall sipCall = voIpManager.getmCurrentCall();
if (sipCall != null && sipCall.isConference) {
voIpManager.hungUpSipCall(sipCall.getCalleeUsername(), false, false);
}
List<WeakReference<Activity>> activityList = AKApplication.getActivityList();
if (activityList != null && activityList.size() > 0 && (activityList.get(activityList.size() - 1).get() instanceof UserConflictActivity)) {
Log.w("XMPPConnectionManager", "hand hint it do not need");
return;
}
Log.w("XMPPConnectionManager", "is stream error");
ExtensionElement extension = streamError.getExtension(y0.y0.f49028b, y0.y0.f49029c);
if (extension == null) {
extension = streamError.getExtension(y0.y0.f49028b, y0.y0.f49030d);
}
if (extension == null) {
XMPPConnectionManager.INSTANCE.setmLoginCode(TypedValues.Custom.TYPE_FLOAT);
XMPPConnectionManager.this.destroy(false);
Log.i("XMPPConnectionManager", "will start background kick");
if (!AKApplication.f777d) {
Intent intent = new Intent();
intent.setClass(XMPPConnectionManager.this.context, UserConflictActivity.class);
intent.setFlags(805306368);
j.a.get().startActivity(intent);
return;
}
new a1.c1(AKApplication.getTopActivity(), 1).start();
return;
}
Akeychat.EndSessionInfo parseFrom = Akeychat.EndSessionInfo.parseFrom(e.e.decode(((y0.y0) extension).getmContent()));
StringBuilder sb2 = new StringBuilder();
sb2.append("error description is ");
if (parseFrom != null) {
str = parseFrom.getDescription();
} else {
str = null;
}
sb2.append(str);
Log.i("XMPPConnectionManager", sb2.toString());
if (parseFrom != null) {
sessionEndReason = parseFrom.getSessionendreason();
} else {
sessionEndReason = null;
}
if (parseFrom != null) {
sessionEndReason2 = parseFrom.getNewsessionendreason();
} else {
sessionEndReason2 = null;
}
StringBuilder sb3 = new StringBuilder();
sb3.append("stream error reason is ");
if (sessionEndReason != null) {
str2 = sessionEndReason.name();
} else {
str2 = null;
}
sb3.append(str2);
sb3.append(",new reason is ");
if (sessionEndReason2 != null) {
str3 = sessionEndReason2.name();
} else {
str3 = null;
}
sb3.append(str3);
Log.i("XMPPConnectionManager", sb3.toString());
f1.getInstance().setPassword(null);
f1.getInstance().clearPwdInSharedPref();
if (AKApplication.f777d) {
new a1.c1(AKApplication.getTopActivity(), 1).start();
}
if (sessionEndReason2 != null) {
XMPPConnectionManager.this.destroy(false);
String str4 = "";
if (sessionEndReason2 == Akeychat.SessionEndReason.OSSLOCK) {
if (parseFrom.hasDescription()) {
str4 = parseFrom.getDescription();
}
String str5 = str4;
if (parseFrom.hasLockstarttime()) {
j10 = parseFrom.getLockstarttime();
} else {
j10 = 0;
}
long j11 = j10;
if (parseFrom.hasLockendtime()) {
parseFrom.getLockendtime();
}
if (parseFrom.hasRemark()) {
parseFrom.getRemark();
}
AKLoginException aKLoginException = new AKLoginException(parseFrom.getNewsessionendreason().getNumber(), str5, j11, parseFrom.getLockendtime(), parseFrom.getRemark());
ak.im.utils.s3.sendEvent(new y0.w1(aKLoginException.errorCode, aKLoginException, aKLoginException.des));
return;
}
Intent intent2 = new Intent();
intent2.setClass(XMPPConnectionManager.this.context, UserConflictActivity.class);
intent2.putExtra("reason", sessionEndReason2.name());
if (Akeychat.SessionEndReason.APPCANCEL != sessionEndReason2 && Akeychat.SessionEndReason.OSSCANCEL != sessionEndReason2) {
if (Akeychat.SessionEndReason.MAINDEVICEKICK != sessionEndReason2 && Akeychat.SessionEndReason.TRUSTDEVICECANCEL != sessionEndReason2 && Akeychat.SessionEndReason.MAINDEVICECANCEL != sessionEndReason2 && Akeychat.SessionEndReason.OSSDELETEMAINDEVICE != sessionEndReason2 && Akeychat.SessionEndReason.OSSDELETETRUSTDEVICE != sessionEndReason2 && Akeychat.SessionEndReason.OSSTARTTRUSTDEVICEAUTH != sessionEndReason2 && (sessionEndReason3 = Akeychat.SessionEndReason.BACKGROUNDKICK) != sessionEndReason2 && Akeychat.SessionEndReason.MANYWRONGPASSWORD != sessionEndReason2) {
if (sessionEndReason != null && (Akeychat.SessionEndReason.KICK == sessionEndReason || Akeychat.SessionEndReason.USERDELETE == sessionEndReason || Akeychat.SessionEndReason.INTERNALUSE == sessionEndReason || Akeychat.SessionEndReason.PASSWORDCHANGE == sessionEndReason || sessionEndReason3 == sessionEndReason)) {
XMPPConnectionManager.INSTANCE.setmLoginCode(TypedValues.Custom.TYPE_FLOAT);
XMPPConnectionManager.this.destroy(false);
intent2.putExtra("reason", sessionEndReason.name());
if (sessionEndReason3 != sessionEndReason) {
XMPPConnectionManager.this.conflictHint = parseFrom.getDescription();
intent2.putExtra("description", XMPPConnectionManager.this.getConflictHint());
} else {
intent2.putExtra("description", "");
}
intent2.setFlags(805306368);
j.a.get().startActivity(intent2);
return;
}
intent2.putExtra("description", parseFrom.getDescription());
intent2.setFlags(805306368);
j.a.get().startActivity(intent2);
return;
}
intent2.putExtra("need_restart", true);
intent2.putExtra("description", parseFrom.getDescription());
intent2.setFlags(805306368);
j.a.get().startActivity(intent2);
return;
}
intent2.putExtra("remark", parseFrom.getRemark());
intent2.putExtra("description", parseFrom.getDescription());
intent2.setFlags(805306368);
j.a.get().startActivity(intent2);
return;
}
XMPPConnectionManager.INSTANCE.setmLoginCode(TypedValues.Custom.TYPE_FLOAT);
XMPPConnectionManager.this.destroy(false);
Log.i("XMPPConnectionManager", "will start background kick");
if (!AKApplication.f777d) {
Intent intent3 = new Intent();
intent3.setClass(XMPPConnectionManager.this.context, UserConflictActivity.class);
intent3.setFlags(805306368);
j.a.get().startActivity(intent3);
return;
}
new a1.c1(AKApplication.getTopActivity(), 1).start();
return;
}
if (e10 instanceof AKLoginException) {
Companion companion = XMPPConnectionManager.INSTANCE;
companion.getInstance().setDoLogin(false);
boolean isAppHadLogin = AKApplication.isAppHadLogin();
Log.i("XMPPConnectionManager", "has AKLoginException");
int i11 = ((AKLoginException) e10).errorCode;
String str6 = ((AKLoginException) e10).des;
companion.setmLoginCode(i11);
Log.w("XMPPConnectionManager", "errorCode:" + i11 + ",err msg:" + str6 + ",origErrorCode:" + ((AKLoginException) e10).origErrorCode);
companion.setmLoginCode(i11);
if (AKCCheckPoint.isChecking("CHECKPOINT_LOGIN") != null && (endCheckAction = AKCCheckPoint.endCheckAction("CHECKPOINT_LOGIN")) != null) {
if (((AKLoginException) e10).origErrorCode > 0 && ((AKLoginException) e10).origErrorCode != 18 && ((AKLoginException) e10).origErrorCode != 19 && ((AKLoginException) e10).origErrorCode != 41) {
AKCCheckPoint.aliyunLog(endCheckAction.info(kotlin.collections.u.mapOf(kd.i.to("ls", "0"), kd.i.to("fr", String.valueOf(((AKLoginException) e10).origErrorCode + 10001)))), AKCCheckPoint.AKCSLSLogTopic.AKCSLSLogTopic_LOGIN.getValue());
}
kd.s sVar = kd.s.f40925a;
}
if (i11 == 925) {
z10 = true;
} else {
z10 = false;
}
if (z10) {
if (!isAppHadLogin) {
try {
String userRootPath = FileUtil.getUserRootPath();
StringBuilder sb4 = new StringBuilder();
sb4.append("delete file path:");
kotlin.jvm.internal.r.checkNotNull(userRootPath);
sb4.append(userRootPath);
Log.i("XMPPConnectionManager", sb4.toString());
FileUtil.deleteFile(userRootPath);
File encryptedDatabasePath = ak.db.d.getEncryptedDatabasePath(XMPPConnectionManager.this.context, f1.getInstance().getUsername());
FileUtil.deleteFile(encryptedDatabasePath);
FileUtil.deleteFile(FileUtil.getDownloadPath(XMPPConnectionManager.this.context));
Log.w("XMPPConnectionManager", "after delete folder,ret:" + FileUtil.checkPathValid(userRootPath));
Log.w("XMPPConnectionManager", "after delete db-file:" + encryptedDatabasePath.getAbsolutePath() + ",ret:" + FileUtil.checkPathValid(encryptedDatabasePath.getAbsolutePath()));
} catch (Exception unused) {
Log.w("XMPPConnectionManager", "delete local data error");
}
} else {
new a1.c1(AKApplication.getTopActivity(), 1, false, false, true, true).start();
return;
}
}
if (i11 != 18 && i11 != 19 && i11 != 20 && i11 != 62) {
z11 = false;
i10 = ((AKLoginException) e10).origErrorCode;
if (64 > i10 && i10 < 68) {
z12 = true;
} else {
z12 = false;
}
if (!z12 && f1.getInstance().supportFeedback()) {
z13 = true;
} else {
z13 = false;
}
if (!isAppHadLogin && !z11 && !z10 && !z13) {
f1.getInstance().setPassword(null);
f1.getInstance().clearPwdInSharedPref();
Log.i("XMPPConnectionManager", "clear pwd");
}
f1.getInstance().setOnline(false);
if (i11 != 12) {
z14 = true;
} else {
z14 = false;
}
if (i11 == 401) {
XMPPConnectionManager.this.connection = null;
}
if (i11 != 401) {
z15 = true;
} else {
z15 = false;
}
boolean z28 = z14 | z15;
if (i11 != 441) {
z16 = true;
} else {
z16 = false;
}
boolean z29 = z28 | z16;
if (i11 != 403) {
z17 = true;
} else {
z17 = false;
}
boolean z30 = z29 | z17;
if (i11 != 901) {
z18 = true;
} else {
z18 = false;
}
boolean z31 = z30 | z18;
if (i11 != 904) {
z19 = true;
} else {
z19 = false;
}
boolean z32 = z31 | z19;
if (i11 != 903) {
z20 = true;
} else {
z20 = false;
}
boolean z33 = z32 | z20;
if (i11 != 905) {
z21 = true;
} else {
z21 = false;
}
boolean z34 = z33 | z21;
if (i11 != 31) {
z22 = true;
} else {
z22 = false;
}
boolean z35 = z34 | z22;
if (i11 != 32) {
z23 = true;
} else {
z23 = false;
}
boolean z36 = z35 | z23;
if (i11 != 4) {
z24 = true;
} else {
z24 = false;
}
boolean z37 = z36 | z24;
if (i11 != 46) {
z25 = true;
} else {
z25 = false;
}
boolean z38 = z37 | z25;
if (i11 != 47) {
z26 = true;
} else {
z26 = false;
}
boolean z39 = z38 | z26;
if (i11 != 62) {
z27 = true;
} else {
z27 = false;
}
boolean z40 = z39 | z27;
if (isAppHadLogin && !z40) {
XMPPConnectionManager.this.maybeStartReconnect(false);
}
if (i11 != 4 && i11 != 32 && i11 != 31 && ((AKLoginException) e10).origErrorCode != 67) {
ak.im.utils.s3.sendEvent(new y0.w1(i11, str6));
return;
}
ak.im.utils.s3.sendEvent(new y0.w1(i11, (AKLoginException) e10, str6));
return;
}
z11 = true;
i10 = ((AKLoginException) e10).origErrorCode;
if (64 > i10) {
}
z12 = false;
if (!z12) {
}
z13 = false;
if (!isAppHadLogin) {
f1.getInstance().setPassword(null);
f1.getInstance().clearPwdInSharedPref();
Log.i("XMPPConnectionManager", "clear pwd");
}
f1.getInstance().setOnline(false);
if (i11 != 12) {
}
if (i11 == 401) {
}
if (i11 != 401) {
}
boolean z282 = z14 | z15;
if (i11 != 441) {
}
boolean z292 = z282 | z16;
if (i11 != 403) {
}
boolean z302 = z292 | z17;
if (i11 != 901) {
}
boolean z312 = z302 | z18;
if (i11 != 904) {
}
boolean z322 = z312 | z19;
if (i11 != 903) {
}
boolean z332 = z322 | z20;
if (i11 != 905) {
}
boolean z342 = z332 | z21;
if (i11 != 31) {
}
boolean z352 = z342 | z22;
if (i11 != 32) {
}
boolean z362 = z352 | z23;
if (i11 != 4) {
}
boolean z372 = z362 | z24;
if (i11 != 46) {
}
boolean z382 = z372 | z25;
if (i11 != 47) {
}
boolean z392 = z382 | z26;
if (i11 != 62) {
}
boolean z402 = z392 | z27;
if (isAppHadLogin) {
XMPPConnectionManager.this.maybeStartReconnect(false);
}
if (i11 != 4) {
ak.im.utils.s3.sendEvent(new y0.w1(i11, str6));
return;
}
ak.im.utils.s3.sendEvent(new y0.w1(i11, (AKLoginException) e10, str6));
return;
}
if (AkeyChatUtils.IsOrContainCertificateException(e10)) {
Log.i("XMPPConnectionManager", "server certificate failed");
} else {
Log.d("XMPPConnectionManager", "send reconnect broadcast in connectionClosedOnError else br");
XMPPConnectionManager.this.maybeStartReconnect(true);
}
} catch (Exception e11) {
Log.w("XMPPConnectionManager", "we get error stream,encounter exception");
e11.printStackTrace();
XMPPConnectionManager.this.maybeStartReconnect(true);
}
}
@Override
public void reconnectingIn(int i10) {
throw new IllegalStateException("Reconnection Manager is running");
}
@Override
public void reconnectionFailed(@NotNull Exception arg0) {
kotlin.jvm.internal.r.checkNotNullParameter(arg0, "arg0");
throw new IllegalStateException("Reconnection Manaager is running");
}
@Override
public void reconnectionSuccessful() {
throw new IllegalStateException("Reconnection Manager is running");
}
}
@Metadata(bv = {}, d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0006"}, d2 = {"ak/im/sdk/manager/XMPPConnectionManager$c", "Ljava/util/logging/ConsoleHandler;", "Ljava/util/logging/LogRecord;", "record", "Lkd/s;", "publish", "ak-im_carrotArmV7Release"}, k = 1, mv = {1, 6, 0})
public static final class c extends ConsoleHandler {
c() {
}
@Override
public void publish(@NotNull LogRecord record) {
kotlin.jvm.internal.r.checkNotNullParameter(record, "record");
Log.i("SMACK-LOGGER", record.getLevel().getName() + '/' + record.getMessage());
}
}
static {
SASLAuthentication.registerSASLMechanism(new AKSASLMechanism());
ReflectionDebuggerFactory.setDebuggerClass(y.class);
f1786r = 200;
f1787s = "";
f1788t = "";
}
private XMPPConnectionManager() {
this.status = "xmpp.disconnected";
Log.i("XMPPConnectionManager", "new XmppConnectionManager");
this.mConnectionChangeListeners = new ConcurrentHashMap();
Context context = j.a.get();
kotlin.jvm.internal.r.checkNotNullExpressionValue(context, "get()");
this.context = context;
this.f1800k = new vd.a<kd.s>() {
{
super(0);
}
@Override
public Object invoke() {
m22invoke();
return kd.s.f40925a;
}
public final void m22invoke() {
int i10;
int i11;
int i12;
int i13;
int i14;
AbstractXMPPConnection connection;
int i15;
int i16;
StringBuilder sb2 = new StringBuilder();
sb2.append("we do ping server in time:");
i10 = XMPPConnectionManager.this.pingTime;
sb2.append(i10);
Log.i("XMPPConnectionManager", sb2.toString());
boolean pingMyServer = PingManager.getInstanceFor(XMPPConnectionManager.this.getConnection()).pingMyServer(true, AKCAppConfiguration.f9925a.xpingTimeout());
StringBuilder sb3 = new StringBuilder();
AbstractXMPPConnection connection2 = XMPPConnectionManager.this.getConnection();
sb3.append(connection2 != null ? Boolean.valueOf(connection2.isConnected()) : null);
sb3.append(' ');
AbstractXMPPConnection connection3 = XMPPConnectionManager.this.getConnection();
sb3.append(connection3 != null ? Boolean.valueOf(connection3.isAuthenticated()) : null);
sb3.append(" status1");
Log.e("XMPPConnectionManager", sb3.toString());
XMPPConnectionManager xMPPConnectionManager = XMPPConnectionManager.this;
i11 = xMPPConnectionManager.pingTime;
xMPPConnectionManager.pingTime = i11 + 1;
if (pingMyServer) {
XMPPConnectionManager.this.pingFailedTime = 0;
XMPPConnectionManager xMPPConnectionManager2 = XMPPConnectionManager.this;
i15 = xMPPConnectionManager2.pingContinuousSuccessTime;
xMPPConnectionManager2.pingContinuousSuccessTime = i15 + 1;
XMPPConnectionManager xMPPConnectionManager3 = XMPPConnectionManager.this;
i16 = xMPPConnectionManager3.pingContinuousSuccessTime;
xMPPConnectionManager3.startPing(Math.min((i16 * 10) + 30, 300L));
return;
}
XMPPConnectionManager xMPPConnectionManager4 = XMPPConnectionManager.this;
i12 = xMPPConnectionManager4.pingFailedTime;
xMPPConnectionManager4.pingFailedTime = i12 + 1;
XMPPConnectionManager.this.pingContinuousSuccessTime = 0;
i13 = XMPPConnectionManager.this.pingFailedTime;
if (i13 == 1) {
XMPPConnectionManager.this.startPing(15L);
return;
}
if (i13 != 2) {
StringBuilder sb4 = new StringBuilder();
sb4.append("ping failed:");
i14 = XMPPConnectionManager.this.pingFailedTime;
sb4.append(i14);
sb4.append(" we disconnect,is login:");
sb4.append(XMPPConnectionManager.this.getIsDoLogin());
Log.w("XMPPConnectionManager", sb4.toString());
if (XMPPConnectionManager.this.getIsDoLogin() || (connection = XMPPConnectionManager.this.getConnection()) == null) {
return;
}
connection.disconnect();
return;
}
XMPPConnectionManager.this.startPing(5L);
}
};
ScheduledExecutorService newSingleThreadScheduledExecutor = Executors.newSingleThreadScheduledExecutor(new d.a("Ping", 10));
kotlin.jvm.internal.r.checkNotNullExpressionValue(newSingleThreadScheduledExecutor, "newSingleThreadScheduled…g\", Thread.MAX_PRIORITY))");
this.executorService = newSingleThreadScheduledExecutor;
}
public XMPPConnectionManager(kotlin.jvm.internal.o oVar) {
this();
}
public static final synchronized int getLoginCode() {
int loginCode;
synchronized (XMPPConnectionManager.class) {
loginCode = INSTANCE.getLoginCode();
}
return loginCode;
}
private final void h() {
ProviderManager.addIQProvider("query", PrivateDataIQ.NAMESPACE, new PrivateDataManager.PrivateDataIQProvider());
try {
ProviderManager.addIQProvider("query", "jabber:iq:time", Class.forName("org.jivesoftware.smackx.packet.Time"));
} catch (ClassNotFoundException unused) {
}
ProviderManager.addExtensionProvider(XHTMLExtension.ELEMENT, XHTMLExtension.NAMESPACE, new XHTMLExtensionProvider());
ProviderManager.addIQProvider("x", "jabber:x:roster", new RosterPacketProvider());
ProviderManager.addExtensionProvider("active", "http://jabber.org/protocol/chatstates", new ChatStateExtensionProvider());
ProviderManager.addExtensionProvider("composing", "http://jabber.org/protocol/chatstates", new ChatStateExtensionProvider());
ProviderManager.addExtensionProvider("paused", "http://jabber.org/protocol/chatstates", new ChatStateExtensionProvider());
ProviderManager.addExtensionProvider("inactive", "http://jabber.org/protocol/chatstates", new ChatStateExtensionProvider());
ProviderManager.addExtensionProvider("gone", "http://jabber.org/protocol/chatstates", new ChatStateExtensionProvider());
ProviderManager.addIQProvider(StreamInitiation.ELEMENT, "http://jabber.org/protocol/si", new StreamInitiationProvider());
ProviderManager.addExtensionProvider("x", GroupChatInvitation.NAMESPACE, new GroupChatInvitation.Provider());
ProviderManager.addIQProvider("query", DiscoverItems.NAMESPACE, new DiscoverItemsProvider());
ProviderManager.addIQProvider("query", DiscoverInfo.NAMESPACE, new DiscoverInfoProvider());
ProviderManager.addExtensionProvider("x", "jabber:x:data", new DataFormProvider());
ProviderManager.addExtensionProvider("x", MUCUser.NAMESPACE, new y0.d());
ProviderManager.addExtensionProvider(y0.a2.f48040b, y0.a2.f48041c, new y0.b2());
ProviderManager.addExtensionProvider(y0.u5.f48906b, y0.u5.f48907c, new u5.a());
ProviderManager.addExtensionProvider(y0.d1.f48135b, y0.d1.f48136c, new d1.a());
ProviderManager.addExtensionProvider(y0.e6.f48205b, y0.e6.f48206c, new e6.a());
ProviderManager.addExtensionProvider(y0.b1.f48072b, y0.b1.f48073c, new b1.a());
ProviderManager.addExtensionProvider(y0.c6.f48129b, y0.c6.f48130c, new c6.a());
ProviderManager.addExtensionProvider(y0.f6.f48237b, y0.f6.f48238c, new f6.a());
ProviderManager.addExtensionProvider(y0.x5.f49020b, y0.x5.f49021c, new x5.a());
ProviderManager.addExtensionProvider("x", "http://akey.im/protocol/xmpp/presence/cleanmessage#cleanallmessageincludemiyun", new l0.b());
ProviderManager.addExtensionProvider(y0.n.f48563b, y0.n.f48564c, new n.a());
ProviderManager.addExtensionProvider(MUCMemberAliasUpdate.ELEMENT, MUCMemberAliasUpdate.NAME_SPACE, new y0.z1());
ProviderManager.addExtensionProvider(y0.c0.f48098b, y0.c0.f48099c, new c0.a());
ProviderManager.addExtensionProvider(DelSession.ELEMENT, DelSession.NAME_SPACE, new DelSession.Provider());
ProviderManager.addExtensionProvider(DelMessagePresence.ELEMENT, DelMessagePresence.NAME_SPACE, new DelMessagePresence.Provider());
ProviderManager.addExtensionProvider(y0.f0.f48213b, y0.f0.f48214c, new f0.a());
ProviderManager.addIQProvider("query", MUCAdmin.NAMESPACE, new MUCAdminProvider());
ProviderManager.addIQProvider("query", MUCOwner.NAMESPACE, new MUCOwnerProvider());
ProviderManager.addExtensionProvider("x", DelayInformationManager.LEGACY_DELAYED_DELIVERY_NAMESPACE, new DelayInformationProvider());
try {
ProviderManager.addIQProvider("query", Version.NAMESPACE, Class.forName("org.jivesoftware.smackx.packet.Version"));
} catch (ClassNotFoundException unused2) {
}
ProviderManager.addIQProvider("vCard", "vcard-temp", new VCardProvider());
ProviderManager.addIQProvider(OfflineMessageRequest.ELEMENT, OfflineMessageRequest.NAMESPACE, new OfflineMessageRequest.Provider());
ProviderManager.addExtensionProvider(OfflineMessageRequest.ELEMENT, OfflineMessageRequest.NAMESPACE, new OfflineMessageInfo.Provider());
ProviderManager.addIQProvider("query", LastActivity.NAMESPACE, new LastActivity.Provider());
ProviderManager.addIQProvider("query", "jabber:iq:search", new UserSearch.Provider());
ProviderManager.addIQProvider(SharedGroupsInfo.ELEMENT, SharedGroupsInfo.NAMESPACE, new SharedGroupsInfo.Provider());
ProviderManager.addExtensionProvider(MultipleAddresses.ELEMENT, MultipleAddresses.NAMESPACE, new MultipleAddressesProvider());
ProviderManager.addExtensionProvider(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE, new DeliveryReceipt.Provider());
ProviderManager.addExtensionProvider(DeliveryReceiptRequest.ELEMENT, DeliveryReceipt.NAMESPACE, new DeliveryReceiptRequest.Provider());
ProviderManager.addExtensionProvider(DeliveryReceipt.ELEMENT, "http://akey.im/protocol/xmpp/extend/server-receipts", new i5.a());
ProviderManager.addIQProvider("query", "http://akey.im/protocol/xmpp/iq/search", new m6.a());
ProviderManager.addIQProvider("getmucroomlist", "http://akey.im/protocol/xmpp/iq/getmucroomlist#new", new r3.a());
ProviderManager.addIQProvider("create", "http://akey.im/protocol/xmpp/iq/mucroom", new i0.b());
ProviderManager.addIQProvider("invitemember", "http://akey.im/protocol/xmpp/iq/mucroom#invitemember", new r1.b());
ProviderManager.addIQProvider("kickmember", "http://akey.im/protocol/xmpp/iq/mucroom#kickmember", new u1.b());
ProviderManager.addIQProvider("quit", "http://akey.im/protocol/xmpp/iq/mucroom#quit", new x4.b());
ProviderManager.addIQProvider("roomdestroy", "http://akey.im/protocol/xmpp/iq/mucroom#roomdestroy", new r0.b());
ProviderManager.addIQProvider("mucroom", "http://akey.im/protocol/xmpp/iq/mucroom#updatenew", new g6.b());
ProviderManager.addIQProvider("multiusersearch", "http://akey.im/protocol/xmpp/iq/multiusersearch", new s2.a());
ProviderManager.addIQProvider("pushstatus", "http://akey.im/protocol/xmpp/iq/userprop#pushstatus", new d2.a());
ProviderManager.addIQProvider("muchistory", "http://akey.im/protocol/xmpp/iq/muchistory", new t3.a());
ProviderManager.addIQProvider(BaseField.TYPE_USER, "http://akey.im/protocol/xmpp/iq/user#search", new l.a());
ProviderManager.addIQProvider("akeyid", "http://akey.im/protocol/xmpp/iq/setakeyid", new k.a());
ProviderManager.addIQProvider("akeyid", "http://akey.im/protocol/xmpp/iq/queryakeyid", new k.a());
ProviderManager.addIQProvider(BaseField.TYPE_USER, "http://akey.im/protocol/xmpp/iq/user#setsearchswitch", new h1.a());
ProviderManager.addIQProvider(BaseField.TYPE_USER, "http://akey.im/protocol/xmpp/iq/user#querysearchswitch", new h1.a());
ProviderManager.addIQProvider("mucmessagestatus", "http://akey.im/protocol/xmpp/iq/mucmessagestatus", new n4.a());
ProviderManager.addIQProvider("mucroom", "http://akey.im/protocol/xmpp/iq/mucroom#akeyid", new o1.a());
ProviderManager.addIQProvider("mucroom", "http://akey.im/protocol/xmpp/iq/mucroom#akeyidsearchswitch", new p1.a());
ProviderManager.addIQProvider("mucroom", "http://akey.im/protocol/xmpp/iq/mucroom#sub", new d5.a());
ProviderManager.addIQProvider("mucroom", "http://akey.im/protocol/xmpp/iq/mucroom#request_new", new v3.a());
ProviderManager.addIQProvider("mucroom", "http://akey.im/protocol/xmpp/iq/mucroom#reply", new a5.a());
ProviderManager.addIQProvider("pushsoundswitch", "http://akey.im/protocol/xmpp/iq/userprop#setpushsoundswitch", new c2.a());
ProviderManager.addIQProvider("securityphone", "http://akey.im/protocol/xmpp/iq/securityphone", new o5.a());
ProviderManager.addIQProvider("cancelsecurityphone", "http://akey.im/protocol/xmpp/iq/cancelsecurityphone", new z5.a());
ProviderManager.addIQProvider("securityphone", "http://akey.im/protocol/xmpp/iq/securityphone#query", new p4.a());
ProviderManager.addIQProvider("mucroom", "http://akey.im/protocol/xmpp/iq/mucroomownerchange", new y5.a());
ProviderManager.addIQProvider("userexproperties", "http://akey.im/protocol/xmpp/iq/userexpropertiesset", new j6.a());
ProviderManager.addIQProvider("userproperties", "http://akey.im/protocol/xmpp/iq/userpropertiesset", new k6.a());
ProviderManager.addIQProvider("mucroom", "http://akey.im/protocol/xmpp/iq/mucroom#nickname", new m5.a());
ProviderManager.addIQProvider(SecurityOperation.ELEMENT, SecurityOperation.NAMESPACE, new SecurityOperation.Provider());
ProviderManager.addIQProvider("allinfosync", "http://akey.im/protocol/xmpp/iq/allinfosync", new j.a());
ProviderManager.addIQProvider("getfriends", "http://akey.im/protocol/xmpp/iq/getfriends", new v4.a());
ProviderManager.addIQProvider("userpublicinfo", "http://akey.im/protocol/xmpp/iq/userpublicinfo", new l6.a());
ProviderManager.addIQProvider("changedmessagesync", "http://akey.im/protocol/xmpp/iq/changedmessagesync", new y.a());
ProviderManager.addIQProvider("getchatsession", "http://akey.im/protocol/xmpp/iq/getchatsession", new k1.a());
ProviderManager.addIQProvider(Session.ELEMENT, "http://akey.im/protocol/xmpp/iq/session#cleanunread", new d0.b());
ProviderManager.addIQProvider(Session.ELEMENT, "http://akey.im/protocol/xmpp/iq/session#delete", new q0.b());
ProviderManager.addIQProvider("singlechatmessage", "http://akey.im/protocol/xmpp/iq/singlechatmessage#delete", new p0.b());
ProviderManager.addIQProvider("joinallmucroom", "http://akey.im/protocol/xmpp/iq/joinallmucroom", new s1.a());
ProviderManager.addIQProvider("mucroombasic", "http://akey.im/protocol/xmpp/iq/mucroombasic", new r4.a());
ProviderManager.addIQProvider("userbasic", "http://akey.im/protocol/xmpp/iq/userbasic", new u4.a());
ProviderManager.addIQProvider("sessionmessage", "http://akey.im/protocol/xmpp/iq/sessionmessage", new w2.a());
ProviderManager.addIQProvider("sessionmessagestatus", "http://akey.im/protocol/xmpp/iq/sessionmessagestatus", new x2.a());
ProviderManager.addIQProvider("setsoftshield", "http://akey.im/protocol/xmpp/iq/setsoftshield", new p5.a());
ProviderManager.addIQProvider("removeaskeydata", "http://akey.im/protocol/xmpp/iq/removeaskeydata", new m0.a());
ProviderManager.addIQProvider("setsecuritypasscode", "http://akey.im/protocol/xmpp/iq/setsecuritypasscode", new n5.a());
ProviderManager.addIQProvider("queryaskeydata", "http://akey.im/protocol/xmpp/iq/queryaskeydata", new c3.a());
ProviderManager.addIQProvider("uploadtoken", "http://akey.im/protocol/xmpp/iq/uploadtoken", new n1.b());
ProviderManager.addIQProvider("seaweedfschunksuploadtoken", "http://akey.im/protocol/xmpp/iq/seaweedfschunksuploadtoken", new l1.a());
ProviderManager.addIQProvider("publicuser", "http://akey.im/protocol/xmpp/iq/publicuser", new m4.b());
ProviderManager.addIQProvider("publicmuc", "http://akey.im/protocol/xmpp/iq/publicmuc", new l4.a());
ProviderManager.addIQProvider("messagemanagement", "http://akey.im/protocol/xmpp/iq/messagemanagement", new z3.b());
ProviderManager.addIQProvider("capacitymanagement", "http://akey.im/protocol/xmpp/iq/capacitymanagement", new v.a());
ProviderManager.addIQProvider("allinfocheck", "http://akey.im/protocol/xmpp/iq/allinfocheck", new i.b());
ProviderManager.addIQProvider("cleanallmessageforuser", "http://akey.im/protocol/xmpp/iq/cleanallmessageforuser", new e0.b());
ProviderManager.addIQProvider("desktopsession", "http://akey.im/protocol/xmpp/iq/onlinedesktopsessions", new i4.b());
ProviderManager.addIQProvider("desktopsession", "http://akey.im/protocol/xmpp/iq/deletedesktopsession", new n0.b());
ProviderManager.addIQProvider("miyuncapacity", "http://akey.im/protocol/xmpp/iq/miyuncapacity", new b3.a());
ProviderManager.addIQProvider("seaweedfscapacity", "http://akey.im/protocol/xmpp/iq/seaweedfscapacity", new o4.a());
ProviderManager.addIQProvider("queryorder", "http://akey.im/protocol/xmpp/iq/queryorder", new j4.a());
ProviderManager.addIQProvider("queryactivationcode", "http://akey.im/protocol/xmpp/iq/queryactivationcode", new a3.a());
ProviderManager.addIQProvider("activateuser", "http://akey.im/protocol/xmpp/iq/activateuser", new e.a());
ProviderManager.addIQProvider("licensepay", "http://akey.im/protocol/xmpp/iq/licenseorder", new c5.a());
ProviderManager.addIQProvider("miyundirectorycreate", "http://akey.im/protocol/xmpp/iq/miyundirectorycreate", new e2.a());
ProviderManager.addIQProvider("miyundirectorymodify", "http://akey.im/protocol/xmpp/iq/miyundirectorymodify", new g2.a());
ProviderManager.addIQProvider("miyundirectorydelete", "http://akey.im/protocol/xmpp/iq/miyundirectorydelete", new f2.a());
ProviderManager.addIQProvider("miyundirectoryquery", "http://akey.im/protocol/xmpp/iq/miyundirectoryquery", new h2.a());
ProviderManager.addIQProvider("miyunmessagedirectoryquery", "http://akey.im/protocol/xmpp/iq/miyunmessagedirectoryquery", new i2.a());
ProviderManager.addIQProvider("miyunmessageset", "http://akey.im/protocol/xmpp/iq/miyunmessageset", new j2.a());
ProviderManager.addIQProvider("publicuserdepartment", "http://akey.im/protocol/xmpp/iq/publicuserdepartment", new k3.b());
ProviderManager.addIQProvider("voipinviterequest", "http://akey.im/protocol/xmpp/iq/voipinviterequest", new p6.a());
ProviderManager.addIQProvider("voipreadyrequest", "http://akey.im/protocol/xmpp/iq/voipreadyrequest", new r6.a());
ProviderManager.addIQProvider("voipinviteack", "http://akey.im/protocol/xmpp/iq/voipinviteack", new o6.a());
ProviderManager.addIQProvider("voipsessionquery", "http://akey.im/protocol/xmpp/iq/voipsessionquery", new s6.a());
ProviderManager.addIQProvider("voipkeepalive", "http://akey.im/protocol/xmpp/iq/voipkeepalive", new q6.a());
ProviderManager.addIQProvider("voipend", "http://akey.im/protocol/xmpp/iq/voipend", new n6.a());
ProviderManager.addIQProvider("mucvote", "http://akey.im/protocol/xmpp/iq/mucvote#create", new p2.a());
ProviderManager.addIQProvider("mucvote", "http://akey.im/protocol/xmpp/iq/mucvote#close", new o2.a());
ProviderManager.addIQProvider("mucvote", "http://akey.im/protocol/xmpp/iq/mucvote#delete", new q2.a());
ProviderManager.addIQProvider("mucvote", "http://akey.im/protocol/xmpp/iq/mucvote#vote", new x0.a());
ProviderManager.addIQProvider("mucvote", "http://akey.im/protocol/xmpp/iq/mucvote#query", new c4.a());
ProviderManager.addIQProvider("mucvote", "http://akey.im/protocol/xmpp/iq/mucvote#list", new d4.a());
ProviderManager.addIQProvider("mucvote", "http://akey.im/protocol/xmpp/iq/mucvote#optionresult", new e4.a());
ProviderManager.addIQProvider("mucreview", "http://akey.im/protocol/xmpp/iq/mucreview#list", new b4.a());
ProviderManager.addIQProvider("mucreview", "http://akey.im/protocol/xmpp/iq/mucreview#create", new m2.a());
ProviderManager.addIQProvider("mucreview", "http://akey.im/protocol/xmpp/iq/mucreview#review", new w0.a());
ProviderManager.addIQProvider("mucreview", "http://akey.im/protocol/xmpp/iq/mucreview#delete", new n2.a());
ProviderManager.addIQProvider("mucreview", "http://akey.im/protocol/xmpp/iq/mucreview#query", new a4.a());
ProviderManager.addIQProvider("mucreview", "http://akey.im/protocol/xmpp/iq/mucreview#close", new l2.a());
ProviderManager.addIQProvider("usersbasicinfoquery", "http://akey.im/protocol/xmpp/iq/usersbasicinfoquery", new s4.b());
g.a aVar = y0.g.f48240g;
ProviderManager.addIQProvider(aVar.getELEMENT(), aVar.getNAMESPACE(), new g.b());
ProviderManager.addIQProvider("mcuinviterequest", "http://akey.im/protocol/xmpp/iq/mcuinviterequest", new y1.a());
ProviderManager.addIQProvider("mcuinvitelistrequest", "http://akey.im/protocol/xmpp/iq/mcuinvitelistrequest", new x1.a());
ProviderManager.addIQProvider("subscribechannel", "http://akey.im/protocol/xmpp/iq/subscribechannel", new c1.b());
ProviderManager.addIQProvider("unsubscribechannel", "http://akey.im/protocol/xmpp/iq/unsubscribechannel", new d6.b());
ProviderManager.addIQProvider("querychannel", "http://akey.im/protocol/xmpp/iq/querychannel", new h3.a());
ProviderManager.addIQProvider("subscribebot", "http://akey.im/protocol/xmpp/iq/subscribebot", new a1.b());
ProviderManager.addIQProvider("unsubscribebot", "http://akey.im/protocol/xmpp/iq/unsubscribebot", new b6.b());
ProviderManager.addIQProvider("querybot", "http://akey.im/protocol/xmpp/iq/querybot", new e3.a());
ProviderManager.addIQProvider("channelarticlehistory", "http://akey.im/protocol/xmpp/iq/channelarticlehistory", new u3.a());
ProviderManager.addIQProvider("toparticle", "http://akey.im/protocol/xmpp/iq/toparticle", new h4.a());
ProviderManager.addIQProvider("keysbundlequery", "http://akey.im/protocol/xmpp/iq/keysbundlequery", new k4.a());
ProviderManager.removeExtensionProvider("x", DelayInformationManager.LEGACY_DELAYED_DELIVERY_NAMESPACE);
ProviderManager.addExtensionProvider("x", DelayInformationManager.LEGACY_DELAYED_DELIVERY_NAMESPACE, new y0.k0());
ProviderManager.addExtensionProvider(y0.y0.f49028b, y0.y0.f49029c, new y0.a());
ProviderManager.addExtensionProvider(y0.y0.f49028b, y0.y0.f49030d, new y0.a());
ProviderManager.addIQProvider("friendkeysbundlequery", "http://akey.im/protocol/xmpp/iq/friendkeysbundlequery", new w4.a());
ProviderManager.addIQProvider("mucroomkeysbundlequery", "http://akey.im/protocol/xmpp/iq/mucroomkeysbundlequery", new s3.a());
ProviderManager.addIQProvider("sessiongroupattentionmessage", "http://akey.im/protocol/xmpp/iq/sessiongroupattentionmessage", new d3.a());
ProviderManager.addIQProvider("sessiongrouptopmessageconfirm", "http://akey.im/protocol/xmpp/iq/sessiongrouptopmessageconfirm", new w5.a());
ProviderManager.addIQProvider("sessiongrouptopmessagequery", "http://akey.im/protocol/xmpp/iq/sessiongrouptopmessagequery", new t4.a());
ProviderManager.addIQProvider("attentionmessagemanagement", "http://akey.im/protocol/xmpp/iq/attentionmessagemanagement", new k2.a());
ProviderManager.addIQProvider("allbotsinfosync", "http://akey.im/protocol/xmpp/iq/allbotsinfosync", new h.a());
ProviderManager.addIQProvider("externalapplications", "http://akey.im/protocol/xmpp/iq/externalapplications", new n3.b());
ProviderManager.addIQProvider("checkpassword", "http://akey.im/protocol/xmpp/iq/checkpassword", new a0.b());
ProviderManager.addIQProvider("phonenumberchange", "http://akey.im/protocol/xmpp/iq/phonenumberchange", new w.b());
ProviderManager.addIQProvider("phonenumberchangerequest", "http://akey.im/protocol/xmpp/iq/phonenumberchangerequest", new b5.b());
ProviderManager.addIQProvider("freeseaweedfschunksuploadtoken", "http://akey.im/protocol/xmpp/iq/freeseaweedfschunksuploadtoken", new f1.b());
ProviderManager.addIQProvider("freeqiniuuploadtoken", "http://akey.im/protocol/xmpp/iq/freeqiniuuploadtoken", new e1.b());
ProviderManager.addIQProvider("aliyunfsuploadtoken", "http://akey.im/protocol/xmpp/iq/aliyunfsuploadtoken", new g1.b());
ProviderManager.addIQProvider("checkaskeydata", "http://akey.im/protocol/xmpp/iq/checkaskeydata", new z.b());
ProviderManager.addIQProvider("queryuseraskeydatastate", "http://akey.im/protocol/xmpp/iq/queryuseraskeydatastate", new i6.b());
ProviderManager.addIQProvider("licenseinfo", "http://akey.im/protocol/xmpp/iq/getlicenseinfo", new v1.b());
ProviderManager.addIQProvider("getapprovelist", "http://akey.im/protocol/xmpp/iq/getapprovelist", new i1.b());
ProviderManager.addIQProvider("mucroom", "http://akey.im/protocol/xmpp/iq/mucroom#copy", new h0.b());
ProviderManager.addIQProvider("clearscreen", "http://akey.im/protocol/xmpp/iq/clearscreen", new r2.b());
ProviderManager.addIQProvider("mucsignin", "http://akey.im/protocol/xmpp/iq/mucsignin#set", new q5.b());
ProviderManager.addIQProvider("mucsignin", "http://akey.im/protocol/xmpp/iq/mucsignin#record", new m1.b());
ProviderManager.addIQProvider("mucsignin", "http://akey.im/protocol/xmpp/iq/mucsignin#ranking", new s5.b());
ProviderManager.addIQProvider("mucsignin", "http://akey.im/protocol/xmpp/iq/mucsignin#reset", new r5.b());
ProviderManager.addIQProvider("favouriteimages", "http://akey.im/protocol/xmpp/iq/favouriteimages#add", new f.b());
ProviderManager.addIQProvider("favouriteimages", "http://akey.im/protocol/xmpp/iq/favouriteimages#delete", new o0.b());
ProviderManager.addIQProvider("voipusersessionquery", "http://akey.im/protocol/xmpp/iq/voipusersessionquery", new z2.a());
ProviderManager.addIQProvider("speechfrequency", "http://akey.im/protocol/xmpp/iq/getspeechfrequency", new q4.b());
ProviderManager.addIQProvider("cancelusersmscoderequest", "http://akey.im/protocol/xmpp/iq/cancelusersmscoderequest", new g3.a());
ProviderManager.addIQProvider("cancelusersubrequest", "http://akey.im/protocol/xmpp/iq/cancelusersubrequest", new v0.a());
ProviderManager.addIQProvider("canceluserapplyinfo", "http://akey.im/protocol/xmpp/iq/canceluserapplyinfo", new f3.a());
ProviderManager.addIQProvider("canceluserapplycancel", "http://akey.im/protocol/xmpp/iq/canceluserapplycancel", new r.a());
ProviderManager.addIQProvider("currentrustdevicetype", "http://akey.im/protocol/xmpp/iq/currentrustdevicetype", new y3.a());
ProviderManager.addIQProvider("deviceauthlist", "http://akey.im/protocol/xmpp/iq/deviceauthlist", new m3.a());
ProviderManager.addIQProvider("cancelauthdevice", "http://akey.im/protocol/xmpp/iq/cancelauthdevice", new u.a());
ProviderManager.addIQProvider("offlinetrustdevice", "http://akey.im/protocol/xmpp/iq/offlinetrustdevice", new t6.a());
ProviderManager.addIQProvider("getotherserverstatus", "http://akey.im/protocol/xmpp/iq/getotherserverstatus", new z4.b());
ProviderManager.addIQProvider("usersearch", "http://akey.im/protocol/xmpp/iq/usersearch", new g5.b());
ProviderManager.addIQProvider("mcuaction", "http://akey.im/protocol/xmpp/iq/mcuaction", new h6.b());
ProviderManager.addIQProvider("aws_signed_url", "http://akey.im/protocol/xmpp/iq/aws_signed_url", new j1.b());
ProviderManager.addIQProvider("canceled_complain_req", "http://akey.im/protocol/xmpp/iq/canceled_complain_req", new s.a());
ProviderManager.addIQProvider("canceled_complain", "http://akey.im/protocol/xmpp/iq/canceled_complain", new t.a());
ProviderManager.addIQProvider("complain_details", "http://akey.im/protocol/xmpp/iq/complain_details", new i3.a());
ProviderManager.addIQProvider("complain_key", "http://akey.im/protocol/xmpp/iq/complain_key", new j3.a());
ProviderManager.addIQProvider("mucroomquery", "http://akey.im/protocol/xmpp/iq/mucroomquery", new q3.a());
ProviderManager.addIQProvider("complain_history", "http://akey.im/protocol/xmpp/iq/complain_history", new g4.b());
ProviderManager.addIQProvider("new_complain_details", "http://akey.im/protocol/xmpp/iq/new_complain_details", new f4.b());
ProviderManager.addIQProvider("bulk_canceled_complain_req", "http://akey.im/protocol/xmpp/iq/bulk_canceled_complain_req", new o.b());
ProviderManager.addIQProvider("complain_set_readed", "http://akey.im/protocol/xmpp/iq/complain_set_readed", new g0.b());
ProviderManager.addIQProvider("chatsessionlastclearinfo", "http://akey.im/protocol/xmpp/iq/chatsessionlastclearinfo", new w3.a());
ProviderManager.addIQProvider("device_status_list", "http://akey.im/protocol/xmpp/iq/device_status_list", new l3.a());
ProviderManager.addIQProvider("offlinedevice", "http://akey.im/protocol/xmpp/iq/offlinedevice", new t1.a());
ProviderManager.addIQProvider("bulk_feedback_session_message", "http://akey.im/protocol/xmpp/iq/bulk_feedback_session_message", new u2.a());
ProviderManager.addIQProvider("feedback_message_status", "http://akey.im/protocol/xmpp/iq/feedback_message_status", new v2.a());
ProviderManager.addIQProvider("changed_feedback_session", "http://akey.im/protocol/xmpp/iq/changed_feedback_session", new x.a());
ProviderManager.addIQProvider("feedback_clean_unread", "http://akey.im/protocol/xmpp/iq/feedback_clean_unread", new b0.b());
ProviderManager.addIQProvider("get_feedback_user_info", "http://akey.im/protocol/xmpp/iq/get_feedback_user_info", new o3.b());
ProviderManager.addIQProvider("get_user_status", "http://akey.im/protocol/xmpp/iq/get_user_status", new p3.b());
ProviderManager.addIQProvider("customer_ask", "http://akey.im/protocol/xmpp/iq/customer_ask", new m.a());
ProviderManager.addIQProvider("intercept_bot_msg", "http://akey.im/protocol/xmpp/iq/intercept_bot_msg", new t5.a());
ProviderManager.addIQProvider("feedback_set_auto_reply", "http://akey.im/protocol/xmpp/iq/feedback_set_auto_reply", new l5.b());
ProviderManager.addExtensionProvider(y0.k5.f48464b, y0.k5.f48465c, new k5.a());
}
private final boolean i(AbstractXMPPConnection connection, boolean isManualLogin) throws Exception {
Log.i("XMPPConnectionManager", "before connect to openfire on " + ak.im.utils.o3.getCurDateStr() + ", Thread: " + Thread.currentThread().getId());
if (this.mConnectionListener != null) {
Log.d("XMPPConnectionManager", "connection is set mConnectionListener in establish.");
if (connection != null) {
connection.addConnectionListener(this.mConnectionListener);
}
}
if (AKCCheckPoint.isChecking("CHECKPOINT_LOGIN") != null) {
AKCCheckPoint.actionPointStart("CHECKPOINT_LOGIN", "c");
}
try {
if (connection != null) {
try {
try {
connection.connect();
} catch (XMPPException e10) {
Log.e("XMPPConnectionManager", "XMPPException:" + e10.getMessage());
AKCCheckPoint.setCustomInfo(kotlin.collections.u.mapOf(kd.i.to("fr", "3"), kd.i.to("msg", String.valueOf(e10.getMessage()))), "CHECKPOINT_LOGIN");
}
} catch (SmackException e11) {
Log.e("XMPPConnectionManager", "SmackException:" + e11.getMessage());
if (e11 instanceof SmackException.ConnectionException) {
AKCCheckPoint.setCustomInfo(kotlin.collections.u.mapOf(kd.i.to("fr", "1"), kd.i.to("msg", String.valueOf(e11.getMessage()))), "CHECKPOINT_LOGIN");
} else if (e11 instanceof SmackException.NoResponseException) {
AKCCheckPoint.setCustomInfo(kotlin.collections.u.mapOf(kd.i.to("fr", "2"), kd.i.to("msg", String.valueOf(e11.getMessage()))), "CHECKPOINT_LOGIN");
} else {
AKCCheckPoint.setCustomInfo(kotlin.collections.u.mapOf(kd.i.to("fr", PushConstants.PUSH_TYPE_WITHDRAW_NOTIFICATION), kd.i.to("msg", String.valueOf(e11.getMessage()))), "CHECKPOINT_LOGIN");
}
} catch (Exception e12) {
Log.w("XMPPConnectionManager", "XMPP Exception|" + e12.getMessage());
if (e12 instanceof XMPPException) {
Log.w("XMPPConnectionManager", "XMPP connection failed because of stream error: " + e12.getMessage());
throw e12;
}
throw e12;
}
}
return true;
} catch (Throwable th) {
if (AKCCheckPoint.isChecking("CHECKPOINT_LOGIN") != null) {
AKCCheckPoint.actionPointEnd("CHECKPOINT_LOGIN", "c");
}
throw th;
}
}
private final AbstractXMPPConnection j() throws Exception {
try {
Server server = f1.getInstance().getServer();
String str = "https://" + server.getXmppDomain();
SmackConfiguration.setDefaultReplyTimeout(15000);
boolean areEqual = kotlin.jvm.internal.r.areEqual(Server.PROTOCOL_BOSH, server.getAkSmackProtocol());
c cVar = new c();
cVar.setLevel(Level.ALL);
Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual);
int i10 = 0;
Roster.setRosterLoadedAtLoginDefault(false);
if (areEqual) {
BOSHConfiguration.Builder builder = BOSHConfiguration.builder();
builder.setHost(server.getXmppIP());
builder.setPort(7443);
builder.setFile("/http-bind/");
builder.setXmppDomain(server.getXmppDomain());
builder.addEnabledSaslMechanism("ASIM-E");
builder.setUseHttps(true);
builder.setHostAddress(InetAddress.getByName(server.getXmppIP()));
builder.setSocketFactory(of.getInstance(str));
builder.setSendPresence(false);
builder.setDebuggerEnabled(true);
builder.setKeystoreType(null);
builder.setEnabledSSLProtocols(new String[]{TLSUtils.PROTO_TLSV1_2, TLSUtils.PROTO_TLSV1_1, "TLSv1.0"});
builder.setCustomX509TrustManager(new AkeyChatX509PrivateCA(new URL(str)));
builder.setSecurityMode(ConnectionConfiguration.SecurityMode.required).setHostnameVerifier(HttpURLTools.f10131a);
this.connection = new y0.a(builder.build());
Logger logger = Logger.getLogger(XMPPBOSHConnection.class.getName());
kotlin.jvm.internal.r.checkNotNullExpressionValue(logger, "getLogger(XMPPBOSHConnection::class.java.name)");
logger.setLevel(Level.ALL);
logger.addHandler(cVar);
} else {
XMPPTCPConnectionConfiguration.Builder builder2 = XMPPTCPConnectionConfiguration.builder();
HttpURLTools.prepareKeyManager(null, null);
builder2.setXmppDomain(server.getXmppDomain()).addEnabledSaslMechanism("ASIM-E").setDebuggerEnabled(true).setSendPresence(false).setSecurityMode(ConnectionConfiguration.SecurityMode.ifpossible).setSocketFactory(of.getInstance(str));
builder2.setHostAddress(InetAddress.getByName(server.getXmppIP())).setPort(server.getXmppPort()).setCompressionEnabled(true).setKeystoreType(null).setEnabledSSLProtocols(new String[]{TLSUtils.PROTO_TLSV1_2, TLSUtils.PROTO_TLSV1_1, "TLSv1.0"}).setCustomX509TrustManager(new AkeyChatX509PrivateCA(new URL(str))).setHostnameVerifier(HttpURLTools.f10131a).setConnectTimeout(AKCAppConfiguration.f9925a.connTimeout());
f1784p = builder2.build();
XMPPTCPConnection xMPPTCPConnection = new XMPPTCPConnection(f1784p);
xMPPTCPConnection.setUseStreamManagement(false);
xMPPTCPConnection.setUseStreamManagementResumption(false);
this.connection = xMPPTCPConnection;
Logger logger2 = Logger.getLogger(AbstractXMPPConnection.class.getName());
kotlin.jvm.internal.r.checkNotNullExpressionValue(logger2, "getLogger(AbstractXMPPConnection::class.java.name)");
logger2.setUseParentHandlers(false);
logger2.setLevel(Level.ALL);
logger2.addHandler(cVar);
Logger logger3 = Logger.getLogger(XMPPTCPConnection.class.getName());
kotlin.jvm.internal.r.checkNotNullExpressionValue(logger3, "getLogger(XMPPTCPConnection::class.java.name)");
logger3.setLevel(Level.ALL);
logger3.addHandler(cVar);
}
StringBuilder sb2 = new StringBuilder();
sb2.append("check roster hash code:");
Roster roster = getRoster();
if (roster != null) {
i10 = roster.hashCode();
}
sb2.append(i10);
Log.i("XMPPConnectionManager", sb2.toString());
h();
b bVar = new b();
this.mConnectionListener = bVar;
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection != null) {
abstractXMPPConnection.addConnectionListener(bVar);
}
AbstractXMPPConnection abstractXMPPConnection2 = this.connection;
if (abstractXMPPConnection2 != null) {
abstractXMPPConnection2.addPacketInterceptor(new StanzaListener() {
@Override
public final void processStanza(Stanza stanza) {
XMPPConnectionManager.k(stanza);
}
}, new StanzaFilter() {
@Override
public final boolean accept(Stanza stanza) {
boolean l10;
l10 = XMPPConnectionManager.l(stanza);
return l10;
}
});
}
Log.i("XMPPConnectionManager", "return xmpp connection");
return this.connection;
} catch (Exception e10) {
e10.printStackTrace();
Log.i("XMPPConnectionManager", "init xmpp failed ,msg is " + e10.getMessage());
throw e10;
}
}
public static final void k(Stanza stanza) {
if (stanza != null) {
((IQ) stanza).setLanguage(e.c.f35031a.getLanguage());
return;
}
throw new NullPointerException("null cannot be cast to non-null type org.jivesoftware.smack.packet.IQ");
}
public static final boolean l(Stanza stanza) {
return stanza instanceof IQ;
}
public static final void m(long j10, XMPPConnectionManager this$0, Long l10) {
kotlin.jvm.internal.r.checkNotNullParameter(this$0, "this$0");
Log.w("XMPPConnectionManager", "after delay:" + j10 + " start reconnect");
this$0.status = "xmpp.disconnected";
this$0.q("xmpp.connecting");
}
private final void n(XMPPConnection xMPPConnection) {
synchronized (this.mConnectionChangeListeners) {
for (String str : this.mConnectionChangeListeners.keySet()) {
Log.i("XMPPConnectionManager", "notify conn change to listener: " + str);
l.b0 b0Var = this.mConnectionChangeListeners.get(str);
if (b0Var != null) {
Log.i("XMPPConnectionManager", "newConnection :" + str);
b0Var.newConnection(xMPPConnection);
} else {
Log.i("XMPPConnectionManager", "get a null mXmppConnectionChangeListener");
}
}
kd.s sVar = kd.s.f40925a;
}
}
@SuppressLint({"UseValueOf"})
private final void o(AbstractXMPPConnection abstractXMPPConnection) {
Boolean bool;
Boolean bool2;
Boolean bool3;
Boolean bool4;
this.connection = abstractXMPPConnection;
StringBuilder sb2 = new StringBuilder();
sb2.append("connection established with parameters: con=");
AbstractXMPPConnection abstractXMPPConnection2 = this.connection;
if (abstractXMPPConnection2 != null) {
bool = Boolean.valueOf(abstractXMPPConnection2.isConnected());
} else {
bool = null;
}
sb2.append(bool);
sb2.append(",auth=");
AbstractXMPPConnection abstractXMPPConnection3 = this.connection;
if (abstractXMPPConnection3 != null) {
bool2 = Boolean.valueOf(abstractXMPPConnection3.isAuthenticated());
} else {
bool2 = null;
}
sb2.append(bool2);
sb2.append(" enc=");
AbstractXMPPConnection abstractXMPPConnection4 = this.connection;
if (abstractXMPPConnection4 != null) {
bool3 = Boolean.valueOf(abstractXMPPConnection4.isSecureConnection());
} else {
bool3 = null;
}
sb2.append(bool3);
sb2.append(" comp=");
AbstractXMPPConnection abstractXMPPConnection5 = this.connection;
if (abstractXMPPConnection5 != null) {
bool4 = Boolean.valueOf(abstractXMPPConnection5.isUsingCompression());
} else {
bool4 = null;
}
sb2.append(bool4);
Log.i("XMPPConnectionManager", sb2.toString());
this.status = "xmpp.connected";
q("xmpp.connected");
INSTANCE.setmLoginCode(200);
this.isDoLogin = false;
n(this.connection);
if (AKCAppConfiguration.f9925a.canShowAccessInfo()) {
AsyncKt.doAsync$default(this, null, new vd.l<AnkoAsyncContext<XMPPConnectionManager>, kd.s>() {
@Override
public kd.s invoke(AnkoAsyncContext<XMPPConnectionManager> ankoAsyncContext) {
invoke2(ankoAsyncContext);
return kd.s.f40925a;
}
public final void invoke2(@NotNull AnkoAsyncContext<XMPPConnectionManager> doAsync) {
Map mapOf;
kotlin.jvm.internal.r.checkNotNullParameter(doAsync, "$this$doAsync");
Server server = f1.getInstance().getServer();
if (server != null) {
UniversalPing companion = UniversalPing.INSTANCE.getInstance();
String xmppDomain = server.getXmppDomain();
kotlin.jvm.internal.r.checkNotNullExpressionValue(xmppDomain, "xmppDomain");
String xmppIP = server.getXmppIP();
kotlin.jvm.internal.r.checkNotNullExpressionValue(xmppIP, "xmppIP");
mapOf = kotlin.collections.x.mapOf(kd.i.to("t", String.valueOf(AKCCheckPoint.AKCReportException.AKCReportException_XMPPPING.getValue())), kd.i.to("msg", String.valueOf(companion.XmppPing(xmppDomain, xmppIP, server.getXmppPort()))));
AKCCheckPoint.aliyunLog(mapOf, AKCCheckPoint.AKCSLSLogTopic.AKCSLSLogTopic_APPERROR.getValue());
}
}
}, 1, null);
}
}
public final void p() {
this.pingFailedTime = 0;
this.pingContinuousSuccessTime = 0;
}
private final void q(String str) {
Log.i("XMPPConnectionManager", "send connect status " + str);
Intent intent = new Intent(j.u0.f40390c);
intent.putExtra("reconnect_state", str);
ak.im.utils.s3.sendEvent(g.h3.getInstance("xmpp-mgr-send-") + str);
this.context.sendBroadcast(intent);
}
public static final void r(XMPPConnectionManager this$0, IQ req, fc.b0 subscriber) {
kotlin.jvm.internal.r.checkNotNullParameter(this$0, "this$0");
kotlin.jvm.internal.r.checkNotNullParameter(req, "$req");
kotlin.jvm.internal.r.checkNotNullParameter(subscriber, "subscriber");
try {
subscriber.onNext(this$0.sendIQDirectly(req));
subscriber.onComplete();
} catch (Exception e10) {
subscriber.onError(e10);
}
}
public static final void s(XMPPConnectionManager this$0, IQ req, long j10, fc.b0 subscriber) {
kotlin.jvm.internal.r.checkNotNullParameter(this$0, "this$0");
kotlin.jvm.internal.r.checkNotNullParameter(req, "$req");
kotlin.jvm.internal.r.checkNotNullParameter(subscriber, "subscriber");
try {
subscriber.onNext(this$0.sendIQDirectly(req, j10));
subscriber.onComplete();
} catch (Exception e10) {
subscriber.onError(e10);
}
}
public static final boolean t(String str, Stanza stanza) {
String str2;
if (stanza instanceof Message) {
y0.i5 i5Var = (y0.i5) stanza.getExtension(DeliveryReceipt.ELEMENT, "http://akey.im/protocol/xmpp/extend/server-receipts");
StringBuilder sb2 = new StringBuilder();
sb2.append("sendPresenceWithResponse id is ");
sb2.append(str);
sb2.append(" body is ");
String str3 = null;
if (i5Var != null) {
str2 = i5Var.getId();
} else {
str2 = null;
}
sb2.append(str2);
Log.i("XMPPConnectionManager", sb2.toString());
if (i5Var != null) {
str3 = i5Var.getId();
}
return str.equals(str3);
}
return false;
}
public static final void u(vd.a tmp0) {
kotlin.jvm.internal.r.checkNotNullParameter(tmp0, "$tmp0");
tmp0.invoke();
}
public final void connect(boolean z10) throws Exception {
AbstractXMPPConnection j10;
if (f1789u) {
Log.w("XMPPConnectionManager", "is clear message do not connect");
return;
}
long currentTimeMillis = System.currentTimeMillis();
this.status = "xmpp.connecting";
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection != null) {
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection);
if (!abstractXMPPConnection.isConnected()) {
Log.i("XMPPConnectionManager", "directly connect and auth");
j10 = this.connection;
if (!i(j10, z10)) {
return;
}
Log.i("XMPPConnectionManager", "connect to open-fire ,time diff:" + (System.currentTimeMillis() - currentTimeMillis));
o(j10);
}
}
Log.i("XMPPConnectionManager", "init connection params, connect and auth");
j10 = j();
if (j10 == null) {
Log.e("XMPPConnectionManager", "Exception creating new XMPP Connection in connect");
return;
}
if (!i(j10, z10)) {
return;
}
Log.i("XMPPConnectionManager", "connect to open-fire ,time diff:" + (System.currentTimeMillis() - currentTimeMillis));
o(j10);
}
public final void destroy(boolean z10) {
Log.i("XMPPConnectionManager", Destroy.ELEMENT);
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection != null) {
ConnectionListener connectionListener = this.mConnectionListener;
if (connectionListener != null && abstractXMPPConnection != null) {
abstractXMPPConnection.removeConnectionListener(connectionListener);
}
AbstractXMPPConnection abstractXMPPConnection2 = this.connection;
if (abstractXMPPConnection2 != null) {
abstractXMPPConnection2.disconnect();
}
if (z10) {
this.connection = null;
MessageListenerManger.getInstance().reset();
}
}
Log.i("XMPPConnectionManager", "destroy finish");
}
public final void disconnect(@Nullable String str) {
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection != null) {
abstractXMPPConnection.disconnect();
}
this.status = "xmpp.disconnected";
Log.i("XMPPConnectionManager", "disconnect send broadcast,type:" + str);
if (!kotlin.jvm.internal.r.areEqual("reconnect", str)) {
q("xmpp.disconnected");
}
}
public final void forceStartPing() {
Log.i("XMPPConnectionManager", "force start ping");
ScheduledFuture<?> scheduledFuture = this.nextAutomaticPing;
if (scheduledFuture != null) {
scheduledFuture.cancel(true);
}
p();
startPing(0L);
}
@Nullable
public final String getConflictHint() {
return this.conflictHint;
}
@Nullable
public final AbstractXMPPConnection getConnection() {
return this.connection;
}
@Nullable
public final Roster getRoster() {
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection != null) {
return Roster.getInstanceFor(abstractXMPPConnection);
}
return null;
}
@NotNull
public final String getStatus() {
return this.status;
}
public final void increaseLoginFailedTimes() {
this.mLoginFailedTimes++;
}
public final void instantDisconnect() {
Log.i("XMPPConnectionManager", "instant disconnect without waiting for stream close");
AbstractXMPPConnection abstractXMPPConnection = this.connection;
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection);
if (abstractXMPPConnection.isConnected()) {
AbstractXMPPConnection abstractXMPPConnection2 = this.connection;
if (abstractXMPPConnection2 != null) {
((XMPPTCPConnection) abstractXMPPConnection2).instantShutdown();
this.status = "xmpp.disconnected";
q("xmpp.disconnected");
try {
ConnectionListener connectionListener = this.mConnectionListener;
if (connectionListener != null) {
connectionListener.connectionClosed();
return;
}
return;
} catch (Exception e10) {
AkeyChatUtils.logException(e10);
return;
}
}
throw new NullPointerException("null cannot be cast to non-null type org.jivesoftware.smack.tcp.XMPPTCPConnection");
}
Log.i("XMPPConnectionManager", "xmpp conn already shutdown");
}
public final boolean getIsDoLogin() {
return this.isDoLogin;
}
public final boolean isEffective() {
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection != null) {
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection);
if (abstractXMPPConnection.isConnected()) {
AbstractXMPPConnection abstractXMPPConnection2 = this.connection;
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection2);
if (abstractXMPPConnection2.isAuthenticated()) {
return true;
}
}
}
return false;
}
public final boolean isFailedTimesOverflow() {
if (this.mLoginFailedTimes > 3) {
return true;
}
return false;
}
@SuppressLint({"CheckResult"})
public final void maybeStartReconnect(boolean z10) {
int i10;
f1.getInstance().setLoginStatus(1);
ak.im.utils.s3.sendEvent(new g.y6());
if (j0.t.isNetWorkAvailableInPhysical()) {
if (z10) {
i10 = 1000;
} else {
i10 = 0;
}
final long j10 = i10;
Log.w("XMPPConnectionManager", "we will send xmpp reconnect broadcast and will delay:" + j10 + " ms");
fc.z.timer(j10, TimeUnit.MILLISECONDS, gd.b.io()).subscribe(new mc.g() {
@Override
public final void accept(Object obj) {
XMPPConnectionManager.m(j10, this, (Long) obj);
}
});
}
}
public final void reconnect(boolean z10) throws Exception {
Boolean valueOf;
StringBuilder sb2 = new StringBuilder();
sb2.append("reconnect xmpp: conn status ");
sb2.append(this.status);
sb2.append(", connection isConnected ");
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection == null) {
valueOf = null;
} else {
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection);
valueOf = Boolean.valueOf(abstractXMPPConnection.isConnected());
}
sb2.append(valueOf);
sb2.append(",is-manual-login:");
sb2.append(z10);
Log.i("XMPPConnectionManager", sb2.toString());
disconnect("reconnect");
connect(z10);
}
public final void registerConnectionChangeListener(@NotNull l.b0 listener) {
kotlin.jvm.internal.r.checkNotNullParameter(listener, "listener");
synchronized (this.mConnectionChangeListeners) {
String key = listener.getClass().getSimpleName();
Map<String, l.b0> map = this.mConnectionChangeListeners;
kotlin.jvm.internal.r.checkNotNullExpressionValue(key, "key");
map.put(key, listener);
}
}
public final void resetConnection() {
this.connection = null;
}
public final void resetLoginFailedTimes() {
this.mLoginFailedTimes = 0;
}
@NotNull
public final Stanza sendIQDirectly(@NotNull IQ req) {
kotlin.jvm.internal.r.checkNotNullParameter(req, "req");
return sendIQDirectly(req, SmackConfiguration.getDefaultReplyTimeout());
}
@NotNull
public final fc.z<Stanza> sendIQWithRx(@NotNull final IQ req) {
kotlin.jvm.internal.r.checkNotNullParameter(req, "req");
fc.z<Stanza> create = fc.z.create(new fc.c0() {
@Override
public final void subscribe(fc.b0 b0Var) {
XMPPConnectionManager.r(XMPPConnectionManager.this, req, b0Var);
}
});
kotlin.jvm.internal.r.checkNotNullExpressionValue(create, "create { subscriber: Obs…\n }\n\n }");
return create;
}
public final void sendPresence(@NotNull Presence presence) {
kotlin.jvm.internal.r.checkNotNullParameter(presence, "presence");
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection == null) {
Log.w("XMPPConnectionManager", "send presence failed for connection is null");
return;
}
try {
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection);
abstractXMPPConnection.sendStanza(presence);
} catch (InterruptedException e10) {
e10.printStackTrace();
} catch (SmackException.NotConnectedException e11) {
e11.printStackTrace();
}
}
public final boolean sendPresenceWithResponse(@NotNull Presence req) {
kotlin.jvm.internal.r.checkNotNullParameter(req, "req");
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection != null) {
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection);
if (abstractXMPPConnection.isAuthenticated()) {
final String stanzaId = req.getStanzaId();
AbstractXMPPConnection abstractXMPPConnection2 = this.connection;
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection2);
StanzaCollector createStanzaCollector = abstractXMPPConnection2.createStanzaCollector(new StanzaFilter() {
@Override
public final boolean accept(Stanza stanza) {
boolean t10;
t10 = XMPPConnectionManager.t(stanzaId, stanza);
return t10;
}
});
try {
AbstractXMPPConnection abstractXMPPConnection3 = this.connection;
if (abstractXMPPConnection3 != null) {
abstractXMPPConnection3.sendStanza(req);
}
Stanza stanza = null;
try {
stanza = createStanzaCollector.nextResult(SmackConfiguration.getDefaultReplyTimeout());
createStanzaCollector.cancel();
} catch (Exception e10) {
AkeyChatUtils.logException(e10);
Log.w("XMPPConnectionManager", "encounter excp(fail) when send iq result");
}
if (stanza != null) {
if (stanza.getError() != null) {
Log.w("XMPPConnectionManager", "encounter excp (err code) when send iq,error:" + stanza.getError());
return false;
}
return true;
}
Log.w("XMPPConnectionManager", "encounter excp (no resp) when send iq timeout,id:" + stanzaId);
IQException iQException = new IQException(IQException.TIMEOUT);
AkeyChatUtils.logException(iQException);
throw iQException;
} catch (Exception e11) {
AkeyChatUtils.logException(e11);
Log.w("XMPPConnectionManager", "encounter excp(fail) when send iq ");
throw e11;
}
}
}
Log.w("XMPPConnectionManager", "connection is null send iq failed");
throw new IQException(IQException.OFFLINE);
}
public final void setDoLogin(boolean z10) {
this.isDoLogin = z10;
}
public final void startPing(long j10) {
Log.i("XMPPConnectionManager", "start schedule ping task,will delay:" + j10 + " s, total:" + this.pingTime + ",success:" + this.pingContinuousSuccessTime + ",fail:" + this.pingFailedTime);
if (!isEffective()) {
Log.w("XMPPConnectionManager", "connect is not effective do not start ping");
return;
}
ScheduledExecutorService scheduledExecutorService = this.executorService;
final vd.a<kd.s> aVar = this.f1800k;
this.nextAutomaticPing = scheduledExecutorService.schedule(new Runnable() {
@Override
public final void run() {
XMPPConnectionManager.u(vd.a.this);
}
}, j10, TimeUnit.SECONDS);
}
public final void unregisterConnectionChangeListeners() {
synchronized (this.mConnectionChangeListeners) {
this.mConnectionChangeListeners.clear();
kd.s sVar = kd.s.f40925a;
}
}
@NotNull
public final Stanza sendIQDirectly(@NotNull IQ req, long time) {
kotlin.jvm.internal.r.checkNotNullParameter(req, "req");
AbstractXMPPConnection abstractXMPPConnection = this.connection;
if (abstractXMPPConnection != null) {
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection);
if (abstractXMPPConnection.isAuthenticated()) {
AbstractXMPPConnection abstractXMPPConnection2 = this.connection;
kotlin.jvm.internal.r.checkNotNull(abstractXMPPConnection2);
StanzaCollector createStanzaCollector = abstractXMPPConnection2.createStanzaCollector(new StanzaIdFilter(req.getStanzaId()));
try {
if ((req instanceof y0.d3) || (req instanceof y0.t4)) {
String stanzaId = req.getStanzaId();
kotlin.jvm.internal.r.checkNotNullExpressionValue(stanzaId, "req.stanzaId");
AKCCheckPoint.initCheckActionSinglePoint(stanzaId);
}
AbstractXMPPConnection abstractXMPPConnection3 = this.connection;
if (abstractXMPPConnection3 != null) {
abstractXMPPConnection3.sendStanza(req);
}
Stanza stanza = null;
try {
stanza = createStanzaCollector.nextResult(time);
createStanzaCollector.cancel();
} catch (Exception e10) {
AkeyChatUtils.logException(e10);
Log.w("XMPPConnectionManager", "encounter excp(fail) when send iq result");
}
if (stanza != null) {
if (stanza.getError() != null) {
if ((stanza instanceof y0.f3) && kotlin.jvm.internal.r.areEqual("501", ((y0.f3) stanza).f48231e)) {
return stanza;
}
String descriptiveText = stanza.getError().getDescriptiveText();
if (!(descriptiveText == null || descriptiveText.length() == 0)) {
JSONObject parseObject = JSON.parseObject(stanza.getError().getDescriptiveText());
if (parseObject != null && parseObject.containsKey("description")) {
String string = parseObject.getString("description");
kotlin.jvm.internal.r.checkNotNullExpressionValue(string, "parse.getString(\"description\")");
throw new DefineXmppErrorEvent(string);
}
} else {
Log.w("XMPPConnectionManager", "encounter excp (err code) when send iq,error:" + stanza.getError());
IQException iQException = new IQException(IQException.SERVER_INTERNAL_ERR);
AkeyChatUtils.logException(iQException);
throw iQException;
}
}
String stanzaId2 = req.getStanzaId();
kotlin.jvm.internal.r.checkNotNullExpressionValue(stanzaId2, "req.stanzaId");
j0.a endCheckActionSinglePoint = AKCCheckPoint.endCheckActionSinglePoint(stanzaId2);
if (endCheckActionSinglePoint != null && endCheckActionSinglePoint.total1() > BleConstant.SEND_OUTTIME) {
if (req instanceof y0.d3) {
int value = AKCCheckPoint.AKCReportException.AKCReportException_PullAttentionMessageWarnning.getValue();
kotlin.jvm.internal.w wVar = kotlin.jvm.internal.w.f41176a;
y0.d3 d3Var = (y0.d3) req;
String format = String.format("%s|%s|{%d:%d}|%d", Arrays.copyOf(new Object[]{d3Var.getStanzaId(), d3Var.getmSessionId(), Long.valueOf(d3Var.getmSeqNO()), Long.valueOf(d3Var.getmOffset()), Long.valueOf(endCheckActionSinglePoint.total1())}, 5));
kotlin.jvm.internal.r.checkNotNullExpressionValue(format, "format(format, *args)");
AKCCheckPoint.reportException(value, format);
} else if (req instanceof y0.t4) {
int value2 = AKCCheckPoint.AKCReportException.AKCReportException_PullTopMessageWarnning.getValue();
kotlin.jvm.internal.w wVar2 = kotlin.jvm.internal.w.f41176a;
y0.t4 t4Var = (y0.t4) req;
String format2 = String.format("%s|%s|{%d:%d}|%d", Arrays.copyOf(new Object[]{t4Var.getStanzaId(), t4Var.getmSessionId(), Long.valueOf(t4Var.getmSeqNO()), Long.valueOf(t4Var.getmOffset()), Long.valueOf(endCheckActionSinglePoint.total1())}, 5));
kotlin.jvm.internal.r.checkNotNullExpressionValue(format2, "format(format, *args)");
AKCCheckPoint.reportException(value2, format2);
}
}
return stanza;
}
Log.w("XMPPConnectionManager", "encounter excp (no resp) when send iq timeout:" + req.getChildElementNamespace() + ",id:" + req.getStanzaId());
IQException iQException2 = new IQException(IQException.TIMEOUT);
AkeyChatUtils.logException(iQException2);
throw iQException2;
} catch (Exception e11) {
AKCCheckPoint.reportException(AKCCheckPoint.AKCReportException.AKCReportExceptionIQ.getValue(), "send iq err 1");
AkeyChatUtils.logException(e11);
Log.w("XMPPConnectionManager", "encounter excp(fail) when send iq ");
throw e11;
}
}
}
Log.w("XMPPConnectionManager", "connection is null send iq failed");
throw new IQException(IQException.OFFLINE);
}
@NotNull
public final fc.z<Stanza> sendIQWithRx(@NotNull final IQ req, final long time) {
kotlin.jvm.internal.r.checkNotNullParameter(req, "req");
fc.z<Stanza> create = fc.z.create(new fc.c0() {
@Override
public final void subscribe(fc.b0 b0Var) {
XMPPConnectionManager.s(XMPPConnectionManager.this, req, time, b0Var);
}
});
kotlin.jvm.internal.r.checkNotNullExpressionValue(create, "create { subscriber: Obs…\n }\n\n }");
return create;
}
}