Skip to content

Commit 490889c

Browse files
committed
feat: send to hidden recipients if the To field is empty
Instead of adding self to the To field, create an empty group in the To field. It is important for group consistency algorithm that if Alice removes Bob from a group consisting only of the Alice and Bob, she sends "member removed" message with empty group in the To field rather than self address in the To field.
1 parent 4ffc0ca commit 490889c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/mimefactory.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,7 @@ impl MimeFactory {
494494
};
495495

496496
let mut to = Vec::new();
497-
if undisclosed_recipients {
498-
to.push(Address::new_group(
499-
"hidden-recipients".to_string(),
500-
Vec::new(),
501-
));
502-
} else {
497+
if !undisclosed_recipients {
503498
let email_to_remove = match &self.loaded {
504499
Loaded::Message { msg, .. } => {
505500
if msg.param.get_cmd() == SystemMessage::MemberRemovedFromGroup {
@@ -524,10 +519,13 @@ impl MimeFactory {
524519
to.push(new_address_with_name(name, addr.clone()));
525520
}
526521
}
522+
}
527523

528-
if to.is_empty() {
529-
to.push(from.clone());
530-
}
524+
if to.is_empty() {
525+
to.push(Address::new_group(
526+
"hidden-recipients".to_string(),
527+
Vec::new(),
528+
));
531529
}
532530

533531
// Start with Internet Message Format headers in the order of the standard example

0 commit comments

Comments
 (0)