aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-08-26 19:19:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-08-26 19:19:20 +0100
commitba2d5a67c87589dbb87cbf9804600ae28670dc8d (patch)
treefa886f507e7f68a43fdf9d611ba085e67c0b8596 /src
parent09e125bdc94c80b0582155d45b055fa84627e20d (diff)
parent26e6cc92cda3ee2f372b81b4929f70a1d43eef39 (diff)
downloadrspamd-ba2d5a67c87589dbb87cbf9804600ae28670dc8d.tar.gz
rspamd-ba2d5a67c87589dbb87cbf9804600ae28670dc8d.zip
Merge pull request #349 from fatalbanana/ipscore
Fix and prettify ip_score output
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/ip_score.lua19
1 files changed, 10 insertions, 9 deletions
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