mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
add dc_chatlist_get_summary2() api
needed for how node/js handles the chatlist currently (it convertes the ffi-object to an js-object and throws ffi-object away directly, this makes it hard to access dc_chatlist_get_summary() later.
This commit is contained in:
@@ -38,6 +38,7 @@ mod dc_array;
|
||||
|
||||
mod string;
|
||||
use self::string::*;
|
||||
use deltachat::chatlist::Chatlist;
|
||||
|
||||
// as C lacks a good and portable error handling,
|
||||
// in general, the C Interface is forgiving wrt to bad parameters.
|
||||
@@ -2227,6 +2228,24 @@ pub unsafe extern "C" fn dc_chatlist_get_summary(
|
||||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_chatlist_get_summary2(
|
||||
context: *mut dc_context_t,
|
||||
chat_id: u32,
|
||||
msg_id: u32,
|
||||
) -> *mut dc_lot_t {
|
||||
if context.is_null() {
|
||||
eprintln!("ignoring careless call to dc_chatlist_get_summary2()");
|
||||
return ptr::null_mut();
|
||||
}
|
||||
let ctx = &*context;
|
||||
block_on(async move {
|
||||
let lot =
|
||||
Chatlist::get_summary2(&ctx, ChatId::new(chat_id), MsgId::new(msg_id), None).await;
|
||||
Box::into_raw(Box::new(lot))
|
||||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_chatlist_get_context(
|
||||
chatlist: *mut dc_chatlist_t,
|
||||
|
||||
Reference in New Issue
Block a user