Skip to content

Commit 19b501c

Browse files
committed
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.
1 parent 3f94638 commit 19b501c

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/imap.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,17 +2106,7 @@ async fn needs_move_to_mvbox(
21062106
// there may be a non-delta device that wants to handle it
21072107
return Ok(false);
21082108
}
2109-
2110-
if headers.get_header_value(HeaderDef::SecureJoin).is_some() {
2111-
Ok(true)
2112-
} else if let Some(parent) = get_prefetch_parent_message(context, headers).await? {
2113-
match parent.is_dc_message {
2114-
MessengerMessage::No => Ok(false),
2115-
MessengerMessage::Yes | MessengerMessage::Reply => Ok(true),
2116-
}
2117-
} else {
2118-
Ok(false)
2119-
}
2109+
Ok(headers.get_header_value(HeaderDef::SecureJoin).is_some() || is_encrypted(headers))
21202110
}
21212111

21222112
/// Try to get the folder meaning by the name of the folder only used if the server does not support XLIST.

src/imap/imap_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const COMBINATIONS_ACCEPTED_CHAT: &[(&str, bool, bool, &str)] = &[
171171
("INBOX", false, false, "INBOX"),
172172
("INBOX", false, true, "INBOX"),
173173
("INBOX", true, false, "INBOX"),
174-
("INBOX", true, true, "INBOX"),
174+
("INBOX", true, true, "DeltaChat"),
175175
("Spam", false, false, "INBOX"),
176176
("Spam", false, true, "INBOX"),
177177
// 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)] = &[
185185
("INBOX", false, false, "INBOX"),
186186
("INBOX", false, true, "INBOX"),
187187
("INBOX", true, false, "INBOX"),
188-
("INBOX", true, true, "INBOX"),
188+
("INBOX", true, true, "DeltaChat"),
189189
("Spam", false, false, "Spam"),
190190
("Spam", false, true, "INBOX"),
191191
("Spam", true, false, "Spam"),

0 commit comments

Comments
 (0)