]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
* Add rules for message's date
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 25 Apr 2011 15:34:38 +0000 (19:34 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 25 Apr 2011 15:34:38 +0000 (19:34 +0400)
conf/lua/rspamd.lua
rspamd.xml.sample

index e85a971d30bf785722811a92b2286d9b218f3bca..203862776f53f319d02b20a7d90f3c0c60a09faf 100644 (file)
@@ -40,6 +40,34 @@ reconf['R_EMPTY_IMAGE'] = function (task)
        return false
 end
 
+-- Date issues
+reconf['DATE_IN_FUTURE'] = function(task)
+       if rspamd_config:get_api_version() >= 5 then
+               local m = task:get_message()
+               local dm = m:get_date()
+               local dt = task:get_date()
+               -- An hour
+               if dm - dt > 3600 then
+                       return true
+               end
+       end
+       
+       return false
+end
+reconf['DATE_IN_PAST'] = function(task)
+       if rspamd_config:get_api_version() >= 5 then
+               local m = task:get_message()
+               local dm = m:get_date()
+               local dt = task:get_date()
+               -- A day
+               if dt - dm > 86400 then
+                       return true
+               end
+       end
+       
+       return false
+end
+
 
 local function file_exists(filename)
        local file = io.open(filename)
index 52e49792691f5dcd16c2590daf1868471e788032..1fadb1229e18b6a4c75b1de2fff04081c10c3ddb 100644 (file)
  <symbol weight="3.0" description="Invalid Postfix Received">INVALID_POSTFIX_RECEIVED</symbol>
  <symbol weight="5.0" description="Invalid Exim Received">INVALID_EXIM_RECEIVED</symbol>
  <symbol weight="3.0" description="Invalid Exim Received">INVALID_EXIM_RECEIVED2</symbol>
+
+ <!-- Date checks -->
+ <symbol weight="1.5" description="Message date is in future">DATE_IN_FUTURE</symbol>
+ <symbol weight="1.0" description="Message date is in past">DATE_IN_PAST</symbol>
 </metric>
 <!-- End of metrics section -->