From f714cdc21857ac76e2ef44ee6b39e67957b5848f Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 17 Dec 2021 17:35:13 +0100 Subject: [PATCH] Added no/multi from header condition --- FAQ.md | 4 +++- app/src/main/java/eu/faircode/email/EntityRule.java | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index 380d96ba5b..9fcd9d7072 100644 --- a/FAQ.md +++ b/FAQ.md @@ -2407,7 +2407,7 @@ $$flagged$ $$deleted$ ``` -To match *passed* message checks via a header condition (since version 1.1787): +To match *passed* message checks via a header condition (since version 1.1787; no/multi-from since version 1.1791): ``` $$dkim$ @@ -2416,6 +2416,8 @@ $$dmarc$ $$mx$ $$blocklist$ $$replydomain$ +$$nofrom$ +$$multifrom$ ``` Note that *regex* should be disable and that there should be no white space. diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java index f071c1dbbd..8dfde730ad 100644 --- a/app/src/main/java/eu/faircode/email/EntityRule.java +++ b/app/src/main/java/eu/faircode/email/EntityRule.java @@ -283,6 +283,12 @@ public class EntityRule { } else if ("$replydomain".equals(keyword)) { if (!Boolean.TRUE.equals(message.reply_domain)) return false; + } else if ("$nofrom".equals(keyword)) { + if (message.from != null && message.from.length > 0) + return false; + } else if ("$multifrom".equals(keyword)) { + if (message.from == null || message.from.length < 2) + return false; } else { List keywords = new ArrayList<>(); keywords.addAll(Arrays.asList(message.keywords));