mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
resend messages using the same Message-ID (#3238)
* add dc_resend_msgs() to ffi * add 'resend' to repl * implement resend_msgs() * allow only resending if allowed by chat-protection this means, resending is denied if a chat is protected and we cannot encrypt (normally, however, we should not arrive in that state) * allow only resending of normal, non-info-messages * allow only resending of own messages * reset sending state to OutPending on resending the resulting state is always OutDelivered first, OutMdnRcvd again would be applied when a read receipt is received. preserving old state is doable, however, maybe this simple approach is also good enough, at least for now (or maybe the simple approach is even just fine :) another thing: when we upgrade to resending foreign messages, we do not have a simple way to mark them as pending as incoming message just do not have such a state - but this is sth. for the future.
This commit is contained in:
@@ -1751,6 +1751,27 @@ pub unsafe extern "C" fn dc_forward_msgs(
|
||||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_resend_msgs(
|
||||
context: *mut dc_context_t,
|
||||
msg_ids: *const u32,
|
||||
msg_cnt: libc::c_int,
|
||||
) -> libc::c_int {
|
||||
if context.is_null() || msg_ids.is_null() || msg_cnt <= 0 {
|
||||
eprintln!("ignoring careless call to dc_resend_msgs()");
|
||||
return 0;
|
||||
}
|
||||
let ctx = &*context;
|
||||
let msg_ids = convert_and_prune_message_ids(msg_ids, msg_cnt);
|
||||
|
||||
if let Err(err) = block_on(chat::resend_msgs(ctx, &msg_ids)) {
|
||||
error!(ctx, "Resending failed: {}", err);
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_markseen_msgs(
|
||||
context: *mut dc_context_t,
|
||||
|
||||
Reference in New Issue
Block a user