Function to get delete recipe
authorJamie Cameron <jcameron@webmin.com>
Wed, 27 Feb 2008 01:24:00 +0000 (01:24 +0000)
committerJamie Cameron <jcameron@webmin.com>
Wed, 27 Feb 2008 01:24:00 +0000 (01:24 +0000)
spam/spam-lib.pl

index c5f7c5c..ca2b419 100644 (file)
@@ -648,13 +648,13 @@ return undef;
 }
 
 # find_file_recipe(&recipes)
-# Returns the recipe for delivering mail based on the X-Spam-Status header
+# returns the recipe for delivering mail based on the x-spam-status header
 sub find_file_recipe
 {
 local ($r, $c);
 foreach $r (@{$_[0]}) {
        foreach $c (@{$r->{'conds'}}) {
-               if ($c->[1] =~ /X-Spam-Status/i) {
+               if ($c->[1] =~ /x-spam-status/i) {
                        return $r;
                        }
                }
@@ -662,6 +662,22 @@ foreach $r (@{$_[0]}) {
 return undef;
 }
 
+# find_delete_recipe(&recipes)
+# returns the recipe for delete mail based on the x-spam-level header, and
+# the level it deletes at.
+sub find_delete_recipe
+{
+local ($r, $c);
+foreach $r (grep { $_->{'action'} eq '/dev/null' } @{$_[0]}) {
+       foreach $c (@{$r->{'conds'}}) {
+               if ($c->[1] =~ /x-spam-level:\s+((\\\*)+)/i) {
+                       return ($r, length($1)/2);
+                       }
+               }
+       }
+return ( );
+}
+
 # find_virtualmin_recipe(&recipes)
 # Returns the recipe that runs the Virtualmin lookup command
 sub find_virtualmin_recipe