mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
Try to extract group ID from In-Reply-To and References as a last resort
This should help if parent message can't be found because messages were reordered or deleted. This does not prevent group IDs from being removed from Message-IDs in the future, in which case it will become dead code.
This commit is contained in:
@@ -29,7 +29,9 @@ use crate::mimeparser;
|
||||
use crate::oauth2::dc_get_oauth2_access_token;
|
||||
use crate::param::Params;
|
||||
use crate::provider::Socket;
|
||||
use crate::{chat, scheduler::InterruptInfo, stock::StockMessage};
|
||||
use crate::{
|
||||
chat, dc_tools::dc_extract_grpid_from_rfc724_mid, scheduler::InterruptInfo, stock::StockMessage,
|
||||
};
|
||||
use crate::{config::Config, dc_receive_imf::dc_receive_imf_inner};
|
||||
|
||||
mod client;
|
||||
@@ -38,6 +40,7 @@ pub mod scan_folders;
|
||||
pub mod select_folder;
|
||||
mod session;
|
||||
|
||||
use chat::get_chat_id_by_grpid;
|
||||
use client::Client;
|
||||
use mailparse::SingleInfo;
|
||||
use message::Message;
|
||||
@@ -1611,6 +1614,19 @@ pub(crate) async fn prefetch_should_download(
|
||||
}
|
||||
}
|
||||
|
||||
// Same as previous check, but using group IDs embedded into
|
||||
// Message-IDs as a last resort, in case parent message was
|
||||
// deleted from the database or has not arrived yet.
|
||||
if let Some(rfc724_mid) = headers.get_header_value(HeaderDef::MessageId) {
|
||||
if let Some(group_id) = dc_extract_grpid_from_rfc724_mid(&rfc724_mid) {
|
||||
if let Ok((chat_id, _, _)) = get_chat_id_by_grpid(context, group_id).await {
|
||||
if !chat_id.is_unset() {
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let maybe_ndn = if let Some(from) = headers.get_header_value(HeaderDef::From_) {
|
||||
let from = from.to_ascii_lowercase();
|
||||
from.contains("mailer-daemon") || from.contains("mail-daemon")
|
||||
|
||||
Reference in New Issue
Block a user