aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/lua/milter_headers.lua38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua
index a1d34f92d..d693e8f7f 100644
--- a/src/plugins/lua/milter_headers.lua
+++ b/src/plugins/lua/milter_headers.lua
@@ -180,13 +180,39 @@ local function milter_headers(task)
local function add_header(name, value, stop_chars, order)
if order then
- add[settings.routines[name].header] = {
- order = order,
- value = lua_util.fold_header(task, name, value, stop_chars)
- }
+ if not add[settings.routines[name].header] then
+ add[settings.routines[name].header] = {
+ order = order,
+ value = lua_util.fold_header(task, name, value, stop_chars)
+ }
+ else
+ if not add[settings.routines[name].header][1] then
+ -- Convert to a table
+ add[settings.routines[name].header] = {
+ [1] = add[settings.routines[name].header]
+ }
+ end
+
+ table.insert(add[settings.routines[name].header], {
+ order = order,
+ value = lua_util.fold_header(task, name, value, stop_chars)
+ })
+ end
else
- add[settings.routines[name].header] = lua_util.fold_header(task, name,
- value, stop_chars)
+ if not add[settings.routines[name].header] then
+ add[settings.routines[name].header] = lua_util.fold_header(task, name,
+ value, stop_chars)
+ else
+ if not add[settings.routines[name].header][1] then
+ -- Convert to a table
+ add[settings.routines[name].header] = {
+ [1] = add[settings.routines[name].header]
+ }
+ end
+
+ table.insert(add[settings.routines[name].header],
+ lua_util.fold_header(task, name, value, stop_chars))
+ end
end
end