change api interface

This commit is contained in:
Sebastian Klähn
2022-09-18 12:28:01 +02:00
committed by Septias
parent 81415ce20e
commit e9f77ff753
3 changed files with 13 additions and 15 deletions

View File

@@ -1085,11 +1085,12 @@ char* dc_get_webxdc_status_updates (dc_context_t* context, uint32_t msg_id, uint
/**
* List all webxdc that have updates in the queue
*
* @return An array containing all the msg ids
* @param context The context object.
* @param msg_id The ID of the message with the webxdc instance.
* @return 1=contact ID is member of chat ID, 0=contact is not in chat
*
*/
dc_array_t* dc_get_updating_webxdc ();
int dc_get_updating_webxdc (dc_context_t* context, uint32_t chat_id);
/**

View File

@@ -3303,24 +3303,22 @@ 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(
pub unsafe extern "C" fn dc_is_webxdc_updating(
context: *mut dc_context_t,
) -> *mut dc_array::dc_array_t {
msg_id: u32,
) -> libc::c_int {
if context.is_null() {
eprintln!("ignoring careless call to dc_get_blocked_contacts()");
return ptr::null_mut();
return 0;
}
let ctx = &*context;
let arr: Vec<MsgId> = block_on(async move {
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)))
.contains(&MsgId::new(msg_id)) as libc::c_int
})
}
#[no_mangle]