Add dc_get_chat_encrinfo()

This commit is contained in:
link2xt
2021-02-06 08:43:43 +03:00
committed by link2xt
parent fbec12393d
commit 0cd8710289
5 changed files with 92 additions and 0 deletions

View File

@@ -1322,6 +1322,29 @@ pub unsafe extern "C" fn dc_set_chat_mute_duration(
})
}
#[no_mangle]
pub unsafe extern "C" fn dc_get_chat_encrinfo(
context: *mut dc_context_t,
chat_id: u32,
) -> *mut libc::c_char {
if context.is_null() {
eprintln!("ignoring careless call to dc_get_chat_encrinfo()");
return "".strdup();
}
let ctx = &*context;
block_on(async move {
ChatId::new(chat_id)
.get_encryption_info(&ctx)
.await
.map(|s| s.strdup())
.unwrap_or_else(|e| {
error!(&ctx, "{}", e);
ptr::null_mut()
})
})
}
#[no_mangle]
pub unsafe extern "C" fn dc_get_chat_ephemeral_timer(
context: *mut dc_context_t,