melib: add Envelope::recipient_any method

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/390/head
Manos Pitsidianakis 1 month ago
parent 735b44f286
commit 1abce964c7
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -859,6 +859,16 @@ impl Envelope {
pub fn tags_mut(&mut self) -> &mut IndexSet<TagHash> {
&mut self.tags
}
/// Returns `true` if `is_recipient` address is included in To:, Cc: or Bcc:
/// headers.
pub fn recipient_any(&self, is_recipient: &Address) -> bool {
self.to()
.iter()
.chain(self.cc().iter())
.chain(self.bcc().iter())
.any(|a| a == is_recipient)
}
}
impl Eq for Envelope {}

Loading…
Cancel
Save