add ffi function

This commit is contained in:
Sebastian Klähn
2022-09-14 15:20:54 +02:00
committed by Septias
parent 662f0b9a1c
commit 35f22d6c23
2 changed files with 31 additions and 0 deletions

View File

@@ -1082,6 +1082,16 @@ int dc_send_webxdc_status_update (dc_context_t* context, uint32_t msg_id, const
*/
char* dc_get_webxdc_status_updates (dc_context_t* context, uint32_t msg_id, uint32_t serial);
/**
* List all webxdc that have updates in the queue
*
* @return An array containing all the msg ids
*
*/
dc_array_t* dc_get_updating_webxdc ();
/**
* Save a draft for a chat in the database.
*

View File

@@ -3302,6 +3302,27 @@ pub unsafe extern "C" fn dc_msg_get_webxdc_info(msg: *mut dc_msg_t) -> *mut libc
})
}
#[no_mangle]
pub unsafe extern "C" fn dc_get_updating_webxdc(
context: *mut dc_context_t,
) -> *mut dc_array::dc_array_t {
if context.is_null() {
eprintln!("ignoring careless call to dc_get_blocked_contacts()");
return ptr::null_mut();
}
let ctx = &*context;
let arr: Vec<MsgId> = block_on(async move {
webxdc::get_busy_webxdc_instances(ctx)
.await
.unwrap_or_default()
.into_iter()
.collect()
});
Box::into_raw(Box::new(dc_array_t::from(arr)))
}
#[no_mangle]
pub unsafe extern "C" fn dc_msg_get_filemime(msg: *mut dc_msg_t) -> *mut libc::c_char {
if msg.is_null() {