Sync heuristically_parse_ndn() and maybe_ndn in prefetch_should_download()

This commit is contained in:
Hocuri
2020-06-17 10:46:18 +02:00
parent 8ca55b0f60
commit 8c2af132c8

View File

@@ -903,16 +903,13 @@ impl MimeMessage {
/// If you improve heuristics here you might also have to change prefetch_should_download() in imap/mod.rs. /// If you improve heuristics here you might also have to change prefetch_should_download() in imap/mod.rs.
/// Also you should add a test in dc_receive_imf.rs (there already are lots of test_parse_ndn_* tests). /// Also you should add a test in dc_receive_imf.rs (there already are lots of test_parse_ndn_* tests).
async fn heuristically_parse_ndn(&mut self, context: &Context) -> Option<()> { async fn heuristically_parse_ndn(&mut self, context: &Context) -> Option<()> {
if self let maybe_ndn = if let Some(from) = self.get(HeaderDef::From_) {
.get(HeaderDef::Subject)? let from = from.to_ascii_lowercase();
.to_ascii_lowercase() from.contains("mailer-daemon") || from.contains("mail-daemon")
.contains("fail") } else {
&& self false
.get(HeaderDef::From_)? };
.to_ascii_lowercase() if maybe_ndn && self.failure_report.is_none() {
.contains("mailer-daemon")
&& self.failure_report.is_none()
{
lazy_static! { lazy_static! {
static ref RE: regex::Regex = regex::Regex::new(r"Message-ID:(.*)").unwrap(); static ref RE: regex::Regex = regex::Regex::new(r"Message-ID:(.*)").unwrap();
} }