From bfe9ededbc03c4618947bebf0ece372409e0fdf3 Mon Sep 17 00:00:00 2001 From: Pierre Jaury Date: Fri, 19 Aug 2016 21:58:40 +0200 Subject: [PATCH] Fix spam filtering when the score is negative --- dovecot/sieve/before.sieve | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dovecot/sieve/before.sieve b/dovecot/sieve/before.sieve index 00463d70..174f5597 100644 --- a/dovecot/sieve/before.sieve +++ b/dovecot/sieve/before.sieve @@ -9,13 +9,14 @@ require "relational"; require "comparator-i;ascii-numeric"; require "vnd.dovecot.extdata"; -if string :is "${extdata.spam_enabled}" "1" { - if header :matches "X-Spam-Status" "* score=*" { - if string :value "ge" :comparator "i;ascii-numeric" "${2}" "${extdata.spam_threshold}" { - setflag "\\seen"; - fileinto :create "Junk"; - stop; - } +if allof (string :is "${extdata.spam_enabled}" "1", + not header :matches "X-Spam-Status" "* score=-*", + header :matches "X-Spam-Status" "* score=*") +{ + if string :value "ge" :comparator "i;ascii-numeric" "${2}" "${extdata.spam_threshold}" { + setflag "\\seen"; + fileinto :create "Junk"; + stop; } }