From 5108314c03fc46dc8fe92b1ba8668bae59f9db70 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 27 Nov 2021 00:00:00 +0000 Subject: [PATCH] Do not return trashed messages from `get_rfc724_mid_in_list` This function is used to lookup the chat by `References` and `In-Reply-To` header, so it does not make sense to return trashed message when there is another non-trashed message in one of these headers with a real chat ID. --- src/dc_receive_imf.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index 7b06d75a8..f557ef294 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -2113,6 +2113,8 @@ fn set_better_msg(mime_parser: &mut MimeMessage, better_msg: impl AsRef) { /// Returns the last message referenced from `References` header if it is in the database. /// /// For Delta Chat messages it is the last message in the chat of the sender. +/// +/// Note that the returned message may be trashed. async fn get_previous_message( context: &Context, mime_parser: &MimeMessage, @@ -2128,6 +2130,8 @@ async fn get_previous_message( } /// Given a list of Message-IDs, returns the latest message found in the database. +/// +/// Only messages that are not in the trash chat are considered. async fn get_rfc724_mid_in_list(context: &Context, mid_list: &str) -> Result> { if mid_list.is_empty() { return Ok(None); @@ -2135,7 +2139,10 @@ async fn get_rfc724_mid_in_list(context: &Context, mid_list: &str) -> Result