From 5ab03bbbeee301b79a60443f446130affaf72d3f Mon Sep 17 00:00:00 2001 From: Mira Limbeck Date: Fri, 15 May 2020 16:49:05 +0200 Subject: [PATCH] print blocked/quarantined entries if accepted mail exists In the case of before-queue filtering we have the separation 'QEntry' for accepted mails, as those are the only ones with a queue. And 'SEntry' for blocked and quarantined mails. But if a mail is accepted for one address, but at the same time blocked or quarantined for another address we previously discarded those entries. To fix it we now print it in the 'QEntry' if the attached filter contains blocked and/or quarantined mails. Signed-off-by: Mira Limbeck --- src/main.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main.rs b/src/main.rs index 7e7d746..24e21c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1481,6 +1481,34 @@ impl QEntry { } } + if self.bq_filtered { + if let Some(fe) = &fe { + if fe.borrow().finished && fe.borrow().is_bq { + fe.borrow_mut().to_entries.retain(|to| { + for to2 in self.to_entries.iter().rev() { + if to.to == to2.to { + return false; + } + } + true + }); + + for to in fe.borrow().to_entries.iter().rev() { + parser.write_all_ok(format!("TO:{:X}:", to.timestamp as i32,)); + parser.write_all_ok(&self.qid); + parser.write_all_ok(format!(":{}: from <", to.dstatus)); + parser.write_all_ok(&self.from); + parser.write_all_ok(b"> to <"); + parser.write_all_ok(&to.to); + parser.write_all_ok(b"> ("); + parser.write_all_ok(&to.relay); + parser.write_all_ok(b")\n"); + parser.count += 1; + } + } + } + } + // print logs if '-vv' is specified if parser.options.verbose > 1 { let print_log = |parser: &mut Parser, logs: &Vec<(Box<[u8]>, u64)>| {