导航菜单

页面标题

页面副标题

Delta Chat v1.58.3 - DcContext.java 源代码

正在查看: Delta Chat v1.58.3 应用的 DcContext.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.b44t.messenger;

public class DcContext {
    private static final String CONFIG_MUTE_MENTIONS_IF_MUTED = "ui.mute_mentions_if_muted";
    public static final int DC_CONNECTIVITY_CONNECTED = 4000;
    public static final int DC_CONNECTIVITY_CONNECTING = 2000;
    public static final int DC_CONNECTIVITY_NOT_CONNECTED = 1000;
    public static final int DC_CONNECTIVITY_WORKING = 3000;
    public static final int DC_EVENT_ACCOUNTS_BACKGROUND_FETCH_DONE = 2200;
    public static final int DC_EVENT_CHAT_DELETED = 2023;
    public static final int DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED = 2021;
    public static final int DC_EVENT_CHAT_MODIFIED = 2020;
    public static final int DC_EVENT_CONFIGURE_PROGRESS = 2041;
    public static final int DC_EVENT_CONNECTIVITY_CHANGED = 2100;
    public static final int DC_EVENT_CONTACTS_CHANGED = 2030;
    public static final int DC_EVENT_ERROR = 400;
    public static final int DC_EVENT_ERROR_SELF_NOT_IN_GROUP = 410;
    public static final int DC_EVENT_IMEX_FILE_WRITTEN = 2052;
    public static final int DC_EVENT_IMEX_PROGRESS = 2051;
    public static final int DC_EVENT_INCOMING_MSG = 2005;
    public static final int DC_EVENT_INCOMING_REACTION = 2002;
    public static final int DC_EVENT_INCOMING_WEBXDC_NOTIFY = 2003;
    public static final int DC_EVENT_INFO = 100;
    public static final int DC_EVENT_LOCATION_CHANGED = 2035;
    public static final int DC_EVENT_MSGS_CHANGED = 2000;
    public static final int DC_EVENT_MSGS_NOTICED = 2008;
    public static final int DC_EVENT_MSG_DELIVERED = 2010;
    public static final int DC_EVENT_MSG_FAILED = 2012;
    public static final int DC_EVENT_MSG_READ = 2015;
    public static final int DC_EVENT_REACTIONS_CHANGED = 2001;
    public static final int DC_EVENT_SECUREJOIN_INVITER_PROGRESS = 2060;
    public static final int DC_EVENT_SECUREJOIN_JOINER_PROGRESS = 2061;
    public static final int DC_EVENT_SELFAVATAR_CHANGED = 2110;
    public static final int DC_EVENT_WARNING = 300;
    public static final int DC_EVENT_WEBXDC_INSTANCE_DELETED = 2121;
    public static final int DC_EVENT_WEBXDC_REALTIME_DATA = 2150;
    public static final int DC_EVENT_WEBXDC_STATUS_UPDATE = 2120;
    public static final int DC_GCL_ADD_ALLDONE_HINT = 4;
    public static final int DC_GCL_ADD_SELF = 2;
    public static final int DC_GCL_ARCHIVED_ONLY = 1;
    public static final int DC_GCL_FOR_FORWARDING = 8;
    public static final int DC_GCL_NO_SPECIALS = 2;
    public static final int DC_GCL_VERIFIED_ONLY = 1;
    public static final int DC_GCM_ADDDAYMARKER = 1;
    public static final int DC_IMEX_EXPORT_BACKUP = 11;
    public static final int DC_IMEX_EXPORT_SELF_KEYS = 1;
    public static final int DC_IMEX_IMPORT_BACKUP = 12;
    public static final int DC_IMEX_IMPORT_SELF_KEYS = 2;
    public static final int DC_LP_AUTH_NORMAL = 4;
    public static final int DC_LP_AUTH_OAUTH2 = 2;
    public static final int DC_MEDIA_QUALITY_BALANCED = 0;
    public static final int DC_MEDIA_QUALITY_WORSE = 1;
    public static final int DC_QR_ACCOUNT = 250;
    public static final int DC_QR_ADDR = 320;
    public static final int DC_QR_ASK_VERIFYCONTACT = 200;
    public static final int DC_QR_ASK_VERIFYGROUP = 202;
    public static final int DC_QR_BACKUP2 = 252;
    public static final int DC_QR_BACKUP_TOO_NEW = 255;
    public static final int DC_QR_ERROR = 400;
    public static final int DC_QR_FPR_MISMATCH = 220;
    public static final int DC_QR_FPR_OK = 210;
    public static final int DC_QR_FPR_WITHOUT_ADDR = 230;
    public static final int DC_QR_LOGIN = 520;
    public static final int DC_QR_PROXY = 271;
    public static final int DC_QR_REVIVE_VERIFYCONTACT = 510;
    public static final int DC_QR_REVIVE_VERIFYGROUP = 512;
    public static final int DC_QR_TEXT = 330;
    public static final int DC_QR_URL = 332;
    public static final int DC_QR_WEBRTC = 260;
    public static final int DC_QR_WITHDRAW_VERIFYCONTACT = 500;
    public static final int DC_QR_WITHDRAW_VERIFYGROUP = 502;
    public static final int DC_SHOW_EMAILS_ACCEPTED_CONTACTS = 1;
    public static final int DC_SHOW_EMAILS_ALL = 2;
    public static final int DC_SHOW_EMAILS_OFF = 0;
    public static final int DC_SOCKET_AUTO = 0;
    public static final int DC_SOCKET_PLAIN = 3;
    public static final int DC_SOCKET_SSL = 1;
    public static final int DC_SOCKET_STARTTLS = 2;
    private long contextCPtr;

