]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add option for DATE_IN_PAST/DATE_IN_FUTURE symbols 3510/head
authorAnton Yuzhaninov <citrin+git@citrin.ru>
Wed, 7 Oct 2020 10:57:37 +0000 (11:57 +0100)
committerAnton Yuzhaninov <citrin+git@citrin.ru>
Wed, 7 Oct 2020 10:57:37 +0000 (11:57 +0100)
Value for an option is the number of full hours the date of the message
is in the past or future.

rules/misc.lua

index d12e09e2c097a8e9c44f2c55e968a14defc6e8b8..870952c94968bfcdb04449a23d3b276182d734cf 100644 (file)
@@ -76,10 +76,10 @@ local date_id = rspamd_config:register_symbol({
 
     if date_diff > 86400 then
       -- Older than a day
-      task:insert_result('DATE_IN_PAST', 1.0)
+      task:insert_result('DATE_IN_PAST', 1.0, tostring(math.floor(date_diff/3600)))
     elseif -date_diff > 7200 then
       -- More than 2 hours in the future
-      task:insert_result('DATE_IN_FUTURE', 1.0)
+      task:insert_result('DATE_IN_FUTURE', 1.0, tostring(math.floor(-date_diff/3600)))
     end
   end
 })