From 1dce67d97a586c8556098f2f26709982509af513 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 2 Jun 2017 15:48:45 +0100 Subject: [PATCH] [Minor] More rework in renaming rmilter -> milter --- .../{rmilter_headers.conf => milter_headers.conf} | 7 ++++++- .../lua/{rmilter_headers.lua => milter_headers.lua} | 13 +++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) rename conf/modules.d/{rmilter_headers.conf => milter_headers.conf} (70%) rename src/plugins/lua/{rmilter_headers.lua => milter_headers.lua} (97%) diff --git a/conf/modules.d/rmilter_headers.conf b/conf/modules.d/milter_headers.conf similarity index 70% rename from conf/modules.d/rmilter_headers.conf rename to conf/modules.d/milter_headers.conf index 432057e03..49eef6908 100644 --- a/conf/modules.d/rmilter_headers.conf +++ b/conf/modules.d/milter_headers.conf @@ -15,11 +15,16 @@ rmilter_headers { - # Refer to https://rspamd.com/doc/modules/rmilter_headers.html for information on configuration + # Refer to https://rspamd.com/doc/modules/milter_headers.html for information on configuration use = []; + # Compatibility .include(try=true,priority=5) "${DBDIR}/dynamic/rmilter_headers.conf" .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/rmilter_headers.conf" .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/rmilter_headers.conf" + + .include(try=true,priority=5) "${DBDIR}/dynamic/milter_headers.conf" + .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/milter_headers.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/milter_headers.conf" } diff --git a/src/plugins/lua/rmilter_headers.lua b/src/plugins/lua/milter_headers.lua similarity index 97% rename from src/plugins/lua/rmilter_headers.lua rename to src/plugins/lua/milter_headers.lua index 76002b708..7447cd208 100644 --- a/src/plugins/lua/rmilter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -23,7 +23,7 @@ end local logger = require "rspamd_logger" local util = require "rspamd_util" -local N = 'rmilter_headers' +local N = 'milter_headers' local E = {} local HOSTNAME = util.get_hostname() @@ -103,7 +103,7 @@ local settings = { local active_routines = {} local custom_routines = {} -local function rmilter_headers(task) +local function milter_headers(task) local routines, common, add, remove = {}, {}, {}, {} @@ -303,15 +303,16 @@ local function rmilter_headers(task) if not next(add) then add = nil end if not next(remove) then remove = nil end if add or remove then - task:set_rmilter_reply({ + task:set_milter_reply({ add_headers = add, remove_headers = remove }) end end -local opts = rspamd_config:get_all_opt(N) +local opts = rspamd_config:get_all_opt(N) or rspamd_config:get_all_opt('rmilter_headers') if not opts then return end + if type(opts['use']) == 'string' then opts['use'] = {opts['use']} elseif (type(opts['use']) == 'table' and not opts['use'][1]) then @@ -362,8 +363,8 @@ if (#active_routines < 1) then end logger.infox(rspamd_config, 'active routines [%s]', table.concat(active_routines, ',')) rspamd_config:register_symbol({ - name = 'RMILTER_HEADERS', + name = 'MILTER_HEADERS', type = 'postfilter', - callback = rmilter_headers, + callback = milter_headers, priority = 10 }) -- 2.39.5