melib: add Envelope::recipient_any method
Cargo manifest lints / Lint Cargo manifests on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Has been cancelled Details
Run cargo lints / Lint on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Has been cancelled Details
Run Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 7m23s Details

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Manos Pitsidianakis 2024-05-08 20:42:29 +03:00
parent e86610f345
commit 034e4ac403
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
1 changed files with 9 additions and 0 deletions

View File

@ -859,6 +859,15 @@ 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 {}