From e95e40c94f006cf7a7a7681cead9cd0d44ba4304 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Sun, 9 Nov 2025 04:47:16 -0300 Subject: [PATCH] feat: Move all encrypted messages to mvbox if MvboxMove is on Before, only replies to chat messages were moved to the mvbox because we're removing Chat-Version from outer headers, but there's no much sense in moving only replies and not moving original messages and MDNs. Instead, move all encrypted messages. Users should be informed about this in UIs, so if a user has another PGP-capable MUA, probably they should disable MvboxMove. Moreover, untying this logic from References and In-Reply-To allows to remove them from outer headers too, the "Header Protection for Cryptographically Protected Email" RFC even suggests such a behavior: https://datatracker.ietf.org/doc/html/rfc9788#name-offering-more-ambitious-hea. --- src/imap.rs | 12 +----------- src/imap/imap_tests.rs | 4 ++-- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/imap.rs b/src/imap.rs index a99c22833..3f083af58 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -2106,17 +2106,7 @@ async fn needs_move_to_mvbox( // there may be a non-delta device that wants to handle it return Ok(false); } - - if headers.get_header_value(HeaderDef::SecureJoin).is_some() { - Ok(true) - } else if let Some(parent) = get_prefetch_parent_message(context, headers).await? { - match parent.is_dc_message { - MessengerMessage::No => Ok(false), - MessengerMessage::Yes | MessengerMessage::Reply => Ok(true), - } - } else { - Ok(false) - } + Ok(headers.get_header_value(HeaderDef::SecureJoin).is_some() || is_encrypted(headers)) } /// Try to get the folder meaning by the name of the folder only used if the server does not support XLIST. diff --git a/src/imap/imap_tests.rs b/src/imap/imap_tests.rs index 4133f1d7b..03a4702dc 100644 --- a/src/imap/imap_tests.rs +++ b/src/imap/imap_tests.rs @@ -171,7 +171,7 @@ const COMBINATIONS_ACCEPTED_CHAT: &[(&str, bool, bool, &str)] = &[ ("INBOX", false, false, "INBOX"), ("INBOX", false, true, "INBOX"), ("INBOX", true, false, "INBOX"), - ("INBOX", true, true, "INBOX"), + ("INBOX", true, true, "DeltaChat"), ("Spam", false, false, "INBOX"), ("Spam", false, true, "INBOX"), // Move unencrypted emails in accepted chats from Spam to INBOX, not 100% sure on this, we could @@ -185,7 +185,7 @@ const COMBINATIONS_REQUEST: &[(&str, bool, bool, &str)] = &[ ("INBOX", false, false, "INBOX"), ("INBOX", false, true, "INBOX"), ("INBOX", true, false, "INBOX"), - ("INBOX", true, true, "INBOX"), + ("INBOX", true, true, "DeltaChat"), ("Spam", false, false, "Spam"), ("Spam", false, true, "INBOX"), ("Spam", true, false, "Spam"),