4 - Add core and initial bindings

This commit is contained in:
daniel.boehrs 2018-08-16 11:04:42 +02:00
parent b1a00a03d2
commit 02cca46f6c
20 changed files with 775080 additions and 8 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "jni/messenger-backend"]
path = jni/messenger-backend
url = https://github.com/deltachat/deltachat-core

View file

@ -1,11 +1,935 @@
JNI_DIR := $(call my-dir) JNI_DIR := $(call my-dir)
LOCAL_PATH := $(call my-dir)
################################################################################
# openssl - libcrypto
################################################################################
include $(CLEAR_VARS)
CRYPTO_PATH:= ./openssl/crypto
arm_cflags := -DOPENSSL_BN_ASM_MONT -DAES_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
local_src_files := \
./openssl/crypto/cryptlib.c \
./openssl/crypto/mem.c \
./openssl/crypto/mem_clr.c \
./openssl/crypto/mem_dbg.c \
./openssl/crypto/cversion.c \
./openssl/crypto/ex_data.c \
./openssl/crypto/cpt_err.c \
./openssl/crypto/ebcdic.c \
./openssl/crypto/uid.c \
./openssl/crypto/o_time.c \
./openssl/crypto/o_str.c \
./openssl/crypto/o_dir.c \
./openssl/crypto/o_init.c \
./openssl/crypto/aes/aes_cbc.c \
./openssl/crypto/aes/aes_core.c \
./openssl/crypto/aes/aes_cfb.c \
./openssl/crypto/aes/aes_ctr.c \
./openssl/crypto/aes/aes_ecb.c \
./openssl/crypto/aes/aes_ige.c \
./openssl/crypto/aes/aes_misc.c \
./openssl/crypto/aes/aes_ofb.c \
./openssl/crypto/aes/aes_wrap.c \
./openssl/crypto/asn1/a_bitstr.c \
./openssl/crypto/asn1/a_bool.c \
./openssl/crypto/asn1/a_bytes.c \
./openssl/crypto/asn1/a_d2i_fp.c \
./openssl/crypto/asn1/a_digest.c \
./openssl/crypto/asn1/a_dup.c \
./openssl/crypto/asn1/a_enum.c \
./openssl/crypto/asn1/a_gentm.c \
./openssl/crypto/asn1/a_i2d_fp.c \
./openssl/crypto/asn1/a_int.c \
./openssl/crypto/asn1/a_mbstr.c \
./openssl/crypto/asn1/a_object.c \
./openssl/crypto/asn1/a_octet.c \
./openssl/crypto/asn1/a_print.c \
./openssl/crypto/asn1/a_set.c \
./openssl/crypto/asn1/a_sign.c \
./openssl/crypto/asn1/a_strex.c \
./openssl/crypto/asn1/a_strnid.c \
./openssl/crypto/asn1/a_time.c \
./openssl/crypto/asn1/a_type.c \
./openssl/crypto/asn1/a_utctm.c \
./openssl/crypto/asn1/a_utf8.c \
./openssl/crypto/asn1/a_verify.c \
./openssl/crypto/asn1/ameth_lib.c \
./openssl/crypto/asn1/asn1_err.c \
./openssl/crypto/asn1/asn1_gen.c \
./openssl/crypto/asn1/asn1_lib.c \
./openssl/crypto/asn1/asn1_par.c \
./openssl/crypto/asn1/asn_mime.c \
./openssl/crypto/asn1/asn_moid.c \
./openssl/crypto/asn1/asn_pack.c \
./openssl/crypto/asn1/bio_asn1.c \
./openssl/crypto/asn1/bio_ndef.c \
./openssl/crypto/asn1/d2i_pr.c \
./openssl/crypto/asn1/d2i_pu.c \
./openssl/crypto/asn1/evp_asn1.c \
./openssl/crypto/asn1/f_enum.c \
./openssl/crypto/asn1/f_int.c \
./openssl/crypto/asn1/f_string.c \
./openssl/crypto/asn1/i2d_pr.c \
./openssl/crypto/asn1/i2d_pu.c \
./openssl/crypto/asn1/n_pkey.c \
./openssl/crypto/asn1/nsseq.c \
./openssl/crypto/asn1/p5_pbe.c \
./openssl/crypto/asn1/p5_pbev2.c \
./openssl/crypto/asn1/p8_pkey.c \
./openssl/crypto/asn1/t_bitst.c \
./openssl/crypto/asn1/t_crl.c \
./openssl/crypto/asn1/t_pkey.c \
./openssl/crypto/asn1/t_req.c \
./openssl/crypto/asn1/t_spki.c \
./openssl/crypto/asn1/t_x509.c \
./openssl/crypto/asn1/t_x509a.c \
./openssl/crypto/asn1/tasn_dec.c \
./openssl/crypto/asn1/tasn_enc.c \
./openssl/crypto/asn1/tasn_fre.c \
./openssl/crypto/asn1/tasn_new.c \
./openssl/crypto/asn1/tasn_prn.c \
./openssl/crypto/asn1/tasn_typ.c \
./openssl/crypto/asn1/tasn_utl.c \
./openssl/crypto/asn1/x_algor.c \
./openssl/crypto/asn1/x_attrib.c \
./openssl/crypto/asn1/x_bignum.c \
./openssl/crypto/asn1/x_crl.c \
./openssl/crypto/asn1/x_exten.c \
./openssl/crypto/asn1/x_info.c \
./openssl/crypto/asn1/x_long.c \
./openssl/crypto/asn1/x_name.c \
./openssl/crypto/asn1/x_nx509.c \
./openssl/crypto/asn1/x_pkey.c \
./openssl/crypto/asn1/x_pubkey.c \
./openssl/crypto/asn1/x_req.c \
./openssl/crypto/asn1/x_sig.c \
./openssl/crypto/asn1/x_spki.c \
./openssl/crypto/asn1/x_val.c \
./openssl/crypto/asn1/x_x509.c \
./openssl/crypto/asn1/x_x509a.c \
./openssl/crypto/bf/bf_cfb64.c \
./openssl/crypto/bf/bf_ecb.c \
./openssl/crypto/bf/bf_enc.c \
./openssl/crypto/bf/bf_ofb64.c \
./openssl/crypto/bf/bf_skey.c \
./openssl/crypto/bio/b_dump.c \
./openssl/crypto/bio/b_print.c \
./openssl/crypto/bio/b_sock.c \
./openssl/crypto/bio/bf_buff.c \
./openssl/crypto/bio/bf_nbio.c \
./openssl/crypto/bio/bf_null.c \
./openssl/crypto/bio/bio_cb.c \
./openssl/crypto/bio/bio_err.c \
./openssl/crypto/bio/bio_lib.c \
./openssl/crypto/bio/bss_acpt.c \
./openssl/crypto/bio/bss_bio.c \
./openssl/crypto/bio/bss_conn.c \
./openssl/crypto/bio/bss_dgram.c \
./openssl/crypto/bio/bss_fd.c \
./openssl/crypto/bio/bss_file.c \
./openssl/crypto/bio/bss_log.c \
./openssl/crypto/bio/bss_mem.c \
./openssl/crypto/bio/bss_null.c \
./openssl/crypto/bio/bss_sock.c \
./openssl/crypto/bn/bn_add.c \
./openssl/crypto/bn/bn_asm.c \
./openssl/crypto/bn/bn_blind.c \
./openssl/crypto/bn/bn_ctx.c \
./openssl/crypto/bn/bn_div.c \
./openssl/crypto/bn/bn_err.c \
./openssl/crypto/bn/bn_exp.c \
./openssl/crypto/bn/bn_exp2.c \
./openssl/crypto/bn/bn_gcd.c \
./openssl/crypto/bn/bn_gf2m.c \
./openssl/crypto/bn/bn_kron.c \
./openssl/crypto/bn/bn_lib.c \
./openssl/crypto/bn/bn_mod.c \
./openssl/crypto/bn/bn_mont.c \
./openssl/crypto/bn/bn_mpi.c \
./openssl/crypto/bn/bn_mul.c \
./openssl/crypto/bn/bn_nist.c \
./openssl/crypto/bn/bn_prime.c \
./openssl/crypto/bn/bn_print.c \
./openssl/crypto/bn/bn_rand.c \
./openssl/crypto/bn/bn_recp.c \
./openssl/crypto/bn/bn_shift.c \
./openssl/crypto/bn/bn_sqr.c \
./openssl/crypto/bn/bn_sqrt.c \
./openssl/crypto/bn/bn_word.c \
./openssl/crypto/buffer/buf_err.c \
./openssl/crypto/buffer/buf_str.c \
./openssl/crypto/buffer/buffer.c \
./openssl/crypto/camellia/camellia.c \
./openssl/crypto/camellia/cmll_cbc.c \
./openssl/crypto/camellia/cmll_cfb.c \
./openssl/crypto/camellia/cmll_ctr.c \
./openssl/crypto/camellia/cmll_ecb.c \
./openssl/crypto/camellia/cmll_misc.c \
./openssl/crypto/camellia/cmll_ofb.c \
./openssl/crypto/camellia/cmll_utl.c \
./openssl/crypto/cast/c_cfb64.c \
./openssl/crypto/cast/c_ecb.c \
./openssl/crypto/cast/c_enc.c \
./openssl/crypto/cast/c_ofb64.c \
./openssl/crypto/cast/c_skey.c \
./openssl/crypto/cmac/cm_ameth.c \
./openssl/crypto/cmac/cm_pmeth.c \
./openssl/crypto/cmac/cmac.c \
./openssl/crypto/comp/c_rle.c \
./openssl/crypto/comp/c_zlib.c \
./openssl/crypto/comp/comp_err.c \
./openssl/crypto/comp/comp_lib.c \
./openssl/crypto/conf/conf_api.c \
./openssl/crypto/conf/conf_def.c \
./openssl/crypto/conf/conf_err.c \
./openssl/crypto/conf/conf_lib.c \
./openssl/crypto/conf/conf_mall.c \
./openssl/crypto/conf/conf_mod.c \
./openssl/crypto/conf/conf_sap.c \
./openssl/crypto/des/cbc_cksm.c \
./openssl/crypto/des/cbc_enc.c \
./openssl/crypto/des/cfb64ede.c \
./openssl/crypto/des/cfb64enc.c \
./openssl/crypto/des/cfb_enc.c \
./openssl/crypto/des/des_enc.c \
./openssl/crypto/des/des_old.c \
./openssl/crypto/des/des_old2.c \
./openssl/crypto/des/ecb3_enc.c \
./openssl/crypto/des/ecb_enc.c \
./openssl/crypto/des/ede_cbcm_enc.c \
./openssl/crypto/des/enc_read.c \
./openssl/crypto/des/enc_writ.c \
./openssl/crypto/des/fcrypt.c \
./openssl/crypto/des/fcrypt_b.c \
./openssl/crypto/des/ofb64ede.c \
./openssl/crypto/des/ofb64enc.c \
./openssl/crypto/des/ofb_enc.c \
./openssl/crypto/des/pcbc_enc.c \
./openssl/crypto/des/qud_cksm.c \
./openssl/crypto/des/rand_key.c \
./openssl/crypto/des/read2pwd.c \
./openssl/crypto/des/rpc_enc.c \
./openssl/crypto/des/set_key.c \
./openssl/crypto/des/str2key.c \
./openssl/crypto/des/xcbc_enc.c \
./openssl/crypto/dh/dh_ameth.c \
./openssl/crypto/dh/dh_asn1.c \
./openssl/crypto/dh/dh_check.c \
./openssl/crypto/dh/dh_depr.c \
./openssl/crypto/dh/dh_err.c \
./openssl/crypto/dh/dh_gen.c \
./openssl/crypto/dh/dh_key.c \
./openssl/crypto/dh/dh_lib.c \
./openssl/crypto/dh/dh_pmeth.c \
./openssl/crypto/dsa/dsa_ameth.c \
./openssl/crypto/dsa/dsa_asn1.c \
./openssl/crypto/dsa/dsa_depr.c \
./openssl/crypto/dsa/dsa_err.c \
./openssl/crypto/dsa/dsa_gen.c \
./openssl/crypto/dsa/dsa_key.c \
./openssl/crypto/dsa/dsa_lib.c \
./openssl/crypto/dsa/dsa_ossl.c \
./openssl/crypto/dsa/dsa_pmeth.c \
./openssl/crypto/dsa/dsa_prn.c \
./openssl/crypto/dsa/dsa_sign.c \
./openssl/crypto/dsa/dsa_vrf.c \
./openssl/crypto/dso/dso_dl.c \
./openssl/crypto/dso/dso_dlfcn.c \
./openssl/crypto/dso/dso_err.c \
./openssl/crypto/dso/dso_lib.c \
./openssl/crypto/dso/dso_null.c \
./openssl/crypto/dso/dso_openssl.c \
./openssl/crypto/dso/dso_vms.c \
./openssl/crypto/dso/dso_win32.c \
./openssl/crypto/ec/ec2_mult.c \
./openssl/crypto/ec/ec2_oct.c \
./openssl/crypto/ec/ec2_smpl.c \
./openssl/crypto/ec/ec_ameth.c \
./openssl/crypto/ec/ec_asn1.c \
./openssl/crypto/ec/ec_check.c \
./openssl/crypto/ec/ec_curve.c \
./openssl/crypto/ec/ec_cvt.c \
./openssl/crypto/ec/ec_err.c \
./openssl/crypto/ec/ec_key.c \
./openssl/crypto/ec/ec_lib.c \
./openssl/crypto/ec/ec_mult.c \
./openssl/crypto/ec/ec_oct.c \
./openssl/crypto/ec/ec_pmeth.c \
./openssl/crypto/ec/ec_print.c \
./openssl/crypto/ec/eck_prn.c \
./openssl/crypto/ec/ecp_mont.c \
./openssl/crypto/ec/ecp_nist.c \
./openssl/crypto/ec/ecp_nistp224.c \
./openssl/crypto/ec/ecp_nistp256.c \
./openssl/crypto/ec/ecp_nistp521.c \
./openssl/crypto/ec/ecp_nistputil.c \
./openssl/crypto/ec/ecp_oct.c \
./openssl/crypto/ec/ecp_smpl.c \
./openssl/crypto/ecdh/ech_err.c \
./openssl/crypto/ecdh/ech_key.c \
./openssl/crypto/ecdh/ech_lib.c \
./openssl/crypto/ecdh/ech_ossl.c \
./openssl/crypto/ecdsa/ecs_asn1.c \
./openssl/crypto/ecdsa/ecs_err.c \
./openssl/crypto/ecdsa/ecs_lib.c \
./openssl/crypto/ecdsa/ecs_ossl.c \
./openssl/crypto/ecdsa/ecs_sign.c \
./openssl/crypto/ecdsa/ecs_vrf.c \
./openssl/crypto/err/err.c \
./openssl/crypto/err/err_all.c \
./openssl/crypto/err/err_prn.c \
./openssl/crypto/evp/bio_b64.c \
./openssl/crypto/evp/bio_enc.c \
./openssl/crypto/evp/bio_md.c \
./openssl/crypto/evp/bio_ok.c \
./openssl/crypto/evp/c_all.c \
./openssl/crypto/evp/c_allc.c \
./openssl/crypto/evp/c_alld.c \
./openssl/crypto/evp/digest.c \
./openssl/crypto/evp/e_aes.c \
./openssl/crypto/evp/e_aes_cbc_hmac_sha1.c \
./openssl/crypto/evp/e_bf.c \
./openssl/crypto/evp/e_camellia.c \
./openssl/crypto/evp/e_cast.c \
./openssl/crypto/evp/e_des.c \
./openssl/crypto/evp/e_des3.c \
./openssl/crypto/evp/e_null.c \
./openssl/crypto/evp/e_old.c \
./openssl/crypto/evp/e_rc2.c \
./openssl/crypto/evp/e_rc4.c \
./openssl/crypto/evp/e_rc4_hmac_md5.c \
./openssl/crypto/evp/e_rc5.c \
./openssl/crypto/evp/e_xcbc_d.c \
./openssl/crypto/evp/encode.c \
./openssl/crypto/evp/evp_acnf.c \
./openssl/crypto/evp/evp_enc.c \
./openssl/crypto/evp/evp_err.c \
./openssl/crypto/evp/evp_key.c \
./openssl/crypto/evp/evp_lib.c \
./openssl/crypto/evp/evp_pbe.c \
./openssl/crypto/evp/evp_pkey.c \
./openssl/crypto/evp/m_dss.c \
./openssl/crypto/evp/m_dss1.c \
./openssl/crypto/evp/m_ecdsa.c \
./openssl/crypto/evp/m_md4.c \
./openssl/crypto/evp/m_md5.c \
./openssl/crypto/evp/m_mdc2.c \
./openssl/crypto/evp/m_null.c \
./openssl/crypto/evp/m_ripemd.c \
./openssl/crypto/evp/m_sha1.c \
./openssl/crypto/evp/m_sigver.c \
./openssl/crypto/evp/m_wp.c \
./openssl/crypto/evp/names.c \
./openssl/crypto/evp/p5_crpt.c \
./openssl/crypto/evp/p5_crpt2.c \
./openssl/crypto/evp/p_dec.c \
./openssl/crypto/evp/p_enc.c \
./openssl/crypto/evp/p_lib.c \
./openssl/crypto/evp/p_open.c \
./openssl/crypto/evp/p_seal.c \
./openssl/crypto/evp/p_sign.c \
./openssl/crypto/evp/p_verify.c \
./openssl/crypto/evp/pmeth_fn.c \
./openssl/crypto/evp/pmeth_gn.c \
./openssl/crypto/evp/pmeth_lib.c \
./openssl/crypto/hmac/hm_ameth.c \
./openssl/crypto/hmac/hm_pmeth.c \
./openssl/crypto/hmac/hmac.c \
./openssl/crypto/krb5/krb5_asn.c \
./openssl/crypto/lhash/lh_stats.c \
./openssl/crypto/lhash/lhash.c \
./openssl/crypto/md4/md4_dgst.c \
./openssl/crypto/md4/md4_one.c \
./openssl/crypto/md5/md5_dgst.c \
./openssl/crypto/md5/md5_one.c \
./openssl/crypto/modes/cbc128.c \
./openssl/crypto/modes/ccm128.c \
./openssl/crypto/modes/cfb128.c \
./openssl/crypto/modes/ctr128.c \
./openssl/crypto/modes/cts128.c \
./openssl/crypto/modes/gcm128.c \
./openssl/crypto/modes/ofb128.c \
./openssl/crypto/modes/xts128.c \
./openssl/crypto/objects/o_names.c \
./openssl/crypto/objects/obj_dat.c \
./openssl/crypto/objects/obj_err.c \
./openssl/crypto/objects/obj_lib.c \
./openssl/crypto/objects/obj_xref.c \
./openssl/crypto/ocsp/ocsp_asn.c \
./openssl/crypto/ocsp/ocsp_cl.c \
./openssl/crypto/ocsp/ocsp_err.c \
./openssl/crypto/ocsp/ocsp_ext.c \
./openssl/crypto/ocsp/ocsp_ht.c \
./openssl/crypto/ocsp/ocsp_lib.c \
./openssl/crypto/ocsp/ocsp_prn.c \
./openssl/crypto/ocsp/ocsp_srv.c \
./openssl/crypto/ocsp/ocsp_vfy.c \
./openssl/crypto/pem/pem_all.c \
./openssl/crypto/pem/pem_err.c \
./openssl/crypto/pem/pem_info.c \
./openssl/crypto/pem/pem_lib.c \
./openssl/crypto/pem/pem_oth.c \
./openssl/crypto/pem/pem_pk8.c \
./openssl/crypto/pem/pem_pkey.c \
./openssl/crypto/pem/pem_seal.c \
./openssl/crypto/pem/pem_sign.c \
./openssl/crypto/pem/pem_x509.c \
./openssl/crypto/pem/pem_xaux.c \
./openssl/crypto/pem/pvkfmt.c \
./openssl/crypto/pkcs12/p12_add.c \
./openssl/crypto/pkcs12/p12_asn.c \
./openssl/crypto/pkcs12/p12_attr.c \
./openssl/crypto/pkcs12/p12_crpt.c \
./openssl/crypto/pkcs12/p12_crt.c \
./openssl/crypto/pkcs12/p12_decr.c \
./openssl/crypto/pkcs12/p12_init.c \
./openssl/crypto/pkcs12/p12_key.c \
./openssl/crypto/pkcs12/p12_kiss.c \
./openssl/crypto/pkcs12/p12_mutl.c \
./openssl/crypto/pkcs12/p12_npas.c \
./openssl/crypto/pkcs12/p12_p8d.c \
./openssl/crypto/pkcs12/p12_p8e.c \
./openssl/crypto/pkcs12/p12_utl.c \
./openssl/crypto/pkcs12/pk12err.c \
./openssl/crypto/pkcs7/pk7_asn1.c \
./openssl/crypto/pkcs7/pk7_attr.c \
./openssl/crypto/pkcs7/pk7_doit.c \
./openssl/crypto/pkcs7/pk7_lib.c \
./openssl/crypto/pkcs7/pk7_mime.c \
./openssl/crypto/pkcs7/pk7_smime.c \
./openssl/crypto/pkcs7/pkcs7err.c \
./openssl/crypto/pqueue/pqueue.c \
./openssl/crypto/rand/md_rand.c \
./openssl/crypto/rand/rand_egd.c \
./openssl/crypto/rand/rand_err.c \
./openssl/crypto/rand/rand_lib.c \
./openssl/crypto/rand/rand_unix.c \
./openssl/crypto/rand/randfile.c \
./openssl/crypto/rc2/rc2_cbc.c \
./openssl/crypto/rc2/rc2_ecb.c \
./openssl/crypto/rc2/rc2_skey.c \
./openssl/crypto/rc2/rc2cfb64.c \
./openssl/crypto/rc2/rc2ofb64.c \
./openssl/crypto/rc4/rc4_enc.c \
./openssl/crypto/rc4/rc4_skey.c \
./openssl/crypto/rc4/rc4_utl.c \
./openssl/crypto/ripemd/rmd_dgst.c \
./openssl/crypto/ripemd/rmd_one.c \
./openssl/crypto/rsa/rsa_ameth.c \
./openssl/crypto/rsa/rsa_asn1.c \
./openssl/crypto/rsa/rsa_chk.c \
./openssl/crypto/rsa/rsa_crpt.c \
./openssl/crypto/rsa/rsa_depr.c \
./openssl/crypto/rsa/rsa_eay.c \
./openssl/crypto/rsa/rsa_err.c \
./openssl/crypto/rsa/rsa_gen.c \
./openssl/crypto/rsa/rsa_lib.c \
./openssl/crypto/rsa/rsa_none.c \
./openssl/crypto/rsa/rsa_null.c \
./openssl/crypto/rsa/rsa_oaep.c \
./openssl/crypto/rsa/rsa_pk1.c \
./openssl/crypto/rsa/rsa_pmeth.c \
./openssl/crypto/rsa/rsa_prn.c \
./openssl/crypto/rsa/rsa_pss.c \
./openssl/crypto/rsa/rsa_saos.c \
./openssl/crypto/rsa/rsa_sign.c \
./openssl/crypto/rsa/rsa_ssl.c \
./openssl/crypto/rsa/rsa_x931.c \
./openssl/crypto/sha/sha1_one.c \
./openssl/crypto/sha/sha1dgst.c \
./openssl/crypto/sha/sha256.c \
./openssl/crypto/sha/sha512.c \
./openssl/crypto/sha/sha_dgst.c \
./openssl/crypto/srp/srp_lib.c \
./openssl/crypto/srp/srp_vfy.c \
./openssl/crypto/stack/stack.c \
./openssl/crypto/ts/ts_err.c \
./openssl/crypto/txt_db/txt_db.c \
./openssl/crypto/ui/ui_compat.c \
./openssl/crypto/ui/ui_err.c \
./openssl/crypto/ui/ui_lib.c \
./openssl/crypto/ui/ui_openssl.c \
./openssl/crypto/ui/ui_util.c \
./openssl/crypto/x509/by_dir.c \
./openssl/crypto/x509/by_file.c \
./openssl/crypto/x509/x509_att.c \
./openssl/crypto/x509/x509_cmp.c \
./openssl/crypto/x509/x509_d2.c \
./openssl/crypto/x509/x509_def.c \
./openssl/crypto/x509/x509_err.c \
./openssl/crypto/x509/x509_ext.c \
./openssl/crypto/x509/x509_lu.c \
./openssl/crypto/x509/x509_obj.c \
./openssl/crypto/x509/x509_r2x.c \
./openssl/crypto/x509/x509_req.c \
./openssl/crypto/x509/x509_set.c \
./openssl/crypto/x509/x509_trs.c \
./openssl/crypto/x509/x509_txt.c \
./openssl/crypto/x509/x509_v3.c \
./openssl/crypto/x509/x509_vfy.c \
./openssl/crypto/x509/x509_vpm.c \
./openssl/crypto/x509/x509cset.c \
./openssl/crypto/x509/x509name.c \
./openssl/crypto/x509/x509rset.c \
./openssl/crypto/x509/x509spki.c \
./openssl/crypto/x509/x509type.c \
./openssl/crypto/x509/x_all.c \
./openssl/crypto/x509v3/pcy_cache.c \
./openssl/crypto/x509v3/pcy_data.c \
./openssl/crypto/x509v3/pcy_lib.c \
./openssl/crypto/x509v3/pcy_map.c \
./openssl/crypto/x509v3/pcy_node.c \
./openssl/crypto/x509v3/pcy_tree.c \
./openssl/crypto/x509v3/v3_akey.c \
./openssl/crypto/x509v3/v3_akeya.c \
./openssl/crypto/x509v3/v3_alt.c \
./openssl/crypto/x509v3/v3_bcons.c \
./openssl/crypto/x509v3/v3_bitst.c \
./openssl/crypto/x509v3/v3_conf.c \
./openssl/crypto/x509v3/v3_cpols.c \
./openssl/crypto/x509v3/v3_crld.c \
./openssl/crypto/x509v3/v3_enum.c \
./openssl/crypto/x509v3/v3_extku.c \
./openssl/crypto/x509v3/v3_genn.c \
./openssl/crypto/x509v3/v3_ia5.c \
./openssl/crypto/x509v3/v3_info.c \
./openssl/crypto/x509v3/v3_int.c \
./openssl/crypto/x509v3/v3_lib.c \
./openssl/crypto/x509v3/v3_ncons.c \
./openssl/crypto/x509v3/v3_ocsp.c \
./openssl/crypto/x509v3/v3_pci.c \
./openssl/crypto/x509v3/v3_pcia.c \
./openssl/crypto/x509v3/v3_pcons.c \
./openssl/crypto/x509v3/v3_pku.c \
./openssl/crypto/x509v3/v3_pmaps.c \
./openssl/crypto/x509v3/v3_prn.c \
./openssl/crypto/x509v3/v3_purp.c \
./openssl/crypto/x509v3/v3_skey.c \
./openssl/crypto/x509v3/v3_sxnet.c \
./openssl/crypto/x509v3/v3_utl.c \
./openssl/crypto/x509v3/v3err.c \
./openssl/ssl/bio_ssl.c \
./openssl/ssl/s2_meth.c \
./openssl/ssl/ssl_algs.c \
./openssl/ssl/kssl.c \
./openssl/ssl/s2_pkt.c \
./openssl/ssl/ssl_asn1.c \
./openssl/ssl/d1_both.c \
./openssl/ssl/s2_srvr.c \
./openssl/ssl/ssl_cert.c \
./openssl/ssl/ssl_txt.c \
./openssl/ssl/d1_clnt.c \
./openssl/ssl/s23_clnt.c \
./openssl/ssl/s3_both.c \
./openssl/ssl/ssl_ciph.c \
./openssl/ssl/ssl_utst.c \
./openssl/ssl/d1_enc.c \
./openssl/ssl/s23_lib.c \
./openssl/ssl/s3_cbc.c \
./openssl/ssl/ssl_err2.c \
./openssl/ssl/t1_clnt.c \
./openssl/ssl/d1_lib.c \
./openssl/ssl/s23_meth.c \
./openssl/ssl/s3_clnt.c \
./openssl/ssl/ssl_err.c \
./openssl/ssl/t1_enc.c \
./openssl/ssl/d1_meth.c \
./openssl/ssl/s23_pkt.c \
./openssl/ssl/s3_enc.c \
./openssl/ssl/ssl_lib.c \
./openssl/ssl/t1_lib.c \
./openssl/ssl/d1_pkt.c \
./openssl/ssl/s23_srvr.c \
./openssl/ssl/s3_lib.c \
./openssl/ssl/t1_meth.c \
./openssl/ssl/d1_srtp.c \
./openssl/ssl/s2_clnt.c \
./openssl/ssl/s3_meth.c \
./openssl/ssl/ssl_rsa.c \
./openssl/ssl/t1_reneg.c \
./openssl/ssl/d1_srvr.c \
./openssl/ssl/s2_enc.c \
./openssl/ssl/s3_pkt.c \
./openssl/ssl/ssl_sess.c \
./openssl/ssl/t1_srvr.c \
./openssl/ssl/s2_lib.c \
./openssl/ssl/s3_srvr.c \
./openssl/ssl/ssl_stat.c \
./openssl/ssl/tls_srp.c
local_c_includes := \
$(LOCAL_PATH)/openssl \
$(LOCAL_PATH)/openssl/crypto \
$(LOCAL_PATH)/openssl/crypto/asn1 \
$(LOCAL_PATH)/openssl/crypto/evp \
$(LOCAL_PATH)/openssl/crypto/modes \
$(LOCAL_PATH)/openssl/include \
$(LOCAL_PATH)/openssl/include/openssl
local_c_flags := -DNO_WINDOWS_BRAINDEATH
include $(LOCAL_PATH)/openssl/android-config.mk
LOCAL_SRC_FILES += $(local_src_files)
LOCAL_CFLAGS += $(local_c_flags) -DPURIFY
LOCAL_C_INCLUDES += $(local_c_includes)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE:= libcrypto
include $(BUILD_STATIC_LIBRARY)
#include $(CLEAR_VARS)
#LOCAL_MODULE := crypto
#
#ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
# LOCAL_SRC_FILES := ./openssl/obj/local/armeabi-v7a/libcrypto.a
#else
# ifeq ($(TARGET_ARCH_ABI),armeabi)
# LOCAL_SRC_FILES := ./openssl/obj/local/armeabi/libcrypto.a
# else
# ifeq ($(TARGET_ARCH_ABI),x86)
# LOCAL_SRC_FILES := ./openssl/obj/local/x86/libcrypto.a
# endif
# endif
#endif
#include $(PREBUILT_STATIC_LIBRARY)
################################################################################
# libiconv
################################################################################
# rough howto
# - run the normal ./configure to create iconv.h
# - copy the needed files
# - in localchatset.c, avoid including langinfo.h
include $(CLEAR_VARS)
LOCAL_MODULE := libiconv
LOCAL_CFLAGS := \
-Wno-multichar \
-D_ANDROID \
-DLIBDIR="\"c\"" \
-DBUILDING_LIBICONV \
-DIN_LIBRARY
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/libiconv/ \
$(LOCAL_PATH)/libiconv/include \
$(LOCAL_PATH)/libiconv/lib \
$(LOCAL_PATH)/libiconv/libcharset/include
LOCAL_SRC_FILES := \
./libiconv/lib/iconv.c \
./libiconv/lib/relocatable.c \
./libiconv/libcharset/lib/localcharset.c
include $(BUILD_STATIC_LIBRARY)
################################################################################
# libetpan
################################################################################
# rough howto:
# - copy files from original source
# - create include file links using "./autogen.sh; cd include; make" (or so)
# - use config.h from libetpan/build-android/include
# - use libetpan-config.h from local installation
include $(CLEAR_VARS)
LOCAL_MODULE := etpan
LOCAL_CFLAGS += -DHAVE_CONFIG_H=1 -DHAVE_ICONV=1
LOCAL_SRC_FILES := \
./messenger-backend/libs/libetpan/src/data-types/base64.c \
./messenger-backend/libs/libetpan/src/data-types/carray.c \
./messenger-backend/libs/libetpan/src/data-types/charconv.c \
./messenger-backend/libs/libetpan/src/data-types/chash.c \
./messenger-backend/libs/libetpan/src/data-types/clist.c \
./messenger-backend/libs/libetpan/src/data-types/connect.c \
./messenger-backend/libs/libetpan/src/data-types/mail_cache_db.c \
./messenger-backend/libs/libetpan/src/data-types/maillock.c \
./messenger-backend/libs/libetpan/src/data-types/mailsasl.c \
./messenger-backend/libs/libetpan/src/data-types/mailsem.c \
./messenger-backend/libs/libetpan/src/data-types/mailstream.c \
./messenger-backend/libs/libetpan/src/data-types/mailstream_cancel.c \
./messenger-backend/libs/libetpan/src/data-types/mailstream_cfstream.c \
./messenger-backend/libs/libetpan/src/data-types/mailstream_compress.c \
./messenger-backend/libs/libetpan/src/data-types/mailstream_helper.c \
./messenger-backend/libs/libetpan/src/data-types/mailstream_low.c \
./messenger-backend/libs/libetpan/src/data-types/mailstream_socket.c \
./messenger-backend/libs/libetpan/src/data-types/mailstream_ssl.c \
./messenger-backend/libs/libetpan/src/data-types/md5.c \
./messenger-backend/libs/libetpan/src/data-types/mmapstring.c \
./messenger-backend/libs/libetpan/src/data-types/timeutils.c \
./messenger-backend/libs/libetpan/src/low-level/imap/acl.c \
./messenger-backend/libs/libetpan/src/low-level/imap/acl_parser.c \
./messenger-backend/libs/libetpan/src/low-level/imap/acl_sender.c \
./messenger-backend/libs/libetpan/src/low-level/imap/acl_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/annotatemore.c \
./messenger-backend/libs/libetpan/src/low-level/imap/annotatemore_parser.c \
./messenger-backend/libs/libetpan/src/low-level/imap/annotatemore_sender.c \
./messenger-backend/libs/libetpan/src/low-level/imap/annotatemore_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/condstore.c \
./messenger-backend/libs/libetpan/src/low-level/imap/condstore_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/enable.c \
./messenger-backend/libs/libetpan/src/low-level/imap/idle.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_compress.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_extension.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_helper.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_id.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_id_parser.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_id_sender.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_id_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_keywords.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_oauth2.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_parser.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_print.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_sender.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_socket.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_sort.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_sort_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_ssl.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/mailimap_types_helper.c \
./messenger-backend/libs/libetpan/src/low-level/imap/namespace.c \
./messenger-backend/libs/libetpan/src/low-level/imap/namespace_parser.c \
./messenger-backend/libs/libetpan/src/low-level/imap/namespace_sender.c \
./messenger-backend/libs/libetpan/src/low-level/imap/namespace_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/qresync.c \
./messenger-backend/libs/libetpan/src/low-level/imap/qresync_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/quota.c \
./messenger-backend/libs/libetpan/src/low-level/imap/quota_parser.c \
./messenger-backend/libs/libetpan/src/low-level/imap/quota_sender.c \
./messenger-backend/libs/libetpan/src/low-level/imap/quota_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/uidplus.c \
./messenger-backend/libs/libetpan/src/low-level/imap/uidplus_parser.c \
./messenger-backend/libs/libetpan/src/low-level/imap/uidplus_sender.c \
./messenger-backend/libs/libetpan/src/low-level/imap/uidplus_types.c \
./messenger-backend/libs/libetpan/src/low-level/imap/xgmlabels.c \
./messenger-backend/libs/libetpan/src/low-level/imap/xgmmsgid.c \
./messenger-backend/libs/libetpan/src/low-level/imap/xgmthrid.c \
./messenger-backend/libs/libetpan/src/low-level/imap/xlist.c \
./messenger-backend/libs/libetpan/src/low-level/imf/mailimf.c \
./messenger-backend/libs/libetpan/src/low-level/imf/mailimf_types.c \
./messenger-backend/libs/libetpan/src/low-level/imf/mailimf_types_helper.c \
./messenger-backend/libs/libetpan/src/low-level/imf/mailimf_write_file.c \
./messenger-backend/libs/libetpan/src/low-level/imf/mailimf_write_generic.c \
./messenger-backend/libs/libetpan/src/low-level/imf/mailimf_write_mem.c \
./messenger-backend/libs/libetpan/src/low-level/mime/mailmime.c \
./messenger-backend/libs/libetpan/src/low-level/mime/mailmime_content.c \
./messenger-backend/libs/libetpan/src/low-level/mime/mailmime_decode.c \
./messenger-backend/libs/libetpan/src/low-level/mime/mailmime_disposition.c \
./messenger-backend/libs/libetpan/src/low-level/mime/mailmime_types.c \
./messenger-backend/libs/libetpan/src/low-level/mime/mailmime_types_helper.c \
./messenger-backend/libs/libetpan/src/low-level/mime/mailmime_write_file.c \
./messenger-backend/libs/libetpan/src/low-level/mime/mailmime_write_generic.c \
./messenger-backend/libs/libetpan/src/low-level/mime/mailmime_write_mem.c \
./messenger-backend/libs/libetpan/src/low-level/smtp/mailsmtp.c \
./messenger-backend/libs/libetpan/src/low-level/smtp/mailsmtp_helper.c \
./messenger-backend/libs/libetpan/src/low-level/smtp/mailsmtp_oauth2.c \
./messenger-backend/libs/libetpan/src/low-level/smtp/mailsmtp_socket.c \
./messenger-backend/libs/libetpan/src/low-level/smtp/mailsmtp_ssl.c \
./messenger-backend/libs/libetpan/src/main/libetpan_version.c \
./messenger-backend/libs/libetpan/src/driver/implementation/data-message/data_message_driver.c \
./messenger-backend/libs/libetpan/src/driver/implementation/mime-message/mime_message_driver.c \
./messenger-backend/libs/libetpan/src/driver/interface/maildriver.c \
./messenger-backend/libs/libetpan/src/driver/interface/maildriver_tools.c \
./messenger-backend/libs/libetpan/src/driver/interface/maildriver_types.c \
./messenger-backend/libs/libetpan/src/driver/interface/maildriver_types_helper.c \
./messenger-backend/libs/libetpan/src/driver/interface/mailfolder.c \
./messenger-backend/libs/libetpan/src/driver/interface/mailmessage.c \
./messenger-backend/libs/libetpan/src/driver/interface/mailmessage_tools.c \
./messenger-backend/libs/libetpan/src/driver/interface/mailmessage_types.c \
./messenger-backend/libs/libetpan/src/driver/interface/mailstorage.c \
./messenger-backend/libs/libetpan/src/driver/interface/mailstorage_tools.c \
./messenger-backend/libs/libetpan/src/engine/mailprivacy.c \
./messenger-backend/libs/libetpan/src/engine/mailprivacy_tools.c
LOCAL_C_INCLUDES = \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/data-types \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/low-level \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/low-level/imap \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/low-level/imf \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/low-level/mime \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/low-level/nntp \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/low-level/smtp \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/main \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/driver/implementation/data-message \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/src/driver/interface \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/include \
$(LOCAL_PATH)/messenger-backend/libs/libetpan/include/libetpan \
$(LOCAL_PATH)/openssl/include \
$(LOCAL_PATH)/libiconv/include \
$(LOCAL_PATH)/cyrussasl/include \
$(LOCAL_PATH)/cyrussasl/include/sasl
include $(BUILD_STATIC_LIBRARY)
################################################################################
# cyrus sasl
################################################################################
# rough howto:
# - copy files from original source
# - use config.h from libetpan/build-android/dependencies/cyrus-sasl/build-android/include
include $(CLEAR_VARS)
LOCAL_MODULE := sasl2
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/cyrussasl/include \
$(LOCAL_PATH)/cyrussasl/include/sasl \
$(LOCAL_PATH)/cyrussasl/plugins \
$(LOCAL_PATH)/openssl/include
LOCAL_SRC_FILES := \
./cyrussasl/lib/auxprop.c \
./cyrussasl/lib/canonusr.c \
./cyrussasl/lib/checkpw.c \
./cyrussasl/lib/client.c \
./cyrussasl/lib/common.c \
./cyrussasl/lib/config.c \
./cyrussasl/lib/dlopen.c \
./cyrussasl/lib/external.c \
./cyrussasl/lib/getsubopt.c \
./cyrussasl/lib/md5.c \
./cyrussasl/lib/saslutil.c \
./cyrussasl/lib/server.c \
./cyrussasl/lib/seterror.c \
./cyrussasl/lib/snprintf.c \
./cyrussasl/plugins/anonymous.c \
./cyrussasl/plugins/anonymous_init.c \
./cyrussasl/plugins/cram.c \
./cyrussasl/plugins/crammd5_init.c \
./cyrussasl/plugins/digestmd5.c \
./cyrussasl/plugins/digestmd5_init.c \
./cyrussasl/plugins/login.c \
./cyrussasl/plugins/login_init.c \
./cyrussasl/plugins/ntlm.c \
./cyrussasl/plugins/ntlm_init.c \
./cyrussasl/plugins/otp.c \
./cyrussasl/plugins/otp_init.c \
./cyrussasl/plugins/passdss.c \
./cyrussasl/plugins/passdss_init.c \
./cyrussasl/plugins/plain.c \
./cyrussasl/plugins/plain_init.c \
./cyrussasl/plugins/plugin_common.c \
./cyrussasl/plugins/scram.c \
./cyrussasl/plugins/scram_init.c \
./cyrussasl/plugins/srp.c \
./cyrussasl/plugins/srp_init.c
include $(BUILD_STATIC_LIBRARY)
################################################################################
# sqlite
################################################################################
include $(CLEAR_VARS)
ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_ARM_MODE := thumb
else
LOCAL_ARM_MODE := arm
endif
LOCAL_MODULE := sqlite
LOCAL_CFLAGS := -w -std=c11 -Os -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -DHAVE_STRCHRNUL=0
LOCAL_CFLAGS += -DSQLITE_OMIT_LOAD_EXTENSION
LOCAL_CFLAGS += -DSQLITE_MAX_MMAP_SIZE=0 -DSQLITE_OMIT_WAL # HACK: the defines are used to skip the pointer reference to mmap set in aSyscall[] - mmap seems to be a #define that cannot be used this way on Android - otherwise we get the error: 'mmap' undeclared here (not in a function)
LOCAL_SRC_FILES := \
./messenger-backend/libs/sqlite/sqlite3.c
include $(BUILD_STATIC_LIBRARY)
################################################################################
# main shared library as used from Java (includes the static ones)
################################################################################
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := native-utils LOCAL_MODULE := native-utils
LOCAL_C_INCLUDES := $(JNI_DIR)/utils/
LOCAL_CFLAGS += -Wall
LOCAL_SRC_FILES := $(JNI_DIR)/utils/org_thoughtcrime_securesms_util_FileUtils.cpp LOCAL_C_INCLUDES := $(JNI_DIR)/utils/ \
$(JNI_DIR)/openssl/include \
$(JNI_DIR)/messenger-backend/libs/libetpan/include \
$(JNI_DIR)/messenger-backend/libs/netpgp/include \
$(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
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
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math -D__STDC_CONSTANT_MACROS
LOCAL_SRC_FILES := \
utils/org_thoughtcrime_securesms_util_FileUtils.cpp \
messenger-backend/libs/netpgp/src/compress.c \
messenger-backend/libs/netpgp/src/create.c \
messenger-backend/libs/netpgp/src/crypto.c \
messenger-backend/libs/netpgp/src/keyring.c \
messenger-backend/libs/netpgp/src/misc.c \
messenger-backend/libs/netpgp/src/openssl_crypto.c \
messenger-backend/libs/netpgp/src/packet-parse.c \
messenger-backend/libs/netpgp/src/packet-show.c \
messenger-backend/libs/netpgp/src/reader.c \
messenger-backend/libs/netpgp/src/signature.c \
messenger-backend/libs/netpgp/src/symmetric.c \
messenger-backend/libs/netpgp/src/validate.c \
messenger-backend/libs/netpgp/src/writer.c \
messenger-backend/src/dc_aheader.c \
messenger-backend/src/dc_apeerstate.c \
messenger-backend/src/dc_array.c \
messenger-backend/src/dc_chat.c \
messenger-backend/src/dc_chatlist.c \
messenger-backend/src/dc_contact.c \
messenger-backend/src/dc_dehtml.c \
messenger-backend/src/dc_hash.c \
messenger-backend/src/dc_imap.c \
messenger-backend/src/dc_job.c \
messenger-backend/src/dc_key.c \
messenger-backend/src/dc_keyring.c \
messenger-backend/src/dc_loginparam.c \
messenger-backend/src/dc_lot.c \
messenger-backend/src/dc_context.c \
messenger-backend/src/dc_configure.c \
messenger-backend/src/dc_e2ee.c \
messenger-backend/src/dc_imex.c \
messenger-backend/src/dc_keyhistory.c \
messenger-backend/src/dc_log.c \
messenger-backend/src/dc_openssl.c \
messenger-backend/src/dc_qr.c \
messenger-backend/src/dc_receive_imf.c \
messenger-backend/src/dc_securejoin.c \
messenger-backend/src/dc_mimefactory.c \
messenger-backend/src/dc_mimeparser.c \
messenger-backend/src/dc_msg.c \
messenger-backend/src/dc_param.c \
messenger-backend/src/dc_pgp.c \
messenger-backend/src/dc_saxparser.c \
messenger-backend/src/dc_simplify.c \
messenger-backend/src/dc_smtp.c \
messenger-backend/src/dc_sqlite3.c \
messenger-backend/src/dc_stock.c \
messenger-backend/src/dc_strbuilder.c \
messenger-backend/src/dc_strencode.c \
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
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

1
jni/messenger-backend Submodule

@ -0,0 +1 @@
Subproject commit bbb5c3136ed5140aaed472bb44fc9791d1320fe9

77
jni/mrjnimain.c Normal file
View file

@ -0,0 +1,77 @@
/*******************************************************************************
*
* 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
jni/mrjnimain.h Normal file
View file

@ -0,0 +1,54 @@
/*******************************************************************************
*
* 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__*/

1299
jni/mrwrapper.c Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,907 @@
From e6d913938a67f8ef3174722a7ce38be8be92305f Mon Sep 17 00:00:00 2001
Message-Id: <e6d913938a67f8ef3174722a7ce38be8be92305f.1534410135.git.daniel.boehrs@open-xchange.com>
In-Reply-To: <371694c11a8b1192ef5230b98af3a5719add98ef.1534410134.git.daniel.boehrs@open-xchange.com>
References: <371694c11a8b1192ef5230b98af3a5719add98ef.1534410134.git.daniel.boehrs@open-xchange.com>
From: "B. Petersen" <r10s@b44t.com>
Date: Fri, 27 Jul 2018 17:12:43 +0200
Subject: [PATCH 5/6] add java-binding-classes
---
src/com/b44t/messenger/MrChat.java | 87 ++++++
src/com/b44t/messenger/MrChatlist.java | 64 +++++
src/com/b44t/messenger/MrContact.java | 57 ++++
src/com/b44t/messenger/MrLot.java | 56 ++++
src/com/b44t/messenger/MrMailbox.java | 485 +++++++++++++++++++++++++++++++++
src/com/b44t/messenger/MrMsg.java | 102 +++++++
6 files changed, 851 insertions(+)
diff --git a/src/com/b44t/messenger/MrChat.java b/src/com/b44t/messenger/MrChat.java
new file mode 100644
index 0000000..2165182
--- /dev/null
+++ b/src/com/b44t/messenger/MrChat.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ *
+ * 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: MrChat.java
+ * Purpose: Wrap around mrchat_t
+ *
+ ******************************************************************************/
+
+package com.b44t.messenger;
+
+import android.text.TextUtils;
+
+public class MrChat {
+
+ 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) {
+ m_hChat = hChat;
+ }
+
+ @Override protected void finalize() throws Throwable {
+ super.finalize();
+ MrChatUnref(m_hChat);
+ m_hChat = 0;
+ }
+
+ public native int getId();
+ public native boolean isGroup();
+ public native int getArchived();
+ public native String getName();
+ public native String getSubtitle();
+
+ public native String getProfileImage();
+ public native boolean isUnpromoted();
+ public native boolean isSelfTalk();
+ public native boolean isVerified();
+ 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
+ **********************************************************************************************/
+
+ 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;
+ }
+}
diff --git a/src/com/b44t/messenger/MrChatlist.java b/src/com/b44t/messenger/MrChatlist.java
new file mode 100644
index 0000000..c9194e7
--- /dev/null
+++ b/src/com/b44t/messenger/MrChatlist.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ *
+ * 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);
+}
diff --git a/src/com/b44t/messenger/MrContact.java b/src/com/b44t/messenger/MrContact.java
new file mode 100644
index 0000000..9ad568b
--- /dev/null
+++ b/src/com/b44t/messenger/MrContact.java
@@ -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/ .
+ *
+ *******************************************************************************
+ *
+ * File: MrContact.java
+ * Purpose: Wrap around mrcontact_t
+ *
+ ******************************************************************************/
+
+
+package com.b44t.messenger;
+
+
+public class MrContact {
+
+ 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 MrContact(long hContact) {
+ m_hContact = hContact;
+ }
+
+ @Override protected void finalize() throws Throwable {
+ super.finalize();
+ MrContactUnref(m_hContact);
+ m_hContact = 0;
+ }
+
+ public native String getName();
+ public native String getDisplayName();
+ public native String getFirstName();
+ public native String getAddr();
+ public native String getNameNAddr();
+ public native boolean isBlocked();
+ public native boolean isVerified();
+
+ private long m_hContact;
+ private native static void MrContactUnref (long hContact);
+}
diff --git a/src/com/b44t/messenger/MrLot.java b/src/com/b44t/messenger/MrLot.java
new file mode 100644
index 0000000..1e61f75
--- /dev/null
+++ b/src/com/b44t/messenger/MrLot.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ *
+ * 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: MrLot.java
+ * Purpose: Wrap around mrpoortext_t
+ *
+ ******************************************************************************/
+
+
+package com.b44t.messenger;
+
+
+public class MrLot {
+
+ 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 MrLot(long hLot) {
+ m_hLot = hLot;
+ }
+
+ @Override protected void finalize() throws Throwable {
+ super.finalize();
+ MrLotUnref(m_hLot);
+ m_hLot = 0;
+ }
+
+ public native String getText1();
+ public native int getText1Meaning();
+ public native String getText2();
+ public native long getTimestamp();
+ public native int getState();
+ public native int getId();
+
+ private long m_hLot;
+ private native static void MrLotUnref(long hLot);
+}
diff --git a/src/com/b44t/messenger/MrMailbox.java b/src/com/b44t/messenger/MrMailbox.java
new file mode 100644
index 0000000..be11d67
--- /dev/null
+++ b/src/com/b44t/messenger/MrMailbox.java
@@ -0,0 +1,485 @@
+/*******************************************************************************
+ *
+ * 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 ();
+
+
+
+
+}
diff --git a/src/com/b44t/messenger/MrMsg.java b/src/com/b44t/messenger/MrMsg.java
new file mode 100644
index 0000000..52a8ed2
--- /dev/null
+++ b/src/com/b44t/messenger/MrMsg.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ *
+ * 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);
+
+};
--
2.8.2

View file

@ -0,0 +1,56 @@
From 60d175313bdadedeb331923dde3b5c10bbf582ae Mon Sep 17 00:00:00 2001
Message-Id: <60d175313bdadedeb331923dde3b5c10bbf582ae.1534410135.git.daniel.boehrs@open-xchange.com>
In-Reply-To: <371694c11a8b1192ef5230b98af3a5719add98ef.1534410134.git.daniel.boehrs@open-xchange.com>
References: <371694c11a8b1192ef5230b98af3a5719add98ef.1534410134.git.daniel.boehrs@open-xchange.com>
From: "B. Petersen" <r10s@b44t.com>
Date: Fri, 27 Jul 2018 17:13:16 +0200
Subject: [PATCH 6/6] initialize the java-bindings, all functions should be
callable now :)
---
src/org/thoughtcrime/securesms/ApplicationContext.java | 6 ++++++
src/org/thoughtcrime/securesms/util/FileUtils.java | 4 ----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java
index f49cba5..fa22338 100644
--- a/src/org/thoughtcrime/securesms/ApplicationContext.java
+++ b/src/org/thoughtcrime/securesms/ApplicationContext.java
@@ -27,6 +27,7 @@ import android.support.annotation.NonNull;
import android.support.multidex.MultiDexApplication;
import android.util.Log;
+import com.b44t.messenger.MrMailbox;
import com.google.android.gms.security.ProviderInstaller;
import org.thoughtcrime.securesms.crypto.PRNGFixes;
@@ -88,6 +89,11 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
@Override
public void onCreate() {
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();
+
initializeRandomNumberFix();
initializeLogging();
initializeDependencyInjection();
diff --git a/src/org/thoughtcrime/securesms/util/FileUtils.java b/src/org/thoughtcrime/securesms/util/FileUtils.java
index e437edd..8927af6 100644
--- a/src/org/thoughtcrime/securesms/util/FileUtils.java
+++ b/src/org/thoughtcrime/securesms/util/FileUtils.java
@@ -9,10 +9,6 @@ import java.security.NoSuchAlgorithmException;
public class FileUtils {
- static {
- System.loadLibrary("native-utils");
- }
-
public static native int getFileDescriptorOwner(FileDescriptor fileDescriptor);
public static byte[] getFileDigest(FileInputStream fin) throws IOException {
--
2.8.2

View file

@ -0,0 +1,87 @@
/*******************************************************************************
*
* 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: MrChat.java
* Purpose: Wrap around mrchat_t
*
******************************************************************************/
package com.b44t.messenger;
import android.text.TextUtils;
public class MrChat {
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) {
m_hChat = hChat;
}
@Override protected void finalize() throws Throwable {
super.finalize();
MrChatUnref(m_hChat);
m_hChat = 0;
}
public native int getId();
public native boolean isGroup();
public native int getArchived();
public native String getName();
public native String getSubtitle();
public native String getProfileImage();
public native boolean isUnpromoted();
public native boolean isSelfTalk();
public native boolean isVerified();
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
**********************************************************************************************/
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;
}
}

