]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Add routine to simplify headers folding
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 28 Mar 2018 16:56:23 +0000 (17:56 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 28 Mar 2018 17:14:10 +0000 (18:14 +0100)
lualib/lua_util.lua

index 33d7e37144ab738f087f0cb1dd29ec494356ca6b..d97f58175cb255680be8d60355175eb245b8849e 100644 (file)
@@ -21,6 +21,7 @@ limitations under the License.
 
 local exports = {}
 local lpeg = require 'lpeg'
+local rspamd_util = require "rspamd_util"
 
 
 local split_grammar = {}
@@ -420,4 +421,21 @@ end
 
 exports.table_cmp = table_cmp
 
+--[[[
+-- @function lua_util.table_cmp(task, name, value, stop_chars)
+-- Performs header folding
+--]]
+exports.fold_header = function(task, name, value, stop_chars)
+
+  local how
+
+  if task:has_flag("milter") then
+    how = "lf"
+  else
+    how = task:get_newlines_type()
+  end
+
+  return rspamd_util.fold_header(name, value, how, stop_chars)
+end
+
 return exports