    private native long checkQrCPtr(String str);

    private native long createContextCPtr(String str, String str2);

    private native long getChatCPtr(int i);

    private native long getChatlistCPtr(int i, String str, int i2);

    private native long getContactCPtr(int i);

    private native long getDraftCPtr(int i);

    private native long getEventEmitterCPtr();

    private native long getMsgCPtr(int i);

    private native long getProviderFromEmailWithDnsCPtr(String str);

    private native long newBackupProviderCPtr();

    private native void unrefContextCPtr();

    public native void acceptChat(int i);

    public native int addAddressBook(String str);

    public native int addContactToChat(int i, int i2);

    public native int addDeviceMsg(String str, DcMsg dcMsg);

    public native void blockChat(int i);

    public native void blockContact(int i, int i2);

    public native int createBroadcastList();

    public native int createChatByContactId(int i);

    public native int createContact(String str, String str2);

    public native int createGroupChat(boolean z, String str);

    public native long createMsgCPtr(int i);

    public native String createQrSvg(String str);

    public native void deleteChat(int i);

    public native boolean deleteContact(int i);

    public native void deleteMsgs(int[] iArr);

    public native void downloadFullMsg(int i);

    public native int estimateDeletionCount(boolean z, long j);

    public native void forwardMsgs(int[] iArr, int i);

    public native int getAccountId();

    public native String getBlobdir();

    public native int[] getBlockedContacts();

    public native int[] getChatContacts(int i);

    public native String getChatEncrInfo(int i);

    public native int getChatEphemeralTimer(int i);

    public native int getChatIdByContactId(int i);

    public native int[] getChatMedia(int i, int i2, int i3, int i4);

    public native int[] getChatMsgs(int i, int i2, int i3);

    public native String getConfig(String str);

    public native int getConnectivity();

    public native String getConnectivityHtml();

    public native String getContactEncrInfo(int i);

    public native int[] getContacts(int i, String str);

    public native int getFreshMsgCount(int i);

    public native int[] getFreshMsgs();

    public native String getInfo();

    public native String getLastError();

    public native String getMsgHtml(int i);

    public native String getMsgInfo(int i);

    public native String getOauth2Url(String str, String str2);

    public native String getSecurejoinQr(int i);

    public native String getSecurejoinQrSvg(int i);

    public native String getWebxdcStatusUpdates(int i, int i2);

    public native void imex(int i, String str);

    public native String imexHasBackup(String str);

    public native int initWebxdcIntegration(int i);

    public native String initiateKeyTransfer();

    public native int isConfigured();

    public native boolean isContactInChat(int i, int i2);

    public native boolean isOpen();

    public native boolean isSendingLocationsToChat(int i);

    public native int joinSecurejoin(String str);

    public native int lookupContactIdByAddr(String str);

    public native void marknoticedChat(int i);

    public native void markseenMsgs(int[] iArr);

    public native boolean mayBeValidAddr(String str);

    public native void maybeNetwork();

    public native boolean open(String str);

