mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 23:36:30 +03:00
WIP: api!: add LIMIT arg to get_chat_media
In Delta Chat desktop we show the 3 recently used WebXDC apps, which relies on `get_chat_media`, which is quite expensive. Hopefully adding `LIMIT 3` makes it faster. Marking this as a breaking change because it's breaking TypeScript-wise, but shouldn't be breaking behavior-wise, because not providing the argument in JSON-RPC should be equivalent to providing `null` (which gets converted to `None`). TODO: - [ ] Add to CFFI? - [ ] Docs. Both the core fn and the JSON-RPC.
This commit is contained in:
@@ -1532,6 +1532,7 @@ pub unsafe extern "C" fn dc_get_chat_media(
|
||||
msg_type: libc::c_int,
|
||||
or_msg_type2: libc::c_int,
|
||||
or_msg_type3: libc::c_int,
|
||||
// limit: u32,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
if context.is_null() {
|
||||
eprintln!("ignoring careless call to dc_get_chat_media()");
|
||||
@@ -1551,7 +1552,7 @@ pub unsafe extern "C" fn dc_get_chat_media(
|
||||
|
||||
block_on(async move {
|
||||
Box::into_raw(Box::new(
|
||||
chat::get_chat_media(ctx, chat_id, msg_type, or_msg_type2, or_msg_type3)
|
||||
chat::get_chat_media(ctx, chat_id, msg_type, or_msg_type2, or_msg_type3, None)
|
||||
.await
|
||||
.unwrap_or_log_default(ctx, "Failed get_chat_media")
|
||||
.into(),
|
||||
|
||||
Reference in New Issue
Block a user