View file

@ -0,0 +1,64 @@
/*******************************************************************************
*
* 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);
}

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/ .
*
*******************************************************************************
*
* File: MrContact.java
* Purpose: Wrap around mrcontact_t
*
******************************************************************************/
package com.b44t.messenger;
public class MrContact {
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 MrContact(long hContact) {
m_hContact = hContact;
}
@Override protected void finalize() throws Throwable {
super.finalize();
MrContactUnref(m_hContact);
m_hContact = 0;
}
public native String getName();
public native String getDisplayName();
public native String getFirstName();
public native String getAddr();
public native String getNameNAddr();
public native boolean isBlocked();
public native boolean isVerified();
private long m_hContact;
private native static void MrContactUnref (long hContact);
}

View file

@ -0,0 +1,56 @@
/*******************************************************************************
*
* 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: MrLot.java
* Purpose: Wrap around mrpoortext_t
*
******************************************************************************/
package com.b44t.messenger;
public class MrLot {
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 MrLot(long hLot) {
m_hLot = hLot;
}
@Override protected void finalize() throws Throwable {
super.finalize();
MrLotUnref(m_hLot);
m_hLot = 0;
}
public native String getText1();
public native int getText1Meaning();
public native String getText2();
public native long getTimestamp();
public native int getState();
public native int getId();
private long m_hLot;
private native static void MrLotUnref(long hLot);
}

