refactor MrMailbox to DcContext etc.

This commit is contained in:
B. Petersen
2018-08-18 14:43:22 +02:00
parent fba364ccba
commit 54aa11b964
14 changed files with 593 additions and 1042 deletions
+2 -2
View File
@@ -867,7 +867,7 @@ $(JNI_DIR)/messenger-backend/libs/sqlite
LOCAL_LDLIBS := -ljnigraphics -llog -lz -latomic
LOCAL_STATIC_LIBRARIES := etpan sasl2 sqlite crypto libiconv
# if you get "undefined reference" errors, the reason for this may be the _order_! Eg. libiconv as the first library does not work!
# "breakpad" was placed after "crypto", NativeLoader.cpp after mrwrapper.c
# "breakpad" was placed after "crypto", NativeLoader.cpp after dc_wrapper.c
LOCAL_CFLAGS := -w -Os -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
@@ -928,6 +928,6 @@ messenger-backend/src/dc_token.c \
messenger-backend/src/dc_tools.c \
messenger-backend/src/dc_uudecode.c \
messenger-backend/cmdline/cmdline.c \
mrwrapper.c
dc_wrapper.c
include $(BUILD_SHARED_LIBRARY)
File diff suppressed because it is too large Load Diff
-77
View File
@@ -1,77 +0,0 @@
/*******************************************************************************
*
* Delta Chat Android
* (C) 2013-2016 Nikolai Kudashov
* (C) 2017 Björn Petersen
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
******************************************************************************/
#include <stdio.h>
#include <string.h>
#include <jni.h>
#include <sys/types.h>
#include <inttypes.h>
#include <stdlib.h>
#include <openssl/aes.h>
#include <unistd.h>
#include "mrjnimain.h"
#include "image.h"
#include "gifvideo.h"
jint JNI_OnLoad(JavaVM *vm, void *reserved) { /* this function is called automatically by the JNI when the library gets loaded */
JNIEnv *env = 0;
srand(time(NULL));
__android_log_print(ANDROID_LOG_INFO, "DeltaChat", "JNI_OnLoad() ..."); /* please note, that __android_log_print() may not work (eg. on LG X Cam), however, we don't have an option here. */
if ((*vm)->GetEnv(vm, (void **) &env, JNI_VERSION_1_6) != JNI_OK) {
return -1;
}
/*if (imageOnJNILoad(vm, reserved, env) == -1) {
return -1;
}
if (gifvideoOnJNILoad(vm, env) == -1) {
return -1;
}*/
__android_log_print(ANDROID_LOG_INFO, "DeltaChat", "JNI_OnLoad() succeeded.");
return JNI_VERSION_1_6;
}
void JNI_OnUnload(JavaVM *vm, void *reserved) {
}
/*JNIEXPORT jstring Java_com_b44t_messenger_Utilities_readlink(JNIEnv *env, jclass class, jstring path) {
static char buf[1000];
char *fileName = (*env)->GetStringUTFChars(env, path, NULL);
int result = readlink(fileName, buf, 999);
jstring value = 0;
if (result != -1) {
buf[result] = '\0';
value = (*env)->NewStringUTF(env, buf);
}
(*env)->ReleaseStringUTFChars(env, path, fileName);
return value;
}
*/
-54
View File
@@ -1,54 +0,0 @@
/*******************************************************************************
*
* Delta Chat Android
* (C) 2013-2016 Nikolai Kudashov
* (C) 2017 Björn Petersen
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
******************************************************************************/
#ifndef __MRJNIMAIN_H__
#define __MRJNIMAIN_H__
#include <android/log.h>
#include <jni.h>
#define LOG_TAG "DeltaChat"
#ifndef LOG_DISABLED
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
#else
#define LOGI(...)
#define LOGD(...)
#define LOGE(...)
#define LOGV(...)
#endif
#ifndef max
#define max(x, y) ((x) > (y)) ? (x) : (y)
#endif
#ifndef min
#define min(x, y) ((x) < (y)) ? (x) : (y)
#endif
#endif /* __MRJNIMAIN_H__*/
@@ -17,37 +17,30 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
*******************************************************************************
*
* File: MrChat.java
* Purpose: Wrap around mrchat_t
*
******************************************************************************/
package com.b44t.messenger;
import android.text.TextUtils;
public class DcChat {
public class MrChat {
public final static int DC_CHAT_ID_DEADDROP = 1;
public final static int DC_CHAT_ID_STARRED = 5;
public final static int DC_CHAT_ID_ARCHIVED_LINK = 6;
public final static int DC_CHAT_ID_LAST_SPECIAL = 9;
public final static int MR_CHAT_ID_DEADDROP = 1;
public final static int MR_CHAT_ID_STARRED = 5;
public final static int MR_CHAT_ID_ARCHIVED_LINK = 6;
public final static int MR_CHAT_ID_LAST_SPECIAL = 9;
public MrChat(long hChat) {
public DcChat(long hChat) {
m_hChat = hChat;
}
@Override protected void finalize() throws Throwable {
super.finalize();
MrChatUnref(m_hChat);
DcChatUnref(m_hChat);
m_hChat = 0;
}
public native int getId();
public native int getId();
public native boolean isGroup();
public native int getArchived();
public native int getArchived();
public native String getName();
public native String getSubtitle();
@@ -58,30 +51,10 @@ public class MrChat {
public native String getDraft();
public native long getDraftTimestamp();
private long m_hChat; // must not be renamed as referenced by JNI under the name "m_hChat"
private native static void MrChatUnref (long hChat);
/* additional functions that are not 1:1 available in the backend
**********************************************************************************************/
// working with raw c-data
private long m_hChat; // must not be renamed as referenced by JNI
private native static void DcChatUnref(long hChat);
public long getCPtr() {
return m_hChat;
}
public String getNameNAddr()
{
// returns name of group chats or name+email-address for normal chats
String name = "ErrGrpNameNAddr";
if( isGroup() ) {
name = getName();
}
else {
int contacts[] = MrMailbox.getChatContacts(getId());
if( contacts.length==1 ) {
name = MrMailbox.getContact(contacts[0]).getNameNAddr();
}
}
return name;
}
}
+57
View File
@@ -0,0 +1,57 @@
/*******************************************************************************
*
* Delta Chat Android
* (C) 2017 Björn Petersen
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
******************************************************************************/
package com.b44t.messenger;
public class DcChatlist {
public DcChatlist(long hChatlist) {
m_hChatlist = hChatlist;
}
@Override protected void finalize() throws Throwable {
super.finalize();
DcChatlistUnref(m_hChatlist);
m_hChatlist = 0;
}
public native int getCnt();
public DcChat getChatByIndex(int index) {
return new DcChat(DcChatlistGetChatByIndex(m_hChatlist, index));
}
public DcMsg getMsgByIndex(int index) {
return new DcMsg(DcChatlistGetMsgByIndex(m_hChatlist, index));
}
public DcLot getSummaryByIndex(int index, DcChat chat) {
return new DcLot(DcChatlistGetSummaryByIndex(m_hChatlist, index, chat.getCPtr()));
}
// working with raw c-data
private long m_hChatlist; // must not be renamed as referenced by JNI
private native static void DcChatlistUnref(long hChatlist);
private native static long DcChatlistGetChatByIndex(long hChatlist, int index); // returns hChat which must be unref'd after usage
private native static long DcChatlistGetMsgByIndex(long hChatlist, int index); // returns hMsg which must be unref'd after usage
private native static long DcChatlistGetSummaryByIndex(long hChatlist, int index, long hChat);
}
@@ -17,30 +17,25 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
*******************************************************************************
*
* File: MrContact.java
* Purpose: Wrap around mrcontact_t
*
******************************************************************************/
package com.b44t.messenger;
public class MrContact {
public class DcContact {
public final static int MR_CONTACT_ID_SELF = 1;
public final static int MR_CONTACT_ID_DEVICE = 2;
public final static int MR_CONTACT_ID_LAST_SPECIAL = 9;
public final static int DC_CONTACT_ID_SELF = 1;
public final static int DC_CONTACT_ID_DEVICE = 2;
public final static int DC_CONTACT_ID_LAST_SPECIAL = 9;
public MrContact(long hContact) {
public DcContact(long hContact) {
m_hContact = hContact;
}
@Override protected void finalize() throws Throwable {
super.finalize();
MrContactUnref(m_hContact);
DcContactUnref(m_hContact);
m_hContact = 0;
}
@@ -52,6 +47,7 @@ public class MrContact {
public native boolean isBlocked();
public native boolean isVerified();
private long m_hContact;
private native static void MrContactUnref (long hContact);
// working with raw c-data
private long m_hContact; // must not be renamed as referenced by JNI
private native static void DcContactUnref(long hContact);
}
+227
View File
@@ -0,0 +1,227 @@
/*******************************************************************************
*
* Delta Chat Android
* (C) 2017 Björn Petersen
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
******************************************************************************/
package com.b44t.messenger;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class DcContext {
public final static int DC_EVENT_INFO = 100;
public final static int DC_EVENT_WARNING = 300;
public final static int DC_EVENT_ERROR = 400;
public final static int DC_EVENT_MSGS_CHANGED = 2000;
public final static int DC_EVENT_INCOMING_MSG = 2005;
public final static int DC_EVENT_MSG_DELIVERED = 2010;
public final static int DC_EVENT_MSG_FAILED = 2012;
public final static int DC_EVENT_MSG_READ = 2015;
public final static int DC_EVENT_CHAT_MODIFIED = 2020;
public final static int DC_EVENT_CONTACTS_CHANGED = 2030;
public final static int DC_EVENT_CONFIGURE_PROGRESS = 2041;
public final static int DC_EVENT_IMEX_PROGRESS = 2051;
public final static int DC_EVENT_IMEX_FILE_WRITTEN = 2052;
public final static int DC_EVENT_SECUREJOIN_INVITER_PROGRESS = 2060;
public final static int DC_EVENT_SECUREJOIN_JOINER_PROGRESS = 2061;
public final static int DC_EVENT_IS_OFFLINE = 2081;
public final static int DC_EVENT_GET_STRING = 2091;
public final static int DC_EVENT_GET_QUANTITIY_STRING = 2092;
public final static int DC_EVENT_HTTP_GET = 2100;
public final static int DC_IMEX_EXPORT_SELF_KEYS = 1;
public final static int DC_IMEX_IMPORT_SELF_KEYS = 2;
public final static int DC_IMEX_EXPORT_BACKUP = 11;
public final static int DC_IMEX_IMPORT_BACKUP = 12;
public final static int DC_GCL_VERIFIED_ONLY = 1;
public final static int DC_GCL_ADD_SELF = 2;
public final static int DC_GCL_ARCHIVED_ONLY = 0x01;
public final static int DC_GCL_NO_SPECIALS = 0x02;
public final static int DC_GCM_ADDDAYMARKER = 0x01;
public final static int DC_QR_ASK_VERIFYCONTACT = 200;
public final static int DC_QR_ASK_VERIFYGROUP = 202;
public final static int DC_QR_FPR_OK = 210;
public final static int DC_QR_FPR_MISMATCH = 220;
public final static int DC_QR_FPR_WITHOUT_ADDR = 230;
public final static int DC_QR_ADDR = 320;
public final static int DC_QR_TEXT = 330;
public final static int DC_QR_URL = 332;
public final static int DC_QR_ERROR = 400;
public static void init () {
m_hContext = DcContextNew();
}
public native static int open(String dbfile);
public native static void close();
public native static String getBlobdir();
public native static void configure();
public native static void stopOngoingProcess();
public native static int isConfigured();
public native static void performJobs();
public native static void fetch();
public native static void idle();
public native static void interruptIdle();
public native static void performSmtpJobs();
public native static void performSmtpIdle();
public native static void interruptSmtpIdle();
public native static void setConfig(String key, String value);
public native static void setConfigInt(String key, int value);
public native static String getConfig(String key, String def);
public native static int getConfigInt(String key, int def);
public native static String getInfo();
public native static String cmdline(String cmd);
public native static String initiateKeyTransfer();
public native static boolean continueKeyTransfer(int msg_id, String setup_code);
public native static void imex(int what, String dir);
public native static String imexHasBackup(String dir);
public native static int checkPassword(String pw);
public native static int[] getContacts(int flags, String query);
public native static int getBlockedCount();
public native static int[] getBlockedContacts();
public static DcContact getContact(int contact_id) { return new DcContact(DcContextGetContact(m_hContext, contact_id)); }
public native static int createContact(String name, String addr);
public native static void blockContact(int id, int block);
public native static String getContactEncrInfo(int contact_id);
public native static int deleteContact(int id);
public native static int addAddressBook(String adrbook);
public static DcChatlist getChatlist(int listflags, String query, int queryId) { return new DcChatlist(DcContextGetChatlist(m_hContext, listflags, query, queryId)); }
public static DcChat getChat(int chat_id) { return new DcChat(DcContextGetChat(m_hContext, chat_id)); }
public native static void markseenMsgs(int msg_ids[]);
public native static void marknoticedChat(int chat_id);
public native static void marknoticedContact(int contact_id);
public native static void archiveChat(int chat_id, int archive);
public native static int getChatIdByContactId(int contact_id);
public native static int createChatByContactId(int contact_id);
public native static int createChatByMsgId(int msg_id);
public native static int createGroupChat(boolean verified, String name);
public native static int isContactInChat(int chat_id, int contact_id);
public native static int addContactToChat(int chat_id, int contact_id);
public native static int removeContactFromChat(int chat_id, int contact_id);
public native static void setDraft(int chat_id, String draft/*NULL=delete*/);
public native static int setChatName(int chat_id, String name);
public native static int setChatProfileImage(int chat_id, String name);
public native static int[] getChatMsgs(int chat_id, int flags, int marker1before);
public native static int[] searchMsgs(int chat_id, String query);
public native static int[] getFreshMsgs();
public native static int[] getChatMedia(int chat_id, int msg_type, int or_msg_type);
public native static int getNextMedia(int msg_id, int dir);
public native static int[] getChatContacts(int chat_id);
public native static void deleteChat(int chat_id);
public static DcMsg getMsg(int msg_id) { return new DcMsg(DcContextGetMsg(m_hContext, msg_id)); }
public native static String getMsgInfo(int id);
public native static int getFreshMsgCount(int chat_id);
public native static void deleteMsgs(int msg_ids[]);
public native static void forwardMsgs(int msg_ids[], int chat_ids);
public native static int sendTextMsg(int chat_id, String text);
public native static int sendVcardMsg(int chat_id, int contact_id);
public native static int sendMediaMsg(int chat_id, int type, String file, String mime, int w, int h, int time_ms, String author, String trackname);
public native static int checkQrCPtr(String qr);
public static DcLot checkQr(String qr) { return new DcLot(checkQrCPtr(qr)); }
public native static String getSecurejoinQr(int chat_id);
public native static int joinSecurejoin(String qr);
// working with raw c-data
private static long m_hContext = 0; // must not be renamed as referenced by JNI
private native static long DcContextNew();
private native static long DcContextGetChatlist(long hContext, int listflags, String query, int queryId);
private native static long DcContextGetChat(long hContext, int chat_id);
private native static long DcContextGetMsg(long hMailbox, int id);
private native static long DcContextGetContact(long hContext, int id);
public native static String CPtr2String(long hString); // get strings eg. from data1 from the callback
public native static long String2CPtr(String str);
// event handling
public static final Object m_lastErrorLock = new Object();
public static int m_lastErrorCode = 0;
public static String m_lastErrorString = "";
public static boolean m_showNextErrorAsToast = true;
public static long DcCallback(final int event, final long data1, final long data2) // this function is called from within the C-wrapper
{
switch(event) {
case DC_EVENT_INFO:
Log.i("DeltaChat", CPtr2String(data2));
break;
case DC_EVENT_WARNING:
Log.w("DeltaChat", CPtr2String(data2));
break;
case DC_EVENT_ERROR:
Log.e("DeltaChat", CPtr2String(data2));
synchronized (m_lastErrorLock) {
m_lastErrorCode = (int)data1;
m_lastErrorString = CPtr2String(data2);
}
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
synchronized (m_lastErrorLock) {
if( m_showNextErrorAsToast ) {
if(ForegroundDetector.getInstance().isForeground()) {
AndroidUtilities.showHint(ApplicationLoader.applicationContext, m_lastErrorString);
}
}
m_showNextErrorAsToast = true;
}
}
});*/
return 0;
case DC_EVENT_HTTP_GET:
String httpContent = null;
try {
URL url = new URL(CPtr2String(data1));
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
urlConnection.setConnectTimeout(10*1000);
InputStream inputStream = new BufferedInputStream(urlConnection.getInputStream());
BufferedReader r = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
total.append(line).append('\n');
}
httpContent = total.toString();
} finally {
urlConnection.disconnect();
}
}
catch(Exception e) {
e.printStackTrace();
}
return String2CPtr(httpContent);
}
return 0;
}
}
@@ -17,40 +17,36 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
*******************************************************************************
*
* File: MrLot.java
* Purpose: Wrap around mrpoortext_t
*
******************************************************************************/
package com.b44t.messenger;
public class MrLot {
public class DcLot {
public final static int MR_TEXT1_DRAFT = 1;
public final static int MR_TEXT1_USERNAME = 2;
public final static int MR_TEXT1_SELF = 3;
public final static int DC_TEXT1_DRAFT = 1;
public final static int DC_TEXT1_USERNAME = 2;
public final static int DC_TEXT1_SELF = 3;
public MrLot(long hLot) {
public DcLot(long hLot) {
m_hLot = hLot;
}
@Override protected void finalize() throws Throwable {
super.finalize();
MrLotUnref(m_hLot);
DcLotUnref(m_hLot);
m_hLot = 0;
}
public native String getText1();
public native int getText1Meaning();
public native int getText1Meaning();
public native String getText2();
public native long getTimestamp();
public native int getState();
public native int getId();
public native long getTimestamp();
public native int getState();
public native int getId();
private long m_hLot;
private native static void MrLotUnref(long hLot);
// working with raw c-data
private long m_hLot; // must not be renamed as referenced by JNI
private native static void DcLotUnref(long hLot);
}
+92
View File
@@ -0,0 +1,92 @@
/*******************************************************************************
*
* Delta Chat Android
* (C) 2017 Björn Petersen
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
******************************************************************************/
package com.b44t.messenger;
public class DcMsg {
private static final String TAG = "DcMsg";
public final static int DC_MSG_UNDEFINED = 0;
public final static int DC_MSG_TEXT = 10;
public final static int DC_MSG_IMAGE = 20;
public final static int DC_MSG_GIF = 21;
public final static int DC_MSG_AUDIO = 40;
public final static int DC_MSG_VOICE = 41;
public final static int DC_MSG_VIDEO = 50;
public final static int DC_MSG_FILE = 60;
public final static int DC_STATE_UNDEFINED = 0;
public final static int DC_STATE_IN_FRESH = 10;
public final static int DC_STATE_IN_NOTICED = 13;
public final static int DC_STATE_OUT_PENDING = 20;
public final static int DC_STATE_OUT_ERROR = 24;
public final static int DC_STATE_OUT_DELIVERED = 26;
public final static int DC_STATE_OUT_MDN_RCVD = 28;
public final static int DC_MSG_ID_MARKER1 = 1;
public final static int DC_MSG_ID_DAYMARKER = 9;
public DcMsg(long hMsg) {
m_hMsg = hMsg;
}
@Override protected void finalize() throws Throwable {
super.finalize();
DcMsgUnref(m_hMsg);
m_hMsg = 0;
}
public native int getId();
public native String getText();
public native long getTimestamp();
public native int getType();
public native int getState();
public native int getChatId();
public native int getFromId();
public native int getWidth(int def);
public native int getHeight(int def);
public native int getDuration();
public native void lateFilingMediaSize(int width, int height, int duration);
public native int getBytes();
public DcLot getSummary(DcChat chat) { return new DcLot(getSummaryCPtr(chat.getCPtr())); }
private native long getSummaryCPtr(long hChat);
public native String getSummarytext(int approx_characters);
public native int showPadlock();
public DcLot getMediainfo() { return new DcLot(getMediainfoCPtr()); }
private native long getMediainfoCPtr();
public native String getFile();
public native String getFilemime();
public native String getFilename();
public native boolean isForwarded();
public native boolean isInfo();
public native boolean isSetupMessage();
public native String getSetupCodeBegin();
public native boolean isIncreation();
// working with raw c-data
private long m_hMsg; // must not be renamed as referenced by JNI
private native static void DcMsgUnref(long hMsg);
};
-64
View File
@@ -1,64 +0,0 @@
/*******************************************************************************
*
* Delta Chat Android
* (C) 2017 Björn Petersen
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
*******************************************************************************
*
* File: MrChatlist.java
* Purpose: Wrap around mrchatlist_t
*
******************************************************************************/
package com.b44t.messenger;
public class MrChatlist {
public MrChatlist(long hChatlist) {
m_hChatlist = hChatlist;
}
@Override protected void finalize() throws Throwable {
super.finalize();
MrChatlistUnref(m_hChatlist);
m_hChatlist = 0;
}
public int getCnt() {
return MrChatlistGetCnt(m_hChatlist);
}
public MrChat getChatByIndex(int index) {
return new MrChat(MrChatlistGetChatByIndex(m_hChatlist, index));
}
public MrMsg getMsgByIndex(int index) {
return new MrMsg(MrChatlistGetMsgByIndex(m_hChatlist, index));
}
public MrLot getSummaryByIndex(int index, MrChat chat) {
return new MrLot(MrChatlistGetSummaryByIndex(m_hChatlist, index, chat.getCPtr()));
}
private long m_hChatlist;
private native static void MrChatlistUnref (long hChatlist);
private native static int MrChatlistGetCnt (long hChatlist);
private native static long MrChatlistGetChatByIndex (long hChatlist, int index); // returns hChat which must be unref'd after usage
private native static long MrChatlistGetMsgByIndex (long hChatlist, int index); // returns hMsg which must be unref'd after usage
private native static long MrChatlistGetSummaryByIndex(long hChatlist, int index, long hChat);
}
-485
View File
@@ -1,485 +0,0 @@
/*******************************************************************************
*
* Delta Chat Android
* (C) 2017 Björn Petersen
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
*******************************************************************************
*
* File: MrMailbox.java
* Purpose: Wrap around mrmailbox_t
*
******************************************************************************/
package com.b44t.messenger;
import android.app.Activity;
import android.content.SharedPreferences;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class MrMailbox {
public static void init () {
m_hMailbox = MrMailboxNew();
}
public native static int open(String dbfile);
public native static void close();
public native static String getBlobdir();
public native static void configure();
public native static void stopOngoingProcess();
public native static int isConfigured();
public native static void performJobs();
public native static void fetch();
public native static void idle();
public native static void interruptIdle();
public native static void performSmtpJobs();
public native static void performSmtpIdle();
public native static void interruptSmtpIdle();
public native static void setConfig(String key, String value);
public native static void setConfigInt(String key, int value);
public native static String getConfig(String key, String def);
public native static int getConfigInt(String key, int def);
public native static String getInfo();
public native static String cmdline(String cmd);
public native static String initiateKeyTransfer();
public native static boolean continueKeyTransfer(int msg_id, String setup_code);
public final static int MR_IMEX_EXPORT_SELF_KEYS = 1;
public final static int MR_IMEX_IMPORT_SELF_KEYS = 2;
public final static int MR_IMEX_EXPORT_BACKUP = 11;
public final static int MR_IMEX_IMPORT_BACKUP = 12;
public native static void imex(int what, String dir);
public native static String imexHasBackup(String dir);
public native static int checkPassword(String pw);
private static long m_hMailbox = 0; // do not rename this, is used in C-part
private native static long MrMailboxNew(); // returns hMailbox which must be unref'd after usage (Names as mrmailbox_new don't work due to the additional underscore)
// contacts
public final static int MR_GCL_VERIFIED_ONLY = 1;
public final static int MR_GCL_ADD_SELF = 2;
public native static int[] getContacts(int flags, String query);
public native static int getBlockedCount();
public native static int[] getBlockedContacts();
public static MrContact getContact(int contact_id) {
return new MrContact(MrMailboxGetContact(m_hMailbox, contact_id));
}
public static int createContact(String name, String addr) {
return MrMailboxCreateContact(m_hMailbox, name, addr);
}
public static void blockContact(int id, int block) {
MrMailboxBlockContact(m_hMailbox, id, block);
}
public native static String getContactEncrInfo(int contact_id);
public static int deleteContact(int id) {
return MrMailboxDeleteContact(m_hMailbox, id);
}
public static int addAddressBook(String adrbook) {
return MrMailboxAddAddressBook(m_hMailbox, adrbook);
}
private native static long MrMailboxGetContact (long hMailbox, int id);// returns hContact which must be unref'd after usage
private native static int MrMailboxCreateContact (long hMailbox, String name, String addr);
private native static void MrMailboxBlockContact (long hMailbox, int id, int block);
private native static int MrMailboxDeleteContact (long hMailbox, int id); // returns 0 if the contact could not be deleted (eg. it is in use, maybe by deaddrop)
private native static int MrMailboxAddAddressBook (long hMailbox, String adrbook);
// chats
public final static int MR_GCL_ARCHIVED_ONLY = 0x01;
public final static int MR_GCL_NO_SPECIALS = 0x02;
public static MrChatlist getChatlist(int listflags, String query, int queryId) {
return new MrChatlist(MrMailboxGetChatlist(m_hMailbox, listflags, query, queryId));
}
public static MrChat getChat(int chat_id) {
return new MrChat(MrMailboxGetChat(m_hMailbox, chat_id));
}
public native static void markseenMsgs (int msg_ids[]);
public native static void marknoticedChat (int chat_id);
public native static void marknoticedContact (int contact_id);
public native static void archiveChat (int chat_id, int archive);
public native static int getChatIdByContactId (int contact_id);
public native static int createChatByContactId(int contact_id);
public native static int createChatByMsgId (int msg_id);
public native static int createGroupChat (boolean verified, String name);
public native static int isContactInChat (int chat_id, int contact_id);
public native static int addContactToChat (int chat_id, int contact_id);
public native static int removeContactFromChat (int chat_id, int contact_id);
public native static void setDraft (int chat_id, String draft/*NULL=delete*/);
public native static int setChatName (int chat_id, String name);
public native static int setChatProfileImage (int chat_id, String name);
public final static int MR_GCM_ADDDAYMARKER = 0x01;
public native static int[] getChatMsgs(int chat_id, int flags, int marker1before);
public native static int[] searchMsgs(int chat_id, String query);
public native static int[] getFreshMsgs();
public native static int[] getChatMedia(int chat_id, int msg_type, int or_msg_type);
public native static int getNextMedia(int msg_id, int dir);
public native static int[] getChatContacts(int chat_id);
public native static void deleteChat(int chat_id);
private native static long MrMailboxGetChatlist (long hMailbox, int listflags, String query, int queryId); // returns hChatlist which must be unref'd after usage
private native static long MrMailboxGetChat (long hMailbox, int chat_id); // return hChat which must be unref'd after usage
// msgs
public static MrMsg getMsg(int msg_id) {
return new MrMsg(MrMailboxGetMsg(m_hMailbox, msg_id));
}
public static String getMsgInfo(int id) {
return MrMailboxGetMsgInfo(m_hMailbox, id);
}
public static native int getFreshMsgCount(int chat_id);
public native static void deleteMsgs(int msg_ids[]);
public native static void forwardMsgs(int msg_ids[], int chat_ids);
public native static int sendTextMsg(int chat_id, String text);
public native static int sendVcardMsg(int chat_id, int contact_id);
public native static int sendMediaMsg(int chat_id, int type, String file, String mime, int w, int h, int time_ms, String author, String trackname);
private native static long MrMailboxGetMsg (long hMailbox, int id); // return hMsg which must be unref'd after usage
private native static String MrMailboxGetMsgInfo (long hMailbox, int id);
// out-of-band verification
public final static int MR_QR_ASK_VERIFYCONTACT = 200;
public final static int MR_QR_ASK_VERIFYGROUP = 202;
public final static int MR_QR_FPR_OK = 210;
public final static int MR_QR_FPR_MISMATCH = 220;
public final static int MR_QR_FPR_WITHOUT_ADDR = 230;
public final static int MR_QR_ADDR = 320;
public final static int MR_QR_TEXT = 330;
public final static int MR_QR_URL = 332;
public final static int MR_QR_ERROR = 400;
public native static int checkQrCPtr(String qr);
public static MrLot checkQr(String qr) { return new MrLot(checkQrCPtr(qr)); }
public native static String getSecurejoinQr(int chat_id);
public native static int joinSecurejoin(String qr);
// static
public native static String MrGetVersionStr ();
public native static String CPtr2String (long hString); // get strings eg. from data1 from the callback
public native static long String2CPtr (String str);
/* receive events
**********************************************************************************************/
public final static int MR_EVENT_INFO = 100;
public final static int MR_EVENT_WARNING = 300;
public final static int MR_EVENT_ERROR = 400; // INFO and WARNING are blocked in the mrwrapper.c
public final static int MR_EVENT_MSGS_CHANGED = 2000;
public final static int MR_EVENT_INCOMING_MSG = 2005;
public final static int MR_EVENT_MSG_DELIVERED = 2010;
public final static int DC_EVENT_MSG_FAILED = 2012;
public final static int MR_EVENT_MSG_READ = 2015;
public final static int MR_EVENT_CHAT_MODIFIED = 2020;
public final static int MR_EVENT_CONTACTS_CHANGED = 2030;
public final static int MR_EVENT_CONFIGURE_PROGRESS = 2041;
public final static int MR_EVENT_IMEX_PROGRESS = 2051;
public final static int MR_EVENT_IMEX_FILE_WRITTEN = 2052;
public final static int MR_EVENT_SECUREJOIN_INVITER_PROGRESS = 2060;
public final static int MR_EVENT_SECUREJOIN_JOINER_PROGRESS = 2061;
public final static int MR_EVENT_IS_OFFLINE = 2081;
public final static int MR_EVENT_GET_STRING = 2091;
public final static int MR_EVENT_GET_QUANTITIY_STRING = 2092;
public final static int MR_EVENT_HTTP_GET = 2100;
public static final Object m_lastErrorLock = new Object();
public static int m_lastErrorCode = 0;
public static String m_lastErrorString = "";
public static boolean m_showNextErrorAsToast = true;
public static long MrCallback(final int event, final long data1, final long data2) // this function is called from within the C-wrapper
{
switch(event) {
case MR_EVENT_CONFIGURE_PROGRESS:
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if( data1 == 0 || data1 == 1000 ) {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.configureEnded, (int)data1);
}
else {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.configureProgress, (int)data1);
}
}
});*/
return 0;
case MR_EVENT_IMEX_PROGRESS:
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if (data1==0 || data1==1000) {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.imexEnded, (int) data1);
}
else {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.imexProgress, (int) data1);
}
}
});*/
return 0;
case MR_EVENT_IMEX_FILE_WRITTEN: {
/*final String fileName = CPtr2String(data1);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.imexFileWritten, fileName);
}
});*/
}
return 0;
case MR_EVENT_SECUREJOIN_INVITER_PROGRESS:
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.secureJoinInviterProgress, (int)data1, (int)data2);
}
});*/
return 0;
case MR_EVENT_SECUREJOIN_JOINER_PROGRESS:
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.secureJoinJoinerProgress, (int)data1, (int)data2);
}
});*/
return 0;
case MR_EVENT_MSGS_CHANGED:
case MR_EVENT_INCOMING_MSG:
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload, event, (int)data1, (int)data2);
if( event == MR_EVENT_INCOMING_MSG ) {
NotificationsController.getInstance().processNewMessages((int)data1, (int)data2);
}
}
});*/
return 0;
case MR_EVENT_MSG_DELIVERED:
case MR_EVENT_MSG_READ:
case DC_EVENT_MSG_FAILED:
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.messagesSentOrRead, event, (int)data1, (int)data2);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
}
});*/
return 0;
case MR_EVENT_CONTACTS_CHANGED:
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.contactsDidLoaded, (int)data1);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.blockedUsersDidLoaded);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
}
});*/
return 0;
case MR_EVENT_CHAT_MODIFIED:
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces,
UPDATE_MASK_NAME|UPDATE_MASK_CHAT_NAME|
UPDATE_MASK_CHAT_MEMBERS|UPDATE_MASK_AVATAR);
}
});*/
return 0;
case MR_EVENT_INFO:
Log.i("DeltaChat", CPtr2String(data2));
break;
case MR_EVENT_WARNING:
Log.w("DeltaChat", CPtr2String(data2));
break;
case MR_EVENT_ERROR:
Log.e("DeltaChat", CPtr2String(data2));
synchronized (m_lastErrorLock) {
m_lastErrorCode = (int)data1;
m_lastErrorString = CPtr2String(data2);
}
/*AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
synchronized (m_lastErrorLock) {
if( m_showNextErrorAsToast ) {
if(ForegroundDetector.getInstance().isForeground()) {
AndroidUtilities.showHint(ApplicationLoader.applicationContext, m_lastErrorString);
}
}
m_showNextErrorAsToast = true;
}
}
});*/
return 0;
case MR_EVENT_GET_STRING:
/*String s;
switch( (int)data1 ) {
// the string-IDs are defined in the backend; as this is the only place where they're used, there is no benefit in creating an enum or sth. like that.
case 1: s = ApplicationLoader.applicationContext.getString(R.string.NoMessages); break;
case 2: s = ApplicationLoader.applicationContext.getString(R.string.FromSelf); break;
case 3: s = ApplicationLoader.applicationContext.getString(R.string.Draft); break;
case 7: s = ApplicationLoader.applicationContext.getString(R.string.AttachVoiceMessage); break;
case 8: s = ApplicationLoader.applicationContext.getString(R.string.Deaddrop); break;
case 9: s = ApplicationLoader.applicationContext.getString(R.string.AttachPhoto); break;
case 10: s = ApplicationLoader.applicationContext.getString(R.string.AttachVideo); break;
case 11: s = ApplicationLoader.applicationContext.getString(R.string.Audio); break;
case 12: s = ApplicationLoader.applicationContext.getString(R.string.AttachDocument); break;
case 13: s = ApplicationLoader.applicationContext.getString(R.string.DefaultStatusText); break;
case 14: s = ApplicationLoader.applicationContext.getString(R.string.MsgNewGroupDraft); break;
case 15: s = ApplicationLoader.applicationContext.getString(R.string.MsgGroupNameChanged); break;
case 16: s = ApplicationLoader.applicationContext.getString(R.string.MsgGroupImageChanged); break;
case 17: s = ApplicationLoader.applicationContext.getString(R.string.MsgMemberAddedToGroup); break;
case 18: s = ApplicationLoader.applicationContext.getString(R.string.MsgMemberRemovedFromToGroup); break;
case 19: s = ApplicationLoader.applicationContext.getString(R.string.MsgGroupLeft); break;
case 20: s = ApplicationLoader.applicationContext.getString(R.string.Error); break;
case 21: s = ApplicationLoader.applicationContext.getString(R.string.ErrSelfNotInGroup); break;
case 22: s = ApplicationLoader.applicationContext.getString(R.string.NoNetwork); break;
case 23: s = ApplicationLoader.applicationContext.getString(R.string.AttachGif); break;
case 24: s = ApplicationLoader.applicationContext.getString(R.string.EncryptedMessage); break;
case 25: s = ApplicationLoader.applicationContext.getString(R.string.EncrinfoE2EAvailable); break;
case 27: s = ApplicationLoader.applicationContext.getString(R.string.EncrinfoTransport); break;
case 28: s = ApplicationLoader.applicationContext.getString(R.string.EncrinfoNone); break;
case 29: s = ApplicationLoader.applicationContext.getString(R.string.CannotDecryptBody); break;
case 30: s = ApplicationLoader.applicationContext.getString(R.string.EncrinfoFingerprints); break;
case 31: s = ApplicationLoader.applicationContext.getString(R.string.ReadReceipt); break;
case 32: s = ApplicationLoader.applicationContext.getString(R.string.ReadReceiptMailBody); break;
case 33: s = ApplicationLoader.applicationContext.getString(R.string.MsgGroupImageDeleted); break;
case 34: s = ApplicationLoader.applicationContext.getString(R.string.E2EEncryptionPreferred); break;
case 40: s = ApplicationLoader.applicationContext.getString(R.string.ArchivedChats); break;
case 42: s = ApplicationLoader.applicationContext.getString(R.string.AutocryptSetupMessageSubject); break;
case 43: s = ApplicationLoader.applicationContext.getString(R.string.AutocryptSetupMessageGeneralBody); break;
case 50: s = ApplicationLoader.applicationContext.getString(R.string.SelfTalkSubtitle); break;
case 60: s = ApplicationLoader.applicationContext.getString(R.string.ErrCannotLogin); break;
case 61: s = "<c#808080>" + ApplicationLoader.applicationContext.getString(R.string.ErrSeverResponse) + "</c>"; break;
default: s = null; break;
}
return String2CPtr(s);
*/
return 0;
case MR_EVENT_GET_QUANTITIY_STRING:
/*String sp = "ErrQtyStrBadId";
switch( (int)data1 ) {
// the string-IDs are defined in the backend; as this is the only place where they're used, there is no benefit in creating an enum or sth. like that.
case 4: sp = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Members, (int)data2, (int)data2); break;
case 6: sp = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Contacts, (int)data2, (int)data2); break;
}
return String2CPtr(sp);
*/
return 0;
case MR_EVENT_IS_OFFLINE:
//return ApplicationLoader.isNetworkOnline()? 0 : 1;
return 0;
case MR_EVENT_HTTP_GET:
String httpContent = null;
try {
URL url = new URL(CPtr2String(data1));
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
urlConnection.setConnectTimeout(10*1000);
InputStream inputStream = new BufferedInputStream(urlConnection.getInputStream());
BufferedReader r = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
total.append(line).append('\n');
}
httpContent = total.toString();
} finally {
urlConnection.disconnect();
}
}
catch(Exception e) {
e.printStackTrace();
}
return String2CPtr(httpContent);
}
return 0;
}
/* additional functions that are not 1:1 available in the backend
**********************************************************************************************/
public static void log_i(String tag, String msg)
{
Log.i(tag, msg);
}
public native static int getCurrentTime ();
}
-102
View File
@@ -1,102 +0,0 @@
/*******************************************************************************
*
* Delta Chat Android
* (C) 2017 Björn Petersen
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
*******************************************************************************
*
* File: MrMsg.java
* Purpose: Wrap around mrmsg_t
*
******************************************************************************/
package com.b44t.messenger;
import android.graphics.Bitmap;
import android.media.ThumbnailUtils;
import android.provider.MediaStore;
import java.io.File;
public class MrMsg {
private static final String TAG = "MrMsg";
public final static int MR_MSG_UNDEFINED = 0;
public final static int MR_MSG_TEXT = 10;
public final static int MR_MSG_IMAGE = 20;
public final static int MR_MSG_GIF = 21;
public final static int MR_MSG_AUDIO = 40;
public final static int MR_MSG_VOICE = 41;
public final static int MR_MSG_VIDEO = 50;
public final static int MR_MSG_FILE = 60;
public final static int MR_STATE_UNDEFINED = 0;
public final static int MR_IN_FRESH = 10;
public final static int MR_IN_NOTICED = 13;
public final static int MR_OUT_PENDING = 20;
public final static int MR_OUT_ERROR = 24;
public final static int MR_OUT_DELIVERED = 26;
public final static int MR_OUT_MDN_RCVD = 28;
public final static int MR_MSG_ID_MARKER1 = 1;
public final static int MR_MSG_ID_DAYMARKER = 9;
public MrMsg(long hMsg) {
m_hMsg = hMsg;
}
@Override protected void finalize() throws Throwable {
super.finalize();
MrMsgUnref(m_hMsg);
m_hMsg = 0;
}
public native int getId();
public native String getText();
public native long getTimestamp();
public native int getType();
public native int getState();
public native int getChatId();
public native int getFromId();
public native int getWidth(int def);
public native int getHeight(int def);
public native int getDuration();
public native void lateFilingMediaSize(int width, int height, int duration);
public native int getBytes();
public MrLot getSummary(MrChat chat) { return new MrLot(getSummaryCPtr(chat.getCPtr())); }
private native long getSummaryCPtr(long hChat);
public native String getSummarytext(int approx_characters);
public native int showPadlock();
public MrLot getMediainfo() { return new MrLot(getMediainfoCPtr()); }
private native long getMediainfoCPtr();
public native String getFile();
public native String getFilemime();
public native String getFilename();
public native boolean isForwarded();
public native boolean isInfo();
public native boolean isSetupMessage();
public native String getSetupCodeBegin();
public native boolean isIncreation();
private long m_hMsg; // must not be renamed as referenced by JNI under the name "m_hMsg"
private native static void MrMsgUnref (long hMsg);
};
@@ -27,7 +27,7 @@ import android.support.annotation.NonNull;
import android.support.multidex.MultiDexApplication;
import android.util.Log;
import com.b44t.messenger.MrMailbox;
import com.b44t.messenger.DcContext;
import com.google.android.gms.security.ProviderInstaller;
import org.thoughtcrime.securesms.crypto.PRNGFixes;
@@ -91,8 +91,8 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
super.onCreate();
System.loadLibrary("native-utils");
MrMailbox.MrCallback(0, 0, 0); // do not remove this call; this makes sure, the function is not removed from build or warnings are printed!
MrMailbox.init();
DcContext.DcCallback(0, 0, 0); // do not remove this call; this makes sure, the function is not removed from build or warnings are printed!
DcContext.init();
initializeRandomNumberFix();
initializeLogging();