    public native boolean receiveBackup(String str);

    public native int removeContactFromChat(int i, int i2);

    public native boolean resendMsgs(int[] iArr);

    public native void saveMsgs(int[] iArr);

    public native int[] searchMsgs(int i, String str);

    public native void sendDeleteRequest(int[] iArr);

    public native void sendEditRequest(int i, String str);

    public native void sendLocationsToChat(int i, int i2);

    public native int sendMsg(int i, DcMsg dcMsg);

    public native int sendTextMsg(int i, String str);

    public native int sendVideochatInvitation(int i);

    public native boolean sendWebxdcStatusUpdate(int i, String str);

    public native boolean setChatEphemeralTimer(int i, int i2);

    public native boolean setChatMuteDuration(int i, long j);

    public native int setChatName(int i, String str);

    public native int setChatProfileImage(int i, String str);

    public native void setChatVisibility(int i, int i2);

    public native void setConfig(String str, String str2);

    public native boolean setConfigFromQr(String str);

    public native void setDraft(int i, DcMsg dcMsg);

    public native boolean setLocation(float f, float f2, float f3);

    public native void setStockTranslation(int i, String str);

    public native void setWebxdcIntegration(String str);

    public native void startIo();

    public native void stopIo();

    public native void stopOngoingProcess();

    public native boolean wasDeviceMsgEverAdded(String str);

    public DcContext(String str, String str2) {
        this.contextCPtr = createContextCPtr(str, str2);
    }

    public DcContext(long j) {
        this.contextCPtr = j;
    }

    public boolean isOk() {
        return this.contextCPtr != 0;
    }

    protected void finalize() throws Throwable {
        super.finalize();
        if (this.contextCPtr != 0) {
            unrefContextCPtr();
            this.contextCPtr = 0L;
        }
    }

    public DcEventEmitter getEventEmitter() {
        return new DcEventEmitter(getEventEmitterCPtr());
    }

    public void setConfigInt(String str, int i) {
        setConfig(str, Integer.toString(i));
    }

    public int getConfigInt(String str) {
        try {
            return Integer.parseInt(getConfig(str));
        } catch (Exception unused) {
            return 0;
        }
    }

    public DcBackupProvider newBackupProvider() {
        return new DcBackupProvider(newBackupProviderCPtr());
    }

    public DcContact getContact(int i) {
        return new DcContact(getContactCPtr(i));
    }

    public DcChatlist getChatlist(int i, String str, int i2) {
        return new DcChatlist(getAccountId(), getChatlistCPtr(i, str, i2));
    }

    public DcChat getChat(int i) {
        return new DcChat(getAccountId(), getChatCPtr(i));
    }

    public DcMsg getDraft(int i) {
        return new DcMsg(getDraftCPtr(i));
    }

    public DcMsg getMsg(int i) {
        return new DcMsg(getMsgCPtr(i));
    }

    public DcLot checkQr(String str) {
        return new DcLot(checkQrCPtr(str));
    }

    public DcProvider getProviderFromEmailWithDns(String str) {
        long providerFromEmailWithDnsCPtr = getProviderFromEmailWithDnsCPtr(str);
        if (providerFromEmailWithDnsCPtr != 0) {
            return new DcProvider(providerFromEmailWithDnsCPtr);
        }
        return null;
    }

    public boolean isMentionsEnabled() {
        return getConfigInt(CONFIG_MUTE_MENTIONS_IF_MUTED) != 1;
    }

    public void setMentionsEnabled(boolean z) {
        setConfigInt(CONFIG_MUTE_MENTIONS_IF_MUTED, !z ? 1 : 0);
    }

    public String getName() {
        String config = getConfig("displayname");
        return config.isEmpty() ? getConfig("addr") : config;
    }

    public boolean isChatmail() {
        return getConfigInt("is_chatmail") == 1;
    }

    public boolean isMuted() {
        return getConfigInt("is_muted") == 1;
    }

    public void setMuted(boolean z) {
        setConfigInt("is_muted", z ? 1 : 0);
    }

    public boolean isGmailOauth2Addr(String str) {
        return isGmailOauth2Url(getOauth2Url(str, "chat.delta:/foo"));
    }

    public boolean isGmailOauth2Url(String str) {
        return str.startsWith("https://accounts.google.com/");
    }

    public void restartIo() {
        stopIo();
        startIo();
    }
}