View file

@ -0,0 +1,485 @@
/*******************************************************************************
*
* 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 ();
}

View file

@ -0,0 +1,102 @@
/*******************************************************************************
*
* 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);
};

View file

@ -27,6 +27,7 @@ import android.support.annotation.NonNull;
import android.support.multidex.MultiDexApplication; import android.support.multidex.MultiDexApplication;
import android.util.Log; import android.util.Log;
import com.b44t.messenger.MrMailbox;
import com.google.android.gms.security.ProviderInstaller; import com.google.android.gms.security.ProviderInstaller;
import org.thoughtcrime.securesms.crypto.PRNGFixes; import org.thoughtcrime.securesms.crypto.PRNGFixes;
@ -88,6 +89,11 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); 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();
initializeRandomNumberFix(); initializeRandomNumberFix();
initializeLogging(); initializeLogging();
initializeDependencyInjection(); initializeDependencyInjection();

View file

@ -9,10 +9,6 @@ import java.security.NoSuchAlgorithmException;
public class FileUtils { public class FileUtils {
static {
System.loadLibrary("native-utils");
}
public static native int getFileDescriptorOwner(FileDescriptor fileDescriptor); public static native int getFileDescriptorOwner(FileDescriptor fileDescriptor);
public static byte[] getFileDigest(FileInputStream fin) throws IOException { public static byte[] getFileDigest(FileInputStream fin) throws IOException {