Skip to content

Commit

Permalink
Assert that number of timestamps equals sum of To and Chat-Group-Past…
Browse files Browse the repository at this point in the history
…-Members
  • Loading branch information
link2xt committed Jan 5, 2025
1 parent 64bbd7e commit be4c2b9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/mimefactory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,11 @@ impl MimeFactory {
for (name, addr) in &self.recipients {
if let Some(email_to_remove) = email_to_remove {
if email_to_remove == addr {
if name.is_empty() {
past_members.push(Address::new_mailbox(addr.clone()));
} else {
past_members.push(new_address_with_name(name, addr.clone()));
}
continue;
}
}
Expand All @@ -563,6 +568,11 @@ impl MimeFactory {
}
}

debug_assert!(
undisclosed_recipients
|| self.member_timestamps.is_empty()
|| to.len() + past_members.len() == self.member_timestamps.len()
);
if to.is_empty() {
to.push(Address::new_group(
"hidden-recipients".to_string(),
Expand Down

0 comments on commit be4c2b9

Please sign in to comment.