mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 18:06:35 +03:00
reduce code duplication (round 1)
This commit is contained in:
@@ -4,578 +4,11 @@ use libc;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_imap::dc_imap_t;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_mimeparser::*;
|
||||
use crate::dc_sqlite3::dc_sqlite3_t;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
|
||||
extern "C" {
|
||||
pub type mailstream_cancel;
|
||||
pub type sqlite3;
|
||||
pub type sqlite3_stmt;
|
||||
#[no_mangle]
|
||||
fn usleep(_: useconds_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn free(_: *mut libc::c_void);
|
||||
#[no_mangle]
|
||||
fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn strlen(_: *const libc::c_char) -> libc::c_ulong;
|
||||
#[no_mangle]
|
||||
fn strncmp(_: *const libc::c_char, _: *const libc::c_char, _: libc::c_ulong) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn strcasecmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_mutex_lock(_: *mut pthread_mutex_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_mutex_unlock(_: *mut pthread_mutex_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_create_chat_by_contact_id(_: *mut dc_context_t, contact_id: uint32_t) -> uint32_t;
|
||||
#[no_mangle]
|
||||
fn dc_send_msg(_: *mut dc_context_t, chat_id: uint32_t, _: *mut dc_msg_t) -> uint32_t;
|
||||
#[no_mangle]
|
||||
fn dc_get_chat_contacts(_: *mut dc_context_t, chat_id: uint32_t) -> *mut dc_array_t;
|
||||
#[no_mangle]
|
||||
fn dc_get_chat(_: *mut dc_context_t, chat_id: uint32_t) -> *mut dc_chat_t;
|
||||
#[no_mangle]
|
||||
fn dc_get_contact(_: *mut dc_context_t, contact_id: uint32_t) -> *mut dc_contact_t;
|
||||
#[no_mangle]
|
||||
fn dc_stop_ongoing_process(_: *mut dc_context_t);
|
||||
// out-of-band verification
|
||||
// id=contact
|
||||
// text1=groupname
|
||||
// id=contact
|
||||
// id=contact
|
||||
// test1=formatted fingerprint
|
||||
// id=contact
|
||||
// text1=text
|
||||
// text1=URL
|
||||
// text1=error string
|
||||
#[no_mangle]
|
||||
fn dc_check_qr(_: *mut dc_context_t, qr: *const libc::c_char) -> *mut dc_lot_t;
|
||||
/* string tools */
|
||||
#[no_mangle]
|
||||
fn dc_strdup(_: *const libc::c_char) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_chat_unref(_: *mut dc_chat_t);
|
||||
#[no_mangle]
|
||||
fn dc_log_info(_: *mut dc_context_t, data1: libc::c_int, msg: *const libc::c_char, _: ...);
|
||||
#[no_mangle]
|
||||
fn dc_mprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_urlencode(_: *const libc::c_char) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_chat_get_name(_: *const dc_chat_t) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_log_error(_: *mut dc_context_t, data1: libc::c_int, msg: *const libc::c_char, _: ...);
|
||||
#[no_mangle]
|
||||
fn dc_key_new() -> *mut dc_key_t;
|
||||
#[no_mangle]
|
||||
fn dc_key_unref(_: *mut dc_key_t);
|
||||
#[no_mangle]
|
||||
fn dc_key_get_fingerprint(_: *const dc_key_t) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_key_load_self_public(
|
||||
_: *mut dc_key_t,
|
||||
self_addr: *const libc::c_char,
|
||||
sql: *mut dc_sqlite3_t,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_sqlite3_get_config(
|
||||
_: *mut dc_sqlite3_t,
|
||||
key: *const libc::c_char,
|
||||
def: *const libc::c_char,
|
||||
) -> *mut libc::c_char;
|
||||
// Functions to read/write token from/to the database. A token is any string associated with a key.
|
||||
#[no_mangle]
|
||||
fn dc_token_save(
|
||||
_: *mut dc_context_t,
|
||||
_: dc_tokennamespc_t,
|
||||
foreign_id: uint32_t,
|
||||
token: *const libc::c_char,
|
||||
);
|
||||
/* Message-ID tools */
|
||||
#[no_mangle]
|
||||
fn dc_create_id() -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_token_lookup(
|
||||
_: *mut dc_context_t,
|
||||
_: dc_tokennamespc_t,
|
||||
foreign_id: uint32_t,
|
||||
) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_ensure_secret_key_exists(_: *mut dc_context_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_free_ongoing(_: *mut dc_context_t);
|
||||
#[no_mangle]
|
||||
fn dc_lot_unref(_: *mut dc_lot_t);
|
||||
#[no_mangle]
|
||||
fn dc_get_chat_id_by_grpid(
|
||||
_: *mut dc_context_t,
|
||||
grpid: *const libc::c_char,
|
||||
ret_blocked: *mut libc::c_int,
|
||||
ret_verified: *mut libc::c_int,
|
||||
) -> uint32_t;
|
||||
#[no_mangle]
|
||||
fn dc_msg_new_untyped(_: *mut dc_context_t) -> *mut dc_msg_t;
|
||||
#[no_mangle]
|
||||
fn dc_msg_unref(_: *mut dc_msg_t);
|
||||
#[no_mangle]
|
||||
fn dc_param_set_int(_: *mut dc_param_t, key: libc::c_int, value: int32_t);
|
||||
#[no_mangle]
|
||||
fn dc_param_set(_: *mut dc_param_t, key: libc::c_int, value: *const libc::c_char);
|
||||
/* *
|
||||
* @class dc_array_t
|
||||
*
|
||||
* An object containing a simple array.
|
||||
* This object is used in several places where functions need to return an array.
|
||||
* The items of the array are typically IDs.
|
||||
* To free an array object, use dc_array_unref().
|
||||
*/
|
||||
#[no_mangle]
|
||||
fn dc_array_unref(_: *mut dc_array_t);
|
||||
#[no_mangle]
|
||||
fn dc_array_get_id(_: *const dc_array_t, index: size_t) -> uint32_t;
|
||||
#[no_mangle]
|
||||
fn dc_array_get_cnt(_: *const dc_array_t) -> size_t;
|
||||
/* *
|
||||
* @class dc_contact_t
|
||||
*
|
||||
* An object representing a single contact in memory.
|
||||
* The contact object is not updated.
|
||||
* If you want an update, you have to recreate the object.
|
||||
*
|
||||
* The library makes sure
|
||||
* only to use names _authorized_ by the contact in `To:` or `Cc:`.
|
||||
* _Given-names _as "Daddy" or "Honey" are not used there.
|
||||
* For this purpose, internally, two names are tracked -
|
||||
* authorized-name and given-name.
|
||||
* By default, these names are equal,
|
||||
* but functions working with contact names
|
||||
* (eg. dc_contact_get_name(), dc_contact_get_display_name(),
|
||||
* dc_contact_get_name_n_addr(), dc_contact_get_first_name(),
|
||||
* dc_create_contact() or dc_add_address_book())
|
||||
* only affect the given-name.
|
||||
*/
|
||||
#[no_mangle]
|
||||
fn dc_contact_new(_: *mut dc_context_t) -> *mut dc_contact_t;
|
||||
#[no_mangle]
|
||||
fn dc_contact_unref(_: *mut dc_contact_t);
|
||||
#[no_mangle]
|
||||
fn dc_apeerstate_new(_: *mut dc_context_t) -> *mut dc_apeerstate_t;
|
||||
#[no_mangle]
|
||||
fn dc_normalize_fingerprint(_: *const libc::c_char) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_apeerstate_load_by_addr(
|
||||
_: *mut dc_apeerstate_t,
|
||||
_: *mut dc_sqlite3_t,
|
||||
addr: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
/* From: of incoming messages of unknown sender */
|
||||
/* Cc: of incoming messages of unknown sender */
|
||||
/* To: of incoming messages of unknown sender */
|
||||
/* address scanned but not verified */
|
||||
/* Reply-To: of incoming message of known sender */
|
||||
/* Cc: of incoming message of known sender */
|
||||
/* additional To:'s of incoming message of known sender */
|
||||
/* a chat was manually created for this user, but no message yet sent */
|
||||
/* message sent by us */
|
||||
/* message sent by us */
|
||||
/* message sent by us */
|
||||
/* internal use */
|
||||
/* address is in our address book */
|
||||
/* set on Alice's side for contacts like Bob that have scanned the QR code offered by her. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verified() ! */
|
||||
/* set on Bob's side for contacts scanned and verified from a QR code. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verified() ! */
|
||||
/* contact added mannually by dc_create_contact(), this should be the largets origin as otherwise the user cannot modify the names */
|
||||
/* contacts with at least this origin value are shown in the contact list */
|
||||
/* contacts with at least this origin value are verified and known not to be spam */
|
||||
/* contacts with at least this origin value start a new "normal" chat, defaults to off */
|
||||
#[no_mangle]
|
||||
fn dc_contact_load_from_db(
|
||||
_: *mut dc_contact_t,
|
||||
_: *mut dc_sqlite3_t,
|
||||
contact_id: uint32_t,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_alloc_ongoing(_: *mut dc_context_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_contact_is_verified(_: *mut dc_contact_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn sqlite3_bind_text(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: *const libc::c_char,
|
||||
_: libc::c_int,
|
||||
_: Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn sqlite3_step(_: *mut sqlite3_stmt) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn sqlite3_column_int(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn sqlite3_finalize(pStmt: *mut sqlite3_stmt) -> libc::c_int;
|
||||
/* tools, these functions are compatible to the corresponding sqlite3_* functions */
|
||||
#[no_mangle]
|
||||
fn dc_sqlite3_prepare(_: *mut dc_sqlite3_t, sql: *const libc::c_char) -> *mut sqlite3_stmt;
|
||||
/* Replaces the first `%1$s` in the given String-ID by the given value.
|
||||
The result must be free()'d! */
|
||||
#[no_mangle]
|
||||
fn dc_stock_str_repl_string(
|
||||
_: *mut dc_context_t,
|
||||
id: libc::c_int,
|
||||
value: *const libc::c_char,
|
||||
) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_create_or_lookup_nchat_by_contact_id(
|
||||
_: *mut dc_context_t,
|
||||
contact_id: uint32_t,
|
||||
create_blocked: libc::c_int,
|
||||
ret_chat_id: *mut uint32_t,
|
||||
ret_chat_blocked: *mut libc::c_int,
|
||||
);
|
||||
#[no_mangle]
|
||||
fn dc_unblock_chat(_: *mut dc_context_t, chat_id: uint32_t);
|
||||
#[no_mangle]
|
||||
fn dc_add_device_msg(_: *mut dc_context_t, chat_id: uint32_t, text: *const libc::c_char);
|
||||
#[no_mangle]
|
||||
fn dc_add_contact_to_chat_ex(
|
||||
_: *mut dc_context_t,
|
||||
chat_id: uint32_t,
|
||||
contact_id: uint32_t,
|
||||
flags: libc::c_int,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_hash_find(
|
||||
_: *const dc_hash_t,
|
||||
pKey: *const libc::c_void,
|
||||
nKey: libc::c_int,
|
||||
) -> *mut libc::c_void;
|
||||
#[no_mangle]
|
||||
fn dc_apeerstate_unref(_: *mut dc_apeerstate_t);
|
||||
#[no_mangle]
|
||||
fn dc_apeerstate_set_verified(
|
||||
_: *mut dc_apeerstate_t,
|
||||
which_key: libc::c_int,
|
||||
fingerprint: *const libc::c_char,
|
||||
verified: libc::c_int,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_apeerstate_load_by_fingerprint(
|
||||
_: *mut dc_apeerstate_t,
|
||||
_: *mut dc_sqlite3_t,
|
||||
fingerprint: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_apeerstate_save_to_db(
|
||||
_: *const dc_apeerstate_t,
|
||||
_: *mut dc_sqlite3_t,
|
||||
create: libc::c_int,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_addr_equals_self(_: *mut dc_context_t, addr: *const libc::c_char) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn dc_scaleup_contact_origin(_: *mut dc_context_t, contact_id: uint32_t, origin: libc::c_int);
|
||||
/* the following functions can be used only after a call to dc_mimeparser_parse() */
|
||||
#[no_mangle]
|
||||
fn dc_mimeparser_lookup_field(
|
||||
_: *mut dc_mimeparser_t,
|
||||
field_name: *const libc::c_char,
|
||||
) -> *mut mailimf_field;
|
||||
#[no_mangle]
|
||||
fn dc_log_warning(_: *mut dc_context_t, data1: libc::c_int, msg: *const libc::c_char, _: ...);
|
||||
#[no_mangle]
|
||||
fn dc_token_exists(
|
||||
_: *mut dc_context_t,
|
||||
_: dc_tokennamespc_t,
|
||||
token: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
}
|
||||
|
||||
/* *
|
||||
* Callback function that should be given to dc_context_new().
|
||||
*
|
||||
* @memberof dc_context_t
|
||||
* @param context The context object as returned by dc_context_new().
|
||||
* @param event one of the @ref DC_EVENT constants
|
||||
* @param data1 depends on the event parameter
|
||||
* @param data2 depends on the event parameter
|
||||
* @return return 0 unless stated otherwise in the event parameter documentation
|
||||
*/
|
||||
pub type dc_callback_t = Option<
|
||||
unsafe extern "C" fn(
|
||||
_: *mut dc_context_t,
|
||||
_: libc::c_int,
|
||||
_: uintptr_t,
|
||||
_: uintptr_t,
|
||||
) -> uintptr_t,
|
||||
>;
|
||||
pub type dc_receive_imf_t = Option<
|
||||
unsafe extern "C" fn(
|
||||
_: *mut dc_imap_t,
|
||||
_: *const libc::c_char,
|
||||
_: size_t,
|
||||
_: *const libc::c_char,
|
||||
_: uint32_t,
|
||||
_: uint32_t,
|
||||
) -> (),
|
||||
>;
|
||||
pub type dc_precheck_imf_t = Option<
|
||||
unsafe extern "C" fn(
|
||||
_: *mut dc_imap_t,
|
||||
_: *const libc::c_char,
|
||||
_: *const libc::c_char,
|
||||
_: uint32_t,
|
||||
) -> libc::c_int,
|
||||
>;
|
||||
pub type dc_set_config_t = Option<
|
||||
unsafe extern "C" fn(_: *mut dc_imap_t, _: *const libc::c_char, _: *const libc::c_char) -> (),
|
||||
>;
|
||||
pub type dc_get_config_t = Option<
|
||||
unsafe extern "C" fn(
|
||||
_: *mut dc_imap_t,
|
||||
_: *const libc::c_char,
|
||||
_: *const libc::c_char,
|
||||
) -> *mut libc::c_char,
|
||||
>;
|
||||
/* ** library-private **********************************************************/
|
||||
|
||||
/* *
|
||||
* Library-internal.
|
||||
*/
|
||||
|
||||
/* * the structure behind dc_array_t */
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_array {
|
||||
pub magic: uint32_t,
|
||||
pub context: *mut dc_context_t,
|
||||
pub allocated: size_t,
|
||||
pub count: size_t,
|
||||
pub type_0: libc::c_int,
|
||||
pub array: *mut uintptr_t,
|
||||
}
|
||||
pub type dc_array_t = _dc_array;
|
||||
/* values for the chats.blocked database field */
|
||||
/* * the structure behind dc_chat_t */
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_chat {
|
||||
pub magic: uint32_t,
|
||||
pub id: uint32_t,
|
||||
pub type_0: libc::c_int,
|
||||
pub name: *mut libc::c_char,
|
||||
pub archived: libc::c_int,
|
||||
pub context: *mut dc_context_t,
|
||||
pub grpid: *mut libc::c_char,
|
||||
pub blocked: libc::c_int,
|
||||
pub param: *mut dc_param_t,
|
||||
pub gossiped_timestamp: time_t,
|
||||
pub is_sending_locations: libc::c_int,
|
||||
}
|
||||
pub type dc_param_t = _dc_param;
|
||||
/* *
|
||||
* @class dc_param_t
|
||||
*
|
||||
* An object for handling key=value parameter lists; for the key, curently only
|
||||
* a single character is allowed.
|
||||
*
|
||||
* The object is used eg. by dc_chat_t or dc_msg_t, for readable paramter names,
|
||||
* these classes define some DC_PARAM_* constantats.
|
||||
*
|
||||
* Only for library-internal use.
|
||||
*/
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_param {
|
||||
pub packed: *mut libc::c_char,
|
||||
}
|
||||
pub type dc_chat_t = _dc_chat;
|
||||
/* * the structure behind dc_msg_t */
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_msg {
|
||||
pub magic: uint32_t,
|
||||
pub id: uint32_t,
|
||||
pub from_id: uint32_t,
|
||||
pub to_id: uint32_t,
|
||||
pub chat_id: uint32_t,
|
||||
pub move_state: dc_move_state_t,
|
||||
pub type_0: libc::c_int,
|
||||
pub state: libc::c_int,
|
||||
pub hidden: libc::c_int,
|
||||
pub timestamp_sort: time_t,
|
||||
pub timestamp_sent: time_t,
|
||||
pub timestamp_rcvd: time_t,
|
||||
pub text: *mut libc::c_char,
|
||||
pub context: *mut dc_context_t,
|
||||
pub rfc724_mid: *mut libc::c_char,
|
||||
pub in_reply_to: *mut libc::c_char,
|
||||
pub server_folder: *mut libc::c_char,
|
||||
pub server_uid: uint32_t,
|
||||
pub is_dc_message: libc::c_int,
|
||||
pub starred: libc::c_int,
|
||||
pub chat_blocked: libc::c_int,
|
||||
pub location_id: uint32_t,
|
||||
pub param: *mut dc_param_t,
|
||||
}
|
||||
pub type dc_move_state_t = libc::c_uint;
|
||||
pub const DC_MOVE_STATE_MOVING: dc_move_state_t = 3;
|
||||
pub const DC_MOVE_STATE_STAY: dc_move_state_t = 2;
|
||||
pub const DC_MOVE_STATE_PENDING: dc_move_state_t = 1;
|
||||
pub const DC_MOVE_STATE_UNDEFINED: dc_move_state_t = 0;
|
||||
pub type dc_msg_t = _dc_msg;
|
||||
/* * the structure behind dc_contact_t */
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_contact {
|
||||
pub magic: uint32_t,
|
||||
pub context: *mut dc_context_t,
|
||||
pub id: uint32_t,
|
||||
pub name: *mut libc::c_char,
|
||||
pub authname: *mut libc::c_char,
|
||||
pub addr: *mut libc::c_char,
|
||||
pub blocked: libc::c_int,
|
||||
pub origin: libc::c_int,
|
||||
}
|
||||
pub type dc_contact_t = _dc_contact;
|
||||
pub type dc_key_t = _dc_key;
|
||||
/* *
|
||||
* Library-internal.
|
||||
*/
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_key {
|
||||
pub binary: *mut libc::c_void,
|
||||
pub bytes: libc::c_int,
|
||||
pub type_0: libc::c_int,
|
||||
pub _m_heap_refcnt: libc::c_int,
|
||||
}
|
||||
// Token namespaces
|
||||
pub type dc_tokennamespc_t = libc::c_uint;
|
||||
pub const DC_TOKEN_AUTH: dc_tokennamespc_t = 110;
|
||||
pub const DC_TOKEN_INVITENUMBER: dc_tokennamespc_t = 100;
|
||||
pub type dc_apeerstate_t = _dc_apeerstate;
|
||||
/* prefer-encrypt states */
|
||||
/* *
|
||||
* @class dc_apeerstate_t
|
||||
* Library-internal.
|
||||
*/
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_apeerstate {
|
||||
pub context: *mut dc_context_t,
|
||||
pub addr: *mut libc::c_char,
|
||||
pub last_seen: time_t,
|
||||
pub last_seen_autocrypt: time_t,
|
||||
pub prefer_encrypt: libc::c_int,
|
||||
pub public_key: *mut dc_key_t,
|
||||
pub public_key_fingerprint: *mut libc::c_char,
|
||||
pub gossip_key: *mut dc_key_t,
|
||||
pub gossip_timestamp: time_t,
|
||||
pub gossip_key_fingerprint: *mut libc::c_char,
|
||||
pub verified_key: *mut dc_key_t,
|
||||
pub verified_key_fingerprint: *mut libc::c_char,
|
||||
pub to_save: libc::c_int,
|
||||
pub degrade_event: libc::c_int,
|
||||
}
|
||||
pub type sqlite3_destructor_type = Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>;
|
||||
/* A complete hash table is an instance of the following structure.
|
||||
* The internals of this structure are intended to be opaque -- client
|
||||
* code should not attempt to access or modify the fields of this structure
|
||||
* directly. Change this structure only by using the routines below.
|
||||
* However, many of the "procedures" and "functions" for modifying and
|
||||
* accessing this structure are really macros, so we can't really make
|
||||
* this structure opaque.
|
||||
*/
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_hash {
|
||||
pub keyClass: libc::c_char,
|
||||
pub copyKey: libc::c_char,
|
||||
pub count: libc::c_int,
|
||||
pub first: *mut dc_hashelem_t,
|
||||
pub htsize: libc::c_int,
|
||||
pub ht: *mut _ht,
|
||||
}
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _ht {
|
||||
pub count: libc::c_int,
|
||||
pub chain: *mut dc_hashelem_t,
|
||||
}
|
||||
pub type dc_hashelem_t = _dc_hashelem;
|
||||
/* Each element in the hash table is an instance of the following
|
||||
* structure. All elements are stored on a single doubly-linked list.
|
||||
*
|
||||
* Again, this structure is intended to be opaque, but it can't really
|
||||
* be opaque because it is used by macros.
|
||||
*/
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_hashelem {
|
||||
pub next: *mut dc_hashelem_t,
|
||||
pub prev: *mut dc_hashelem_t,
|
||||
pub data: *mut libc::c_void,
|
||||
pub pKey: *mut libc::c_void,
|
||||
pub nKey: libc::c_int,
|
||||
}
|
||||
/* Forward declarations of structures.
|
||||
*/
|
||||
pub type dc_hash_t = _dc_hash;
|
||||
/* *
|
||||
* @class dc_mimeparser_t
|
||||
*/
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_mimeparser {
|
||||
pub parts: *mut carray,
|
||||
pub mimeroot: *mut mailmime,
|
||||
pub header: dc_hash_t,
|
||||
pub header_root: *mut mailimf_fields,
|
||||
pub header_protected: *mut mailimf_fields,
|
||||
pub subject: *mut libc::c_char,
|
||||
pub is_send_by_messenger: libc::c_int,
|
||||
pub decrypting_failed: libc::c_int,
|
||||
pub e2ee_helper: *mut _dc_e2ee_helper,
|
||||
pub blobdir: *const libc::c_char,
|
||||
pub is_forwarded: libc::c_int,
|
||||
pub context: *mut dc_context_t,
|
||||
pub reports: *mut carray,
|
||||
pub is_system_message: libc::c_int,
|
||||
pub kml: *mut _dc_kml,
|
||||
}
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_kml {
|
||||
pub addr: *mut libc::c_char,
|
||||
pub locations: *mut dc_array_t,
|
||||
pub tag: libc::c_int,
|
||||
pub curr: dc_location_t,
|
||||
}
|
||||
pub type dc_location_t = _dc_location;
|
||||
// location handling
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_location {
|
||||
pub location_id: uint32_t,
|
||||
pub latitude: libc::c_double,
|
||||
pub longitude: libc::c_double,
|
||||
pub accuracy: libc::c_double,
|
||||
pub timestamp: time_t,
|
||||
pub contact_id: uint32_t,
|
||||
pub msg_id: uint32_t,
|
||||
pub chat_id: uint32_t,
|
||||
pub marker: *mut libc::c_char,
|
||||
}
|
||||
/* library private: end-to-end-encryption */
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_e2ee_helper {
|
||||
pub encryption_successfull: libc::c_int,
|
||||
pub cdata_to_free: *mut libc::c_void,
|
||||
pub encrypted: libc::c_int,
|
||||
pub signatures: *mut dc_hash_t,
|
||||
pub gossipped_addr: *mut dc_hash_t,
|
||||
}
|
||||
pub type dc_mimeparser_t = _dc_mimeparser;
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_securejoin_qr(
|
||||
mut context: *mut dc_context_t,
|
||||
|
||||
Reference in New Issue
Block a user