mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 05:16:28 +03:00
Start playing with cbindgen
This commit is contained in:
64
Cargo.lock
generated
64
Cargo.lock
generated
@@ -636,6 +636,25 @@ dependencies = [
|
|||||||
"opaque-debug",
|
"opaque-debug",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cbindgen"
|
||||||
|
version = "0.21.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "485ede05a56152367a6ec586a7425b475d6c3d3838581ff651d2a6e3730a62ef"
|
||||||
|
dependencies = [
|
||||||
|
"clap 3.1.8",
|
||||||
|
"heck",
|
||||||
|
"indexmap",
|
||||||
|
"log",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"syn",
|
||||||
|
"tempfile",
|
||||||
|
"toml",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.73"
|
version = "1.0.73"
|
||||||
@@ -712,6 +731,21 @@ dependencies = [
|
|||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "3.1.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c"
|
||||||
|
dependencies = [
|
||||||
|
"atty",
|
||||||
|
"bitflags",
|
||||||
|
"indexmap",
|
||||||
|
"os_str_bytes",
|
||||||
|
"strsim 0.10.0",
|
||||||
|
"termcolor",
|
||||||
|
"textwrap 0.15.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clear_on_drop"
|
name = "clear_on_drop"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
@@ -836,7 +870,7 @@ dependencies = [
|
|||||||
"async-std",
|
"async-std",
|
||||||
"atty",
|
"atty",
|
||||||
"cast",
|
"cast",
|
||||||
"clap",
|
"clap 2.34.0",
|
||||||
"criterion-plot",
|
"criterion-plot",
|
||||||
"csv",
|
"csv",
|
||||||
"futures",
|
"futures",
|
||||||
@@ -1014,7 +1048,7 @@ dependencies = [
|
|||||||
"ident_case",
|
"ident_case",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"strsim",
|
"strsim 0.9.3",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1154,6 +1188,7 @@ version = "1.76.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-std",
|
"async-std",
|
||||||
|
"cbindgen",
|
||||||
"deltachat",
|
"deltachat",
|
||||||
"human-panic",
|
"human-panic",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -1973,6 +2008,16 @@ dependencies = [
|
|||||||
"nom 6.1.2",
|
"nom 6.1.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "1.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 1.1.0",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "infer"
|
name = "infer"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
@@ -2509,6 +2554,15 @@ dependencies = [
|
|||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "os_str_bytes"
|
||||||
|
version = "6.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "os_type"
|
name = "os_type"
|
||||||
version = "2.4.0"
|
version = "2.4.0"
|
||||||
@@ -3636,6 +3690,12 @@ version = "0.9.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strum"
|
name = "strum"
|
||||||
version = "0.24.0"
|
version = "0.24.0"
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ anyhow = "1"
|
|||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
cbindgen = "0.21.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["vendored"]
|
default = ["vendored"]
|
||||||
vendored = ["deltachat/vendored"]
|
vendored = ["deltachat/vendored"]
|
||||||
|
|||||||
600
deltachat-ffi/bindings.h
Normal file
600
deltachat-ffi/bindings.h
Normal file
@@ -0,0 +1,600 @@
|
|||||||
|
#ifndef __DELTACHAT_H__
|
||||||
|
#define __DELTACHAT_H__
|
||||||
|
|
||||||
|
/* Generated with cbindgen:0.21.0 */
|
||||||
|
|
||||||
|
/* WARNING: this file is autogenerated by cbindgen. Do not modify manually. */
|
||||||
|
|
||||||
|
#ifndef PY_CFFI
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define DC_CONNECTIVITY_CONNECTING 2000
|
||||||
|
|
||||||
|
#define DC_CONNECTIVITY_WORKING 3000
|
||||||
|
|
||||||
|
#define DC_CONNECTIVITY_CONNECTED 4000
|
||||||
|
|
||||||
|
typedef struct dc_provider_t dc_provider_t;
|
||||||
|
|
||||||
|
typedef struct dc_accounts_event_emitter_t dc_accounts_event_emitter_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Struct representing a list of deltachat accounts.
|
||||||
|
*/
|
||||||
|
typedef struct dc_accounts_t dc_accounts_t;
|
||||||
|
|
||||||
|
typedef struct dc_array_t dc_array_t;
|
||||||
|
|
||||||
|
typedef struct dc_chat_t dc_chat_t;
|
||||||
|
|
||||||
|
typedef struct dc_chatlist_t dc_chatlist_t;
|
||||||
|
|
||||||
|
typedef struct dc_contact_t dc_contact_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Struct representing the deltachat context.
|
||||||
|
*/
|
||||||
|
typedef struct dc_context_t dc_context_t;
|
||||||
|
|
||||||
|
typedef struct dc_event_emitter_t dc_event_emitter_t;
|
||||||
|
|
||||||
|
typedef struct dc_event_t dc_event_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object containing a set of values.
|
||||||
|
* The meaning of the values is defined by the function returning the object.
|
||||||
|
* Lot objects are created
|
||||||
|
* eg. by chatlist.get_summary() or dc_msg_get_summary().
|
||||||
|
*
|
||||||
|
* *Lot* is used in the meaning *heap* here.
|
||||||
|
*/
|
||||||
|
typedef struct dc_lot_t dc_lot_t;
|
||||||
|
|
||||||
|
typedef struct dc_msg_t dc_msg_t;
|
||||||
|
|
||||||
|
typedef struct dc_provider_t dc_provider_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
struct dc_context_t *dc_context_new(const char *_os_name, const char *dbfile, const char *blobdir);
|
||||||
|
|
||||||
|
struct dc_context_t *dc_context_new_closed(const char *dbfile);
|
||||||
|
|
||||||
|
int dc_context_open(struct dc_context_t *context, const char *passphrase);
|
||||||
|
|
||||||
|
int dc_context_is_open(struct dc_context_t *context);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release the context structure.
|
||||||
|
*
|
||||||
|
* This function releases the memory of the `dc_context_t` structure.
|
||||||
|
*/
|
||||||
|
void dc_context_unref(struct dc_context_t *context);
|
||||||
|
|
||||||
|
char *dc_get_blobdir(struct dc_context_t *context);
|
||||||
|
|
||||||
|
int dc_set_config(struct dc_context_t *context, const char *key, const char *value);
|
||||||
|
|
||||||
|
char *dc_get_config(struct dc_context_t *context, const char *key);
|
||||||
|
|
||||||
|
int dc_set_stock_translation(struct dc_context_t *context, uint32_t stock_id, char *stock_msg);
|
||||||
|
|
||||||
|
int dc_set_config_from_qr(struct dc_context_t *context, char *qr);
|
||||||
|
|
||||||
|
char *dc_get_info(const struct dc_context_t *context);
|
||||||
|
|
||||||
|
int dc_get_connectivity(const struct dc_context_t *context);
|
||||||
|
|
||||||
|
char *dc_get_connectivity_html(const struct dc_context_t *context);
|
||||||
|
|
||||||
|
int dc_all_work_done(struct dc_context_t *context);
|
||||||
|
|
||||||
|
char *dc_get_oauth2_url(struct dc_context_t *context, const char *addr, const char *redirect);
|
||||||
|
|
||||||
|
void dc_configure(struct dc_context_t *context);
|
||||||
|
|
||||||
|
int dc_is_configured(struct dc_context_t *context);
|
||||||
|
|
||||||
|
void dc_start_io(struct dc_context_t *context);
|
||||||
|
|
||||||
|
int dc_get_id(struct dc_context_t *context);
|
||||||
|
|
||||||
|
void dc_event_unref(struct dc_event_t *a);
|
||||||
|
|
||||||
|
int dc_event_get_id(struct dc_event_t *event);
|
||||||
|
|
||||||
|
int dc_event_get_data1_int(struct dc_event_t *event);
|
||||||
|
|
||||||
|
int dc_event_get_data2_int(struct dc_event_t *event);
|
||||||
|
|
||||||
|
char *dc_event_get_data2_str(struct dc_event_t *event);
|
||||||
|
|
||||||
|
uint32_t dc_event_get_account_id(struct dc_event_t *event);
|
||||||
|
|
||||||
|
struct dc_event_emitter_t *dc_get_event_emitter(struct dc_context_t *context);
|
||||||
|
|
||||||
|
void dc_event_emitter_unref(struct dc_event_emitter_t *emitter);
|
||||||
|
|
||||||
|
struct dc_event_t *dc_get_next_event(struct dc_event_emitter_t *events);
|
||||||
|
|
||||||
|
void dc_stop_io(struct dc_context_t *context);
|
||||||
|
|
||||||
|
void dc_maybe_network(struct dc_context_t *context);
|
||||||
|
|
||||||
|
int32_t dc_preconfigure_keypair(struct dc_context_t *context,
|
||||||
|
const char *addr,
|
||||||
|
const char *public_data,
|
||||||
|
const char *secret_data);
|
||||||
|
|
||||||
|
struct dc_chatlist_t *dc_get_chatlist(struct dc_context_t *context,
|
||||||
|
int flags,
|
||||||
|
const char *query_str,
|
||||||
|
uint32_t query_id);
|
||||||
|
|
||||||
|
uint32_t dc_create_chat_by_contact_id(struct dc_context_t *context, uint32_t contact_id);
|
||||||
|
|
||||||
|
uint32_t dc_get_chat_id_by_contact_id(struct dc_context_t *context, uint32_t contact_id);
|
||||||
|
|
||||||
|
uint32_t dc_prepare_msg(struct dc_context_t *context, uint32_t chat_id, struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
uint32_t dc_send_msg(struct dc_context_t *context, uint32_t chat_id, struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
uint32_t dc_send_msg_sync(struct dc_context_t *context, uint32_t chat_id, struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
uint32_t dc_send_text_msg(struct dc_context_t *context, uint32_t chat_id, const char *text_to_send);
|
||||||
|
|
||||||
|
uint32_t dc_send_videochat_invitation(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
int dc_send_webxdc_status_update(struct dc_context_t *context,
|
||||||
|
uint32_t msg_id,
|
||||||
|
const char *json,
|
||||||
|
const char *descr);
|
||||||
|
|
||||||
|
char *dc_get_webxdc_status_updates(struct dc_context_t *context,
|
||||||
|
uint32_t msg_id,
|
||||||
|
uint32_t last_known_serial);
|
||||||
|
|
||||||
|
void dc_set_draft(struct dc_context_t *context, uint32_t chat_id, struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
uint32_t dc_add_device_msg(struct dc_context_t *context, const char *label, struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_was_device_msg_ever_added(struct dc_context_t *context, const char *label);
|
||||||
|
|
||||||
|
struct dc_msg_t *dc_get_draft(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
dc_array_t *dc_get_chat_msgs(struct dc_context_t *context,
|
||||||
|
uint32_t chat_id,
|
||||||
|
uint32_t flags,
|
||||||
|
uint32_t marker1before);
|
||||||
|
|
||||||
|
int dc_get_msg_cnt(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
int dc_get_fresh_msg_cnt(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
int dc_estimate_deletion_cnt(struct dc_context_t *context, int from_server, int64_t seconds);
|
||||||
|
|
||||||
|
dc_array_t *dc_get_fresh_msgs(struct dc_context_t *context);
|
||||||
|
|
||||||
|
void dc_marknoticed_chat(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
dc_array_t *dc_get_chat_media(struct dc_context_t *context,
|
||||||
|
uint32_t chat_id,
|
||||||
|
int msg_type,
|
||||||
|
int or_msg_type2,
|
||||||
|
int or_msg_type3);
|
||||||
|
|
||||||
|
uint32_t dc_get_next_media(struct dc_context_t *context,
|
||||||
|
uint32_t msg_id,
|
||||||
|
int dir,
|
||||||
|
int msg_type,
|
||||||
|
int or_msg_type2,
|
||||||
|
int or_msg_type3);
|
||||||
|
|
||||||
|
int dc_set_chat_protection(struct dc_context_t *context, uint32_t chat_id, int protect);
|
||||||
|
|
||||||
|
void dc_set_chat_visibility(struct dc_context_t *context, uint32_t chat_id, int archive);
|
||||||
|
|
||||||
|
void dc_delete_chat(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
void dc_block_chat(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
void dc_accept_chat(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
dc_array_t *dc_get_chat_contacts(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
dc_array_t *dc_search_msgs(struct dc_context_t *context, uint32_t chat_id, const char *query);
|
||||||
|
|
||||||
|
struct dc_chat_t *dc_get_chat(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
uint32_t dc_create_group_chat(struct dc_context_t *context, int protect, const char *name);
|
||||||
|
|
||||||
|
uint32_t dc_create_broadcast_list(struct dc_context_t *context);
|
||||||
|
|
||||||
|
int dc_is_contact_in_chat(struct dc_context_t *context, uint32_t chat_id, uint32_t contact_id);
|
||||||
|
|
||||||
|
int dc_add_contact_to_chat(struct dc_context_t *context, uint32_t chat_id, uint32_t contact_id);
|
||||||
|
|
||||||
|
int dc_remove_contact_from_chat(struct dc_context_t *context,
|
||||||
|
uint32_t chat_id,
|
||||||
|
uint32_t contact_id);
|
||||||
|
|
||||||
|
int dc_set_chat_name(struct dc_context_t *context, uint32_t chat_id, const char *name);
|
||||||
|
|
||||||
|
int dc_set_chat_profile_image(struct dc_context_t *context, uint32_t chat_id, const char *image);
|
||||||
|
|
||||||
|
int dc_set_chat_mute_duration(struct dc_context_t *context, uint32_t chat_id, int64_t duration);
|
||||||
|
|
||||||
|
char *dc_get_chat_encrinfo(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
uint32_t dc_get_chat_ephemeral_timer(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
int dc_set_chat_ephemeral_timer(struct dc_context_t *context, uint32_t chat_id, uint32_t timer);
|
||||||
|
|
||||||
|
char *dc_get_msg_info(struct dc_context_t *context, uint32_t msg_id);
|
||||||
|
|
||||||
|
char *dc_get_msg_html(struct dc_context_t *context, uint32_t msg_id);
|
||||||
|
|
||||||
|
char *dc_get_mime_headers(struct dc_context_t *context, uint32_t msg_id);
|
||||||
|
|
||||||
|
void dc_delete_msgs(struct dc_context_t *context, const uint32_t *msg_ids, int msg_cnt);
|
||||||
|
|
||||||
|
void dc_forward_msgs(struct dc_context_t *context,
|
||||||
|
const uint32_t *msg_ids,
|
||||||
|
int msg_cnt,
|
||||||
|
uint32_t chat_id);
|
||||||
|
|
||||||
|
void dc_markseen_msgs(struct dc_context_t *context, const uint32_t *msg_ids, int msg_cnt);
|
||||||
|
|
||||||
|
struct dc_msg_t *dc_get_msg(struct dc_context_t *context, uint32_t msg_id);
|
||||||
|
|
||||||
|
void dc_download_full_msg(struct dc_context_t *context, uint32_t msg_id);
|
||||||
|
|
||||||
|
int dc_may_be_valid_addr(const char *addr);
|
||||||
|
|
||||||
|
uint32_t dc_lookup_contact_id_by_addr(struct dc_context_t *context, const char *addr);
|
||||||
|
|
||||||
|
uint32_t dc_create_contact(struct dc_context_t *context, const char *name, const char *addr);
|
||||||
|
|
||||||
|
int dc_add_address_book(struct dc_context_t *context, const char *addr_book);
|
||||||
|
|
||||||
|
dc_array_t *dc_get_contacts(struct dc_context_t *context, uint32_t flags, const char *query);
|
||||||
|
|
||||||
|
int dc_get_blocked_cnt(struct dc_context_t *context);
|
||||||
|
|
||||||
|
dc_array_t *dc_get_blocked_contacts(struct dc_context_t *context);
|
||||||
|
|
||||||
|
void dc_block_contact(struct dc_context_t *context, uint32_t contact_id, int block);
|
||||||
|
|
||||||
|
char *dc_get_contact_encrinfo(struct dc_context_t *context, uint32_t contact_id);
|
||||||
|
|
||||||
|
int dc_delete_contact(struct dc_context_t *context, uint32_t contact_id);
|
||||||
|
|
||||||
|
struct dc_contact_t *dc_get_contact(struct dc_context_t *context, uint32_t contact_id);
|
||||||
|
|
||||||
|
void dc_imex(struct dc_context_t *context, int what_raw, const char *param1, const char *param2);
|
||||||
|
|
||||||
|
char *dc_imex_has_backup(struct dc_context_t *context, const char *dir);
|
||||||
|
|
||||||
|
char *dc_initiate_key_transfer(struct dc_context_t *context);
|
||||||
|
|
||||||
|
int dc_continue_key_transfer(struct dc_context_t *context, uint32_t msg_id, const char *setup_code);
|
||||||
|
|
||||||
|
void dc_stop_ongoing_process(struct dc_context_t *context);
|
||||||
|
|
||||||
|
struct dc_lot_t *dc_check_qr(struct dc_context_t *context, const char *qr);
|
||||||
|
|
||||||
|
char *dc_get_securejoin_qr(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
char *dc_get_securejoin_qr_svg(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
uint32_t dc_join_securejoin(struct dc_context_t *context, const char *qr);
|
||||||
|
|
||||||
|
void dc_send_locations_to_chat(struct dc_context_t *context, uint32_t chat_id, int seconds);
|
||||||
|
|
||||||
|
int dc_is_sending_locations_to_chat(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
int dc_set_location(struct dc_context_t *context,
|
||||||
|
double latitude,
|
||||||
|
double longitude,
|
||||||
|
double accuracy);
|
||||||
|
|
||||||
|
dc_array_t *dc_get_locations(struct dc_context_t *context,
|
||||||
|
uint32_t chat_id,
|
||||||
|
uint32_t contact_id,
|
||||||
|
int64_t timestamp_begin,
|
||||||
|
int64_t timestamp_end);
|
||||||
|
|
||||||
|
void dc_delete_all_locations(struct dc_context_t *context);
|
||||||
|
|
||||||
|
char *dc_get_last_error(struct dc_context_t *context);
|
||||||
|
|
||||||
|
void dc_array_unref(dc_array_t *a);
|
||||||
|
|
||||||
|
size_t dc_array_get_cnt(const dc_array_t *array);
|
||||||
|
|
||||||
|
uint32_t dc_array_get_id(const dc_array_t *array, size_t index);
|
||||||
|
|
||||||
|
double dc_array_get_latitude(const dc_array_t *array, size_t index);
|
||||||
|
|
||||||
|
double dc_array_get_longitude(const dc_array_t *array, size_t index);
|
||||||
|
|
||||||
|
double dc_array_get_accuracy(const dc_array_t *array, size_t index);
|
||||||
|
|
||||||
|
int64_t dc_array_get_timestamp(const dc_array_t *array, size_t index);
|
||||||
|
|
||||||
|
unsigned int dc_array_get_chat_id(const dc_array_t *array, size_t index);
|
||||||
|
|
||||||
|
unsigned int dc_array_get_contact_id(const dc_array_t *array, size_t index);
|
||||||
|
|
||||||
|
unsigned int dc_array_get_msg_id(const dc_array_t *array, size_t index);
|
||||||
|
|
||||||
|
char *dc_array_get_marker(const dc_array_t *array, size_t index);
|
||||||
|
|
||||||
|
int dc_array_search_id(const dc_array_t *array, unsigned int needle, size_t *ret_index);
|
||||||
|
|
||||||
|
void dc_chatlist_unref(struct dc_chatlist_t *chatlist);
|
||||||
|
|
||||||
|
size_t dc_chatlist_get_cnt(struct dc_chatlist_t *chatlist);
|
||||||
|
|
||||||
|
uint32_t dc_chatlist_get_chat_id(struct dc_chatlist_t *chatlist, size_t index);
|
||||||
|
|
||||||
|
uint32_t dc_chatlist_get_msg_id(struct dc_chatlist_t *chatlist, size_t index);
|
||||||
|
|
||||||
|
struct dc_lot_t *dc_chatlist_get_summary(struct dc_chatlist_t *chatlist,
|
||||||
|
size_t index,
|
||||||
|
struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
struct dc_lot_t *dc_chatlist_get_summary2(struct dc_context_t *context,
|
||||||
|
uint32_t chat_id,
|
||||||
|
uint32_t msg_id);
|
||||||
|
|
||||||
|
const struct dc_context_t *dc_chatlist_get_context(struct dc_chatlist_t *chatlist);
|
||||||
|
|
||||||
|
void dc_chat_unref(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
uint32_t dc_chat_get_id(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_get_type(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
char *dc_chat_get_name(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
char *dc_chat_get_profile_image(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
uint32_t dc_chat_get_color(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_get_visibility(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_is_contact_request(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_is_unpromoted(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_is_self_talk(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_is_device_talk(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_can_send(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_is_protected(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_is_sending_locations(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int dc_chat_is_muted(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
int64_t dc_chat_get_remaining_mute_duration(struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
char *dc_chat_get_info_json(struct dc_context_t *context, uint32_t chat_id);
|
||||||
|
|
||||||
|
struct dc_msg_t *dc_msg_new(struct dc_context_t *context, int viewtype);
|
||||||
|
|
||||||
|
void dc_msg_unref(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
uint32_t dc_msg_get_id(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
uint32_t dc_msg_get_from_id(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
uint32_t dc_msg_get_chat_id(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_get_viewtype(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_get_state(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_get_download_state(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int64_t dc_msg_get_timestamp(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int64_t dc_msg_get_received_timestamp(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int64_t dc_msg_get_sort_timestamp(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
char *dc_msg_get_text(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
char *dc_msg_get_subject(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
char *dc_msg_get_file(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
char *dc_msg_get_filename(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
char *dc_msg_get_webxdc_blob(struct dc_msg_t *msg, const char *filename, size_t *ret_bytes);
|
||||||
|
|
||||||
|
char *dc_msg_get_webxdc_info(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
char *dc_msg_get_filemime(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
uint64_t dc_msg_get_filebytes(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_get_width(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_get_height(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_get_duration(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_get_showpadlock(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_is_bot(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
uint32_t dc_msg_get_ephemeral_timer(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int64_t dc_msg_get_ephemeral_timestamp(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
struct dc_lot_t *dc_msg_get_summary(struct dc_msg_t *msg, struct dc_chat_t *chat);
|
||||||
|
|
||||||
|
char *dc_msg_get_summarytext(struct dc_msg_t *msg, int approx_characters);
|
||||||
|
|
||||||
|
char *dc_msg_get_override_sender_name(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_has_deviating_timestamp(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_has_location(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_is_sent(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_is_forwarded(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_is_info(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_get_info_type(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_is_increation(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_is_setupmessage(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_has_html(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
char *dc_msg_get_videochat_url(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
int dc_msg_get_videochat_type(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
char *dc_msg_get_setupcodebegin(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
void dc_msg_set_text(struct dc_msg_t *msg, const char *text);
|
||||||
|
|
||||||
|
void dc_msg_set_html(struct dc_msg_t *msg, const char *html);
|
||||||
|
|
||||||
|
void dc_msg_set_override_sender_name(struct dc_msg_t *msg, const char *name);
|
||||||
|
|
||||||
|
void dc_msg_set_file(struct dc_msg_t *msg, const char *file, const char *filemime);
|
||||||
|
|
||||||
|
void dc_msg_set_dimension(struct dc_msg_t *msg, int width, int height);
|
||||||
|
|
||||||
|
void dc_msg_set_duration(struct dc_msg_t *msg, int duration);
|
||||||
|
|
||||||
|
void dc_msg_set_location(struct dc_msg_t *msg, double latitude, double longitude);
|
||||||
|
|
||||||
|
void dc_msg_latefiling_mediasize(struct dc_msg_t *msg, int width, int height, int duration);
|
||||||
|
|
||||||
|
char *dc_msg_get_error(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
void dc_msg_set_quote(struct dc_msg_t *msg, const struct dc_msg_t *quote);
|
||||||
|
|
||||||
|
char *dc_msg_get_quoted_text(const struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
struct dc_msg_t *dc_msg_get_quoted_msg(const struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
struct dc_msg_t *dc_msg_get_parent(const struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
void dc_msg_force_plaintext(struct dc_msg_t *msg);
|
||||||
|
|
||||||
|
void dc_contact_unref(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
uint32_t dc_contact_get_id(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
char *dc_contact_get_addr(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
char *dc_contact_get_name(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
char *dc_contact_get_auth_name(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
char *dc_contact_get_display_name(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
char *dc_contact_get_name_n_addr(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
char *dc_contact_get_profile_image(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
uint32_t dc_contact_get_color(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
char *dc_contact_get_status(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
int64_t dc_contact_get_last_seen(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
int dc_contact_is_blocked(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
int dc_contact_is_verified(struct dc_contact_t *contact);
|
||||||
|
|
||||||
|
void dc_lot_unref(struct dc_lot_t *lot);
|
||||||
|
|
||||||
|
char *dc_lot_get_text1(struct dc_lot_t *lot);
|
||||||
|
|
||||||
|
char *dc_lot_get_text2(struct dc_lot_t *lot);
|
||||||
|
|
||||||
|
int dc_lot_get_text1_meaning(struct dc_lot_t *lot);
|
||||||
|
|
||||||
|
int dc_lot_get_state(struct dc_lot_t *lot);
|
||||||
|
|
||||||
|
uint32_t dc_lot_get_id(struct dc_lot_t *lot);
|
||||||
|
|
||||||
|
int64_t dc_lot_get_timestamp(struct dc_lot_t *lot);
|
||||||
|
|
||||||
|
void dc_str_unref(char *s);
|
||||||
|
|
||||||
|
const dc_provider_t *dc_provider_new_from_email(const struct dc_context_t *context,
|
||||||
|
const char *addr);
|
||||||
|
|
||||||
|
char *dc_provider_get_overview_page(const dc_provider_t *provider);
|
||||||
|
|
||||||
|
char *dc_provider_get_before_login_hint(const dc_provider_t *provider);
|
||||||
|
|
||||||
|
int dc_provider_get_status(const dc_provider_t *provider);
|
||||||
|
|
||||||
|
void dc_provider_unref(dc_provider_t *provider);
|
||||||
|
|
||||||
|
struct dc_accounts_t *dc_accounts_new(const char *_os_name, const char *dbfile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release the accounts structure.
|
||||||
|
*
|
||||||
|
* This function releases the memory of the `dc_accounts_t` structure.
|
||||||
|
*/
|
||||||
|
void dc_accounts_unref(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
struct dc_context_t *dc_accounts_get_account(struct dc_accounts_t *accounts, uint32_t id);
|
||||||
|
|
||||||
|
struct dc_context_t *dc_accounts_get_selected_account(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
int dc_accounts_select_account(struct dc_accounts_t *accounts, uint32_t id);
|
||||||
|
|
||||||
|
uint32_t dc_accounts_add_account(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
uint32_t dc_accounts_add_closed_account(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
int dc_accounts_remove_account(struct dc_accounts_t *accounts, uint32_t id);
|
||||||
|
|
||||||
|
uint32_t dc_accounts_migrate_account(struct dc_accounts_t *accounts, const char *dbfile);
|
||||||
|
|
||||||
|
dc_array_t *dc_accounts_get_all(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
int dc_accounts_all_work_done(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
void dc_accounts_start_io(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
void dc_accounts_stop_io(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
void dc_accounts_maybe_network(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
void dc_accounts_maybe_network_lost(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
struct dc_accounts_event_emitter_t *dc_accounts_get_event_emitter(struct dc_accounts_t *accounts);
|
||||||
|
|
||||||
|
void dc_accounts_event_emitter_unref(struct dc_accounts_event_emitter_t *emitter);
|
||||||
|
|
||||||
|
struct dc_event_t *dc_accounts_get_next_event(struct dc_accounts_event_emitter_t *emitter);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif /* __DELTACHAT_H__ */
|
||||||
@@ -32,4 +32,9 @@ fn main() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.write_all(pkg_config.as_bytes())
|
.write_all(pkg_config.as_bytes())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||||
|
cbindgen::generate(crate_dir)
|
||||||
|
.expect("Unable to generate header file")
|
||||||
|
.write_to_file("bindings.h");
|
||||||
}
|
}
|
||||||
|
|||||||
43
deltachat-ffi/cbindgen.toml
Normal file
43
deltachat-ffi/cbindgen.toml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
language = "C"
|
||||||
|
include_guard = "__DELTACHAT_H__"
|
||||||
|
include_version = true
|
||||||
|
autogen_warning = "/* WARNING: this file is autogenerated by cbindgen. Do not modify manually. */"
|
||||||
|
# header = """
|
||||||
|
# /* We start with a bunch of opaque `_dc_something_t` structs. */
|
||||||
|
# """
|
||||||
|
no_includes = true
|
||||||
|
after_includes = """
|
||||||
|
#ifndef PY_CFFI
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
"""
|
||||||
|
cpp_compat = true
|
||||||
|
# style = "tag"
|
||||||
|
style = "both"
|
||||||
|
documentation = true
|
||||||
|
documentation_style = "doxy"
|
||||||
|
documentation_length = "full"
|
||||||
|
|
||||||
|
[export]
|
||||||
|
# exclude = ["AccountsWrapper"]
|
||||||
|
|
||||||
|
[export.rename]
|
||||||
|
# The opaque wrapper structs are usually prefixed with an underscore
|
||||||
|
# in C headers. To keep the Rust source clean we rename them here,
|
||||||
|
# though at the end of the day this doesn't really matter.
|
||||||
|
# "AccountsWrapper" = "_dc_accounts_t"
|
||||||
|
# "ChatWrapper" = "_dc_chat_t"
|
||||||
|
# "ChatlistWrapper" = "_dc_chatlist_t"
|
||||||
|
# "ContactWrapper" = "_dc_contact_t"
|
||||||
|
# "MessageWrapper" = "_dc_message_t"
|
||||||
|
# "Context" = "_dc_context_t"
|
||||||
|
# "Event" = "_dc_event_t"
|
||||||
|
# "EventEmitter" = "_dc_event_emitter_t"
|
||||||
|
# "AccountsEventEmitter" = "_dc_accounts_event_emitter_t"
|
||||||
|
# "Lot" = "_dc_lot_t"
|
||||||
|
"Provider" = "dc_provider_t"
|
||||||
|
|
||||||
|
[parse]
|
||||||
|
parse_deps = true
|
||||||
|
include = ["deltachat"]
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ use std::borrow::Cow;
|
|||||||
///
|
///
|
||||||
/// *Lot* is used in the meaning *heap* here.
|
/// *Lot* is used in the meaning *heap* here.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Lot {
|
pub enum dc_lot_t {
|
||||||
Summary(Summary),
|
Summary(Summary),
|
||||||
Qr(Qr),
|
Qr(Qr),
|
||||||
Error(String),
|
Error(String),
|
||||||
@@ -34,7 +34,7 @@ impl Default for Meaning {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Lot {
|
impl dc_lot_t {
|
||||||
pub fn get_text1(&self) -> Option<&str> {
|
pub fn get_text1(&self) -> Option<&str> {
|
||||||
match self {
|
match self {
|
||||||
Self::Summary(summary) => match &summary.prefix {
|
Self::Summary(summary) => match &summary.prefix {
|
||||||
@@ -225,21 +225,21 @@ impl From<MessageState> for LotState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Summary> for Lot {
|
impl From<Summary> for dc_lot_t {
|
||||||
fn from(summary: Summary) -> Self {
|
fn from(summary: Summary) -> Self {
|
||||||
Lot::Summary(summary)
|
dc_lot_t::Summary(summary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Qr> for Lot {
|
impl From<Qr> for dc_lot_t {
|
||||||
fn from(qr: Qr) -> Self {
|
fn from(qr: Qr) -> Self {
|
||||||
Lot::Qr(qr)
|
dc_lot_t::Qr(qr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make it easy to convert errors into the final `Lot`.
|
// Make it easy to convert errors into the final `Lot`.
|
||||||
impl From<Error> for Lot {
|
impl From<Error> for dc_lot_t {
|
||||||
fn from(error: Error) -> Self {
|
fn from(error: Error) -> Self {
|
||||||
Lot::Error(error.to_string())
|
dc_lot_t::Error(error.to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ mod e2ee;
|
|||||||
pub mod ephemeral;
|
pub mod ephemeral;
|
||||||
mod imap;
|
mod imap;
|
||||||
pub mod imex;
|
pub mod imex;
|
||||||
mod scheduler;
|
pub mod scheduler;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod job;
|
mod job;
|
||||||
mod format_flowed;
|
mod format_flowed;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ use crate::smtp::{send_smtp_messages, Smtp};
|
|||||||
|
|
||||||
use self::connectivity::ConnectivityStore;
|
use self::connectivity::ConnectivityStore;
|
||||||
|
|
||||||
pub(crate) mod connectivity;
|
pub mod connectivity;
|
||||||
|
|
||||||
pub(crate) struct StopToken;
|
pub(crate) struct StopToken;
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::{context::Context, log::LogExt};
|
|||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use humansize::{file_size_opts, FileSize};
|
use humansize::{file_size_opts, FileSize};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumProperty, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub enum Connectivity {
|
pub enum Connectivity {
|
||||||
NotConnected = 1000,
|
NotConnected = 1000,
|
||||||
Connecting = 2000,
|
Connecting = 2000,
|
||||||
@@ -27,7 +27,7 @@ pub enum Connectivity {
|
|||||||
// the top) take priority. This means that e.g. if any folder has an error - usually
|
// the top) take priority. This means that e.g. if any folder has an error - usually
|
||||||
// because there is no internet connection - the connectivity for the whole
|
// because there is no internet connection - the connectivity for the whole
|
||||||
// account will be `Notconnected`.
|
// account will be `Notconnected`.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, EnumProperty, PartialOrd)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd)]
|
||||||
enum DetailedConnectivity {
|
enum DetailedConnectivity {
|
||||||
Error(String),
|
Error(String),
|
||||||
Uninitialized,
|
Uninitialized,
|
||||||
|
|||||||
Reference in New Issue
Block a user