mirror of
https://github.com/chatmail/core.git
synced 2026-04-23 00:16:34 +03:00
fix: ffi interface updates
This commit is contained in:
@@ -28,11 +28,14 @@ pub unsafe extern "C" fn dc_context_new(
|
||||
userdata: *mut libc::c_void,
|
||||
os_name: *const libc::c_char,
|
||||
) -> *mut dc_context_t {
|
||||
dc_context::dc_context_new(cb, userdata, os_name)
|
||||
let ctx = dc_context::dc_context_new(cb, userdata, os_name);
|
||||
Box::into_raw(Box::new(ctx))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_context_unref(context: *mut dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &mut *context;
|
||||
dc_context::dc_context_unref(context)
|
||||
}
|
||||
|
||||
@@ -40,6 +43,9 @@ pub unsafe extern "C" fn dc_context_unref(context: *mut dc_context_t) {
|
||||
pub unsafe extern "C" fn dc_get_userdata(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
) -> *mut libc::c_void {
|
||||
assert!(!context.is_null());
|
||||
let context = &mut *context;
|
||||
|
||||
dc_context::dc_get_userdata(context)
|
||||
}
|
||||
|
||||
@@ -49,16 +55,23 @@ pub unsafe extern "C" fn dc_open(
|
||||
dbfile: *mut libc::c_char,
|
||||
blobdir: *mut libc::c_char,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &mut *context;
|
||||
|
||||
dc_context::dc_open(context, dbfile, blobdir)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_close(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &mut *context;
|
||||
dc_context::dc_close(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_is_open(context: *mut dc_context::dc_context_t) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &mut *context;
|
||||
dc_context::dc_is_open(context)
|
||||
}
|
||||
|
||||
@@ -66,6 +79,9 @@ pub unsafe extern "C" fn dc_is_open(context: *mut dc_context::dc_context_t) -> l
|
||||
pub unsafe extern "C" fn dc_get_blobdir(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_context::dc_get_blobdir(context)
|
||||
}
|
||||
|
||||
@@ -75,6 +91,9 @@ pub unsafe extern "C" fn dc_set_config(
|
||||
key: *mut libc::c_char,
|
||||
value: *mut libc::c_char,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_context::dc_set_config(context, key, value)
|
||||
}
|
||||
|
||||
@@ -83,11 +102,17 @@ pub unsafe extern "C" fn dc_get_config(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
key: *mut libc::c_char,
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_context::dc_get_config(context, key)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_info(context: *mut dc_context::dc_context_t) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_context::dc_get_info(context)
|
||||
}
|
||||
|
||||
@@ -97,6 +122,9 @@ pub unsafe extern "C" fn dc_get_oauth2_url(
|
||||
addr: *mut libc::c_char,
|
||||
redirect: *mut libc::c_char,
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_oauth2::dc_get_oauth2_url(context, addr, redirect)
|
||||
}
|
||||
|
||||
@@ -107,91 +135,142 @@ pub unsafe extern "C" fn dc_get_version_str() -> *mut libc::c_char {
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_configure(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_configure::dc_configure(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_is_configured(context: *mut dc_context::dc_context_t) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_configure::dc_is_configured(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_perform_imap_jobs(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_perform_imap_jobs(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_perform_imap_fetch(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_perform_imap_fetch(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_perform_imap_idle(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_perform_imap_idle(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_interrupt_imap_idle(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_interrupt_imap_idle(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_perform_mvbox_fetch(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_perform_mvbox_fetch(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_perform_mvbox_idle(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_perform_mvbox_idle(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_interrupt_mvbox_idle(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_interrupt_mvbox_idle(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_perform_sentbox_fetch(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_perform_sentbox_fetch(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_perform_sentbox_idle(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_perform_sentbox_idle(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_interrupt_sentbox_idle(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_interrupt_sentbox_idle(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_perform_smtp_jobs(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_perform_smtp_jobs(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_perform_smtp_idle(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_perform_smtp_idle(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_interrupt_smtp_idle(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_interrupt_smtp_idle(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_maybe_network(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_job::dc_maybe_network(context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_chatlist(
|
||||
pub unsafe extern "C" fn dc_get_chatlist<'a>(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
flags: libc::c_int,
|
||||
query_str: *mut libc::c_char,
|
||||
query_id: libc::uint32_t,
|
||||
) -> *mut dc_chatlist::dc_chatlist_t {
|
||||
) -> *mut dc_chatlist::dc_chatlist_t<'a> {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chatlist::dc_get_chatlist(context, flags, query_str, query_id)
|
||||
}
|
||||
|
||||
@@ -200,6 +279,9 @@ pub unsafe extern "C" fn dc_create_chat_by_msg_id(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
msg_id: libc::uint32_t,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_create_chat_by_msg_id(context, msg_id)
|
||||
}
|
||||
|
||||
@@ -208,6 +290,9 @@ pub unsafe extern "C" fn dc_create_chat_by_contact_id(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
contact_id: libc::uint32_t,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_create_chat_by_contact_id(context, contact_id)
|
||||
}
|
||||
|
||||
@@ -216,6 +301,9 @@ pub unsafe extern "C" fn dc_get_chat_id_by_contact_id(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
contact_id: libc::uint32_t,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_get_chat_id_by_contact_id(context, contact_id)
|
||||
}
|
||||
|
||||
@@ -225,6 +313,9 @@ pub unsafe extern "C" fn dc_prepare_msg(
|
||||
chat_id: libc::uint32_t,
|
||||
msg: *mut dc_msg::dc_msg_t,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_prepare_msg(context, chat_id, msg)
|
||||
}
|
||||
|
||||
@@ -234,6 +325,9 @@ pub unsafe extern "C" fn dc_send_msg(
|
||||
chat_id: libc::uint32_t,
|
||||
msg: *mut dc_msg::dc_msg_t,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_send_msg(context, chat_id, msg)
|
||||
}
|
||||
|
||||
@@ -243,6 +337,9 @@ pub unsafe extern "C" fn dc_send_text_msg(
|
||||
chat_id: libc::uint32_t,
|
||||
text_to_send: *mut libc::c_char,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_send_text_msg(context, chat_id, text_to_send)
|
||||
}
|
||||
|
||||
@@ -252,14 +349,20 @@ pub unsafe extern "C" fn dc_set_draft(
|
||||
chat_id: libc::uint32_t,
|
||||
msg: *mut dc_msg::dc_msg_t,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_set_draft(context, chat_id, msg)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_draft(
|
||||
pub unsafe extern "C" fn dc_get_draft<'a>(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
chat_id: libc::uint32_t,
|
||||
) -> *mut dc_msg::dc_msg_t {
|
||||
) -> *mut dc_msg::dc_msg_t<'a> {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_get_draft(context, chat_id)
|
||||
}
|
||||
|
||||
@@ -270,6 +373,9 @@ pub unsafe extern "C" fn dc_get_chat_msgs(
|
||||
flags: libc::uint32_t,
|
||||
marker1before: libc::uint32_t,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_get_chat_msgs(context, chat_id, flags, marker1before)
|
||||
}
|
||||
|
||||
@@ -278,6 +384,9 @@ pub unsafe extern "C" fn dc_get_msg_cnt(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
chat_id: libc::uint32_t,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_get_msg_cnt(context, chat_id)
|
||||
}
|
||||
|
||||
@@ -286,6 +395,9 @@ pub unsafe extern "C" fn dc_get_fresh_msg_cnt(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
chat_id: libc::uint32_t,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_get_fresh_msg_cnt(context, chat_id)
|
||||
}
|
||||
|
||||
@@ -293,6 +405,9 @@ pub unsafe extern "C" fn dc_get_fresh_msg_cnt(
|
||||
pub unsafe extern "C" fn dc_get_fresh_msgs(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_context::dc_get_fresh_msgs(context)
|
||||
}
|
||||
|
||||
@@ -301,11 +416,17 @@ pub unsafe extern "C" fn dc_marknoticed_chat(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
chat_id: libc::uint32_t,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_marknoticed_chat(context, chat_id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_marknoticed_all_chats(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_marknoticed_all_chats(context)
|
||||
}
|
||||
|
||||
@@ -317,6 +438,9 @@ pub unsafe extern "C" fn dc_get_chat_media(
|
||||
or_msg_type2: libc::c_int,
|
||||
or_msg_type3: libc::c_int,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_get_chat_media(context, chat_id, msg_type, or_msg_type2, or_msg_type3)
|
||||
}
|
||||
|
||||
@@ -329,6 +453,9 @@ pub unsafe extern "C" fn dc_get_next_media(
|
||||
or_msg_type2: libc::c_int,
|
||||
or_msg_type3: libc::c_int,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_get_next_media(context, msg_id, dir, msg_type, or_msg_type2, or_msg_type3)
|
||||
}
|
||||
|
||||
@@ -338,6 +465,9 @@ pub unsafe extern "C" fn dc_archive_chat(
|
||||
chat_id: libc::uint32_t,
|
||||
archive: libc::c_int,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_archive_chat(context, chat_id, archive)
|
||||
}
|
||||
|
||||
@@ -346,6 +476,9 @@ pub unsafe extern "C" fn dc_delete_chat(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
chat_id: libc::uint32_t,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_delete_chat(context, chat_id)
|
||||
}
|
||||
|
||||
@@ -354,6 +487,9 @@ pub unsafe extern "C" fn dc_get_chat_contacts(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
chat_id: libc::uint32_t,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_get_chat_contacts(context, chat_id)
|
||||
}
|
||||
|
||||
@@ -363,14 +499,20 @@ pub unsafe extern "C" fn dc_search_msgs(
|
||||
chat_id: libc::uint32_t,
|
||||
query: *mut libc::c_char,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_context::dc_search_msgs(context, chat_id, query)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_chat(
|
||||
pub unsafe extern "C" fn dc_get_chat<'a>(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
chat_id: libc::uint32_t,
|
||||
) -> *mut dc_chat::dc_chat_t {
|
||||
) -> *mut dc_chat::dc_chat_t<'a> {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_get_chat(context, chat_id)
|
||||
}
|
||||
|
||||
@@ -380,6 +522,9 @@ pub unsafe extern "C" fn dc_create_group_chat(
|
||||
verified: libc::c_int,
|
||||
name: *mut libc::c_char,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_create_group_chat(context, verified, name)
|
||||
}
|
||||
|
||||
@@ -389,6 +534,9 @@ pub unsafe extern "C" fn dc_is_contact_in_chat(
|
||||
chat_id: libc::uint32_t,
|
||||
contact_id: libc::uint32_t,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_is_contact_in_chat(context, chat_id, contact_id)
|
||||
}
|
||||
|
||||
@@ -398,6 +546,9 @@ pub unsafe extern "C" fn dc_add_contact_to_chat(
|
||||
chat_id: libc::uint32_t,
|
||||
contact_id: libc::uint32_t,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_add_contact_to_chat(context, chat_id, contact_id)
|
||||
}
|
||||
|
||||
@@ -407,6 +558,9 @@ pub unsafe extern "C" fn dc_remove_contact_from_chat(
|
||||
chat_id: libc::uint32_t,
|
||||
contact_id: libc::uint32_t,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_remove_contact_from_chat(context, chat_id, contact_id)
|
||||
}
|
||||
|
||||
@@ -416,6 +570,9 @@ pub unsafe extern "C" fn dc_set_chat_name(
|
||||
chat_id: libc::uint32_t,
|
||||
name: *mut libc::c_char,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_set_chat_name(context, chat_id, name)
|
||||
}
|
||||
|
||||
@@ -425,6 +582,9 @@ pub unsafe extern "C" fn dc_set_chat_profile_image(
|
||||
chat_id: libc::uint32_t,
|
||||
image: *mut libc::c_char,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_set_chat_profile_image(context, chat_id, image)
|
||||
}
|
||||
|
||||
@@ -433,6 +593,9 @@ pub unsafe extern "C" fn dc_get_msg_info(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
msg_id: libc::uint32_t,
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_msg::dc_get_msg_info(context, msg_id)
|
||||
}
|
||||
|
||||
@@ -441,6 +604,9 @@ pub unsafe extern "C" fn dc_get_mime_headers(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
msg_id: libc::uint32_t,
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_msg::dc_get_mime_headers(context, msg_id)
|
||||
}
|
||||
|
||||
@@ -450,6 +616,9 @@ pub unsafe extern "C" fn dc_delete_msgs(
|
||||
msg_ids: *const libc::uint32_t,
|
||||
msg_cnt: libc::c_int,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_msg::dc_delete_msgs(context, msg_ids, msg_cnt)
|
||||
}
|
||||
|
||||
@@ -460,6 +629,9 @@ pub unsafe extern "C" fn dc_forward_msgs(
|
||||
msg_cnt: libc::c_int,
|
||||
chat_id: libc::uint32_t,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_chat::dc_forward_msgs(context, msg_ids, msg_cnt, chat_id)
|
||||
}
|
||||
|
||||
@@ -468,6 +640,9 @@ pub unsafe extern "C" fn dc_marknoticed_contact(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
contact_id: libc::uint32_t,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_marknoticed_contact(context, contact_id)
|
||||
}
|
||||
|
||||
@@ -477,6 +652,9 @@ pub unsafe extern "C" fn dc_markseen_msgs(
|
||||
msg_ids: *const libc::uint32_t,
|
||||
msg_cnt: libc::c_int,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_msg::dc_markseen_msgs(context, msg_ids, msg_cnt)
|
||||
}
|
||||
|
||||
@@ -487,14 +665,20 @@ pub unsafe extern "C" fn dc_star_msgs(
|
||||
msg_cnt: libc::c_int,
|
||||
star: libc::c_int,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_msg::dc_star_msgs(context, msg_ids, msg_cnt, star)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_msg(
|
||||
pub unsafe extern "C" fn dc_get_msg<'a>(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
msg_id: libc::uint32_t,
|
||||
) -> *mut dc_msg::dc_msg_t {
|
||||
) -> *mut dc_msg::dc_msg_t<'a> {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_msg::dc_get_msg(context, msg_id)
|
||||
}
|
||||
|
||||
@@ -508,6 +692,9 @@ pub unsafe extern "C" fn dc_lookup_contact_id_by_addr(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
addr: *mut libc::c_char,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_lookup_contact_id_by_addr(context, addr)
|
||||
}
|
||||
|
||||
@@ -517,6 +704,9 @@ pub unsafe extern "C" fn dc_create_contact(
|
||||
name: *mut libc::c_char,
|
||||
addr: *mut libc::c_char,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_create_contact(context, name, addr)
|
||||
}
|
||||
|
||||
@@ -525,6 +715,9 @@ pub unsafe extern "C" fn dc_add_address_book(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
addr_book: *mut libc::c_char,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_add_address_book(context, addr_book)
|
||||
}
|
||||
|
||||
@@ -534,11 +727,17 @@ pub unsafe extern "C" fn dc_get_contacts(
|
||||
flags: libc::uint32_t,
|
||||
query: *mut libc::c_char,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_get_contacts(context, flags, query)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_blocked_cnt(context: *mut dc_context::dc_context_t) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_get_blocked_cnt(context)
|
||||
}
|
||||
|
||||
@@ -546,6 +745,9 @@ pub unsafe extern "C" fn dc_get_blocked_cnt(context: *mut dc_context::dc_context
|
||||
pub unsafe extern "C" fn dc_get_blocked_contacts(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_get_blocked_contacts(context)
|
||||
}
|
||||
|
||||
@@ -555,6 +757,9 @@ pub unsafe extern "C" fn dc_block_contact(
|
||||
contact_id: libc::uint32_t,
|
||||
block: libc::c_int,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_block_contact(context, contact_id, block)
|
||||
}
|
||||
|
||||
@@ -563,6 +768,9 @@ pub unsafe extern "C" fn dc_get_contact_encrinfo(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
contact_id: libc::uint32_t,
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_get_contact_encrinfo(context, contact_id)
|
||||
}
|
||||
|
||||
@@ -571,14 +779,20 @@ pub unsafe extern "C" fn dc_delete_contact(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
contact_id: libc::uint32_t,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_delete_contact(context, contact_id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_contact(
|
||||
pub unsafe extern "C" fn dc_get_contact<'a>(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
contact_id: libc::uint32_t,
|
||||
) -> *mut dc_contact::dc_contact_t {
|
||||
) -> *mut dc_contact::dc_contact_t<'a> {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_contact::dc_get_contact(context, contact_id)
|
||||
}
|
||||
|
||||
@@ -589,6 +803,9 @@ pub unsafe extern "C" fn dc_imex(
|
||||
param1: *mut libc::c_char,
|
||||
param2: *mut libc::c_char,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_imex::dc_imex(context, what, param1, param2)
|
||||
}
|
||||
|
||||
@@ -597,6 +814,9 @@ pub unsafe extern "C" fn dc_imex_has_backup(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
dir: *mut libc::c_char,
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_imex::dc_imex_has_backup(context, dir)
|
||||
}
|
||||
|
||||
@@ -604,6 +824,9 @@ pub unsafe extern "C" fn dc_imex_has_backup(
|
||||
pub unsafe extern "C" fn dc_initiate_key_transfer(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_imex::dc_initiate_key_transfer(context)
|
||||
}
|
||||
|
||||
@@ -613,11 +836,17 @@ pub unsafe extern "C" fn dc_continue_key_transfer(
|
||||
msg_id: libc::uint32_t,
|
||||
setup_code: *mut libc::c_char,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_imex::dc_continue_key_transfer(context, msg_id, setup_code)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_stop_ongoing_process(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_configure::dc_stop_ongoing_process(context)
|
||||
}
|
||||
|
||||
@@ -626,6 +855,9 @@ pub unsafe extern "C" fn dc_check_qr(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
qr: *mut libc::c_char,
|
||||
) -> *mut dc_lot::dc_lot_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_qr::dc_check_qr(context, qr)
|
||||
}
|
||||
|
||||
@@ -634,6 +866,9 @@ pub unsafe extern "C" fn dc_get_securejoin_qr(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
chat_id: libc::uint32_t,
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_securejoin::dc_get_securejoin_qr(context, chat_id)
|
||||
}
|
||||
|
||||
@@ -642,6 +877,9 @@ pub unsafe extern "C" fn dc_join_securejoin(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
qr: *mut libc::c_char,
|
||||
) -> libc::uint32_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_securejoin::dc_join_securejoin(context, qr)
|
||||
}
|
||||
|
||||
@@ -651,6 +889,9 @@ pub unsafe extern "C" fn dc_send_locations_to_chat(
|
||||
chat_id: libc::uint32_t,
|
||||
seconds: libc::c_int,
|
||||
) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_location::dc_send_locations_to_chat(context, chat_id, seconds)
|
||||
}
|
||||
|
||||
@@ -659,6 +900,9 @@ pub unsafe extern "C" fn dc_is_sending_locations_to_chat(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
chat_id: libc::uint32_t,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_location::dc_is_sending_locations_to_chat(context, chat_id)
|
||||
}
|
||||
|
||||
@@ -669,6 +913,9 @@ pub unsafe extern "C" fn dc_set_location(
|
||||
longitude: libc::c_double,
|
||||
accuracy: libc::c_double,
|
||||
) -> libc::c_int {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_location::dc_set_location(context, latitude, longitude, accuracy)
|
||||
}
|
||||
|
||||
@@ -680,11 +927,17 @@ pub unsafe extern "C" fn dc_get_locations(
|
||||
timestamp_begin: libc::time_t,
|
||||
timestamp_end: libc::time_t,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_location::dc_get_locations(context, chat_id, contact_id, timestamp_begin, timestamp_end)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_delete_all_locations(context: *mut dc_context::dc_context_t) {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_location::dc_delete_all_locations(context)
|
||||
}
|
||||
|
||||
@@ -809,7 +1062,7 @@ pub unsafe extern "C" fn dc_array_get_raw(array: *const dc_array_t) -> *const li
|
||||
// dc_chatlist_t
|
||||
|
||||
#[no_mangle]
|
||||
pub type dc_chatlist_t = dc_chatlist::dc_chatlist_t;
|
||||
pub type dc_chatlist_t<'a> = dc_chatlist::dc_chatlist_t<'a>;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_chatlist_unref(chatlist: *mut dc_chatlist::dc_chatlist_t) {
|
||||
@@ -840,10 +1093,10 @@ pub unsafe extern "C" fn dc_chatlist_get_msg_id(
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_chatlist_get_summary(
|
||||
chatlist: *mut dc_chatlist::dc_chatlist_t,
|
||||
pub unsafe extern "C" fn dc_chatlist_get_summary<'a>(
|
||||
chatlist: *mut dc_chatlist::dc_chatlist_t<'a>,
|
||||
index: libc::size_t,
|
||||
chat: *mut dc_chat::dc_chat_t,
|
||||
chat: *mut dc_chat::dc_chat_t<'a>,
|
||||
) -> *mut dc_lot::dc_lot_t {
|
||||
dc_chatlist::dc_chatlist_get_summary(chatlist, index, chat)
|
||||
}
|
||||
@@ -851,14 +1104,15 @@ pub unsafe extern "C" fn dc_chatlist_get_summary(
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_chatlist_get_context(
|
||||
chatlist: *mut dc_chatlist::dc_chatlist_t,
|
||||
) -> *mut dc_context::dc_context_t {
|
||||
dc_chatlist::dc_chatlist_get_context(chatlist)
|
||||
) -> *const dc_context::dc_context_t {
|
||||
assert!(!chatlist.is_null());
|
||||
(*chatlist).context as *const _
|
||||
}
|
||||
|
||||
// dc_chat_t
|
||||
|
||||
#[no_mangle]
|
||||
pub type dc_chat_t = dc_chat::dc_chat_t;
|
||||
pub type dc_chat_t<'a> = dc_chat::dc_chat_t<'a>;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_chat_unref(chat: *mut dc_chat::dc_chat_t) {
|
||||
@@ -927,13 +1181,16 @@ pub unsafe extern "C" fn dc_chat_is_sending_locations(
|
||||
// dc_msg_t
|
||||
|
||||
#[no_mangle]
|
||||
pub type dc_msg_t = dc_msg::dc_msg_t;
|
||||
pub type dc_msg_t<'a> = dc_msg::dc_msg_t<'a>;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_msg_new(
|
||||
pub unsafe extern "C" fn dc_msg_new<'a>(
|
||||
context: *mut dc_context::dc_context_t,
|
||||
viewtype: libc::c_int,
|
||||
) -> *mut dc_msg::dc_msg_t {
|
||||
) -> *mut dc_msg::dc_msg_t<'a> {
|
||||
assert!(!context.is_null());
|
||||
let context = &*context;
|
||||
|
||||
dc_msg::dc_msg_new(context, viewtype)
|
||||
}
|
||||
|
||||
@@ -1145,7 +1402,7 @@ pub unsafe extern "C" fn dc_msg_latefiling_mediasize(
|
||||
// dc_contact_t
|
||||
|
||||
#[no_mangle]
|
||||
pub type dc_contact_t = dc_contact::dc_contact_t;
|
||||
pub type dc_contact_t<'a> = dc_contact::dc_contact_t<'a>;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_contact_unref(contact: *mut dc_contact::dc_contact_t) {
|
||||
|
||||
@@ -366,8 +366,3 @@ pub unsafe fn dc_chatlist_get_summary<'a>(
|
||||
dc_chat_unref(chat_to_delete);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pub unsafe fn dc_chatlist_get_context<'a>(chatlist: *mut dc_chatlist_t<'a>) -> &'a dc_context_t {
|
||||
assert!(!chatlist.is_null());
|
||||
(*chatlist).context
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user