From: Andrew Lewis Date: Wed, 26 Aug 2015 15:10:09 +0000 (+0200) Subject: Fix and prettify ip_score output X-Git-Tag: 1.0.0~160^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F349%2Fhead;p=rspamd.git Fix and prettify ip_score output --- diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua index d0129c36a..d2ba8d3ba 100644 --- a/src/plugins/lua/ip_score.lua +++ b/src/plugins/lua/ip_score.lua @@ -253,26 +253,27 @@ local ip_score_check = function(task) ip_score = normalize_score(ip_score, total_ip, options['scores']['ip']) local total_score = 0.0 - local description = '' + local description_t = {} + if ip_score ~= 0 then total_score = total_score + ip_score - description = description .. 'ip,' + table.insert(description_t, 'ip: ' .. '(' .. math.floor(ip_score * 1000) / 100 .. ')') + end + if ipnet_score ~= 0 then + total_score = total_score + ipnet_score + table.insert(description_t, 'ipnet: ' .. ipnet .. '(' .. math.floor(ipnet_score * 1000) / 100 .. ')') end if asn_score ~= 0 then total_score = total_score + asn_score - description = description .. 'asn:' .. asn .. ',' + table.insert(description_t, 'asn: ' .. asn .. '(' .. math.floor(asn_score * 1000) / 100 .. ')') end if country_score ~= 0 then total_score = total_score + country_score - description = description .. 'country:' .. country .. ',' - end - if ipnet_score ~= 0 then - total_score = total_score + ipnet_score - description = description .. 'ipnet:' .. ipnet .. ',' + table.insert(description_t, 'country: ' .. country .. '(' .. math.floor(country_score * 1000) / 100 .. ')') end if total_score ~= 0 then - task:insert_result(options['symbol'], total_score, description) + task:insert_result(options['symbol'], total_score, table.concat(description_t, ', ')) end end end