feat: Hide To header in encrypted messages

This commit is contained in:
link2xt
2025-03-12 03:16:22 +00:00
committed by iequidoo
parent 8eef79f95d
commit 3637fe67a7
4 changed files with 7 additions and 45 deletions

View File

@@ -9,7 +9,7 @@ use data_encoding::BASE32_NOPAD;
use deltachat_contact_tools::sanitize_bidi_characters;
use iroh_gossip::proto::TopicId;
use mail_builder::headers::HeaderType;
use mail_builder::headers::address::{Address, EmailAddress};
use mail_builder::headers::address::Address;
use mail_builder::mime::MimePart;
use tokio::fs;
@@ -993,24 +993,7 @@ impl MimeFactory {
} else if header_name == "to" {
protected_headers.push(header.clone());
if is_encrypted {
let mut to_without_names = to
.clone()
.into_iter()
.filter_map(|header| match header {
Address::Address(mb) => Some(Address::Address(EmailAddress {
name: None,
email: mb.email,
})),
_ => None,
})
.collect::<Vec<_>>();
if to_without_names.is_empty() {
to_without_names.push(hidden_recipients());
}
unprotected_headers.push((
original_header_name,
Address::new_list(to_without_names).into(),
));
unprotected_headers.push(("To", hidden_recipients().into()));
} else {
unprotected_headers.push(header.clone());
}