implement deeplink api

This commit is contained in:
B. Petersen
2024-11-18 16:18:42 +01:00
parent d847669309
commit df4466cff9
2 changed files with 122 additions and 17 deletions

View File

@@ -3681,6 +3681,31 @@ pub unsafe extern "C" fn dc_msg_get_info_type(msg: *mut dc_msg_t) -> libc::c_int
ffi_msg.message.get_info_type() as libc::c_int
}
#[no_mangle]
pub unsafe extern "C" fn dc_msg_get_webxdc_deeplink(msg: *mut dc_msg_t) -> *mut libc::c_char {
if msg.is_null() {
eprintln!("ignoring careless call to dc_msg_get_webxdc_deeplink()");
return "".strdup();
}
let ffi_msg = &*msg;
let ctx = &*ffi_msg.context;
let res = block_on(async move {
ffi_msg
.message
.get_webxdc_deeplink(ctx)
.await
.context("failed to get deeplink")
.log_err(ctx)
.unwrap_or(None)
});
match res {
Some(str) => str.strdup(),
None => ptr::null_mut(),
}
}
#[no_mangle]
pub unsafe extern "C" fn dc_msg_is_increation(msg: *mut dc_msg_t) -> libc::c_int {
if msg.is_null() {