]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Feature] Allow skipping local/auth'd mail in default bayes autolearn condition 5679/head
authorAndrew Lewis <nerf@judo.za.org>
Mon, 13 Oct 2025 14:58:53 +0000 (16:58 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 13 Oct 2025 14:58:53 +0000 (16:58 +0200)
lualib/lua_bayes_learn.lua

index 89470edba9b205e29a6112862187aaa39d55c72f..708072827fe102c5a19877c6abc3fa6dd9509488 100644 (file)
@@ -83,6 +83,22 @@ exports.autolearn = function(task, conf)
     return
   end
 
+  -- To retain old behaviour, we check local and authed mail by default
+  local check_local = conf.check_local
+  if check_local == nil then
+    check_local = true
+  end
+  local check_authed = conf.check_authed
+  if check_authed == nil then
+    check_authed = true
+  end
+
+  local skip_conf = {check_local, check_authed}
+  if lua_util.is_skip_local_or_authed(task, skip_conf) then
+    lua_util.debugm(N, task, 'skip autolearn for local or authed network')
+    return
+  end
+
   -- We have autolearn config so let's figure out what is requested
   local verdict, score = lua_verdict.get_specific_verdict("bayes", task)
   local learn_spam, learn_ham = false, false