aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/metadata_exporter.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-03-08 14:20:51 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-03-09 10:09:19 +0200
commit4e084c21d7d85585901bb208b82e5ba2ddd3ddd5 (patch)
tree470313b3bf846cdbf2a8e4e1c35bd0c98125af2e /src/plugins/lua/metadata_exporter.lua
parentdd74b3b95fde91e02f05da91d5360a5bfd1802f8 (diff)
downloadrspamd-4e084c21d7d85585901bb208b82e5ba2ddd3ddd5.tar.gz
rspamd-4e084c21d7d85585901bb208b82e5ba2ddd3ddd5.zip
[Feature] Additional symbol metadata in metadata exporter
Diffstat (limited to 'src/plugins/lua/metadata_exporter.lua')
-rw-r--r--src/plugins/lua/metadata_exporter.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua
index 90b28193f..7882a265c 100644
--- a/src/plugins/lua/metadata_exporter.lua
+++ b/src/plugins/lua/metadata_exporter.lua
@@ -80,22 +80,22 @@ local function get_general_metadata(task, flatten, no_content)
if ((from or E)[1] or E).addr then
r.from = from[1].addr
end
- local symbols, scores = task:get_symbols()
- if not flatten then
- local symscore = {}
- for i = 1, #symbols do
- local s = {}
- s.name = symbols[i]
- s.score = scores[i]
- table.insert(symscore, s)
- end
- r.symbols = symscore
- else
+ local syminf = task:get_symbols_all()
+ if flatten then
local l = {}
- for i = 1, #symbols do
- table.insert(l, symbols[i] .. '(' .. scores[i] .. ')')
+ for _, sym in ipairs(syminf) do
+ local txt
+ if sym.options then
+ local topt = table.concat(sym.options, ', ')
+ txt = sym.name .. '(' .. sym.score .. ')' .. ' [' .. topt .. ']'
+ else
+ txt = sym.name .. '(' .. sym.score .. ')'
+ end
+ table.insert(l, txt)
end
r.symbols = table.concat(l, '\n')
+ else
+ r.symbols = syminf
end
local function process_header(name)
local hdr = task:get_header_full(name)