From: Andrew Lewis Date: Wed, 8 Mar 2017 12:20:51 +0000 (+0200) Subject: [Feature] Additional symbol metadata in metadata exporter X-Git-Tag: 1.5.3~74^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4e084c21d7d85585901bb208b82e5ba2ddd3ddd5;p=rspamd.git [Feature] Additional symbol metadata in metadata exporter --- 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)