From 8cf82404ac51170602b95105a0fe9597819cb00c Mon Sep 17 00:00:00 2001 From: Tom Hendrikx Date: Sat, 16 Nov 2013 13:39:11 +0100 Subject: [PATCH 1/2] Minor fixes for dspam_ plugin --- plugins/dspam/dspam_ | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/dspam/dspam_ b/plugins/dspam/dspam_ index f1771a06..5f95927e 100755 --- a/plugins/dspam/dspam_ +++ b/plugins/dspam/dspam_ @@ -234,13 +234,17 @@ update_statefile() { debug starting $dspam_stats -t -S local t_start=$(date +%s) - $dspam_stats -t -S | while read a b c d e f g h i j k l x; do + $dspam_stats -t -S | while read a b c d e f g h i j k l m x; do # example of output format (3.9.1 rc1) for each user: #username@example.org # TP: 0 TN: 2147 FP: 0 FN: 53 SC: 0 NC: 0 # SHR: 0.00% HSR: 0.00% OCA: 97.59% + # or for short user names: + #vmail TP: 1141 TN: 459 FP: 0 FN: 5 SC: 0 NC: 0 + # SHR: 99.56% HSR: 0.00% OCA: 99.69% + case $a in TP:) # the 2nd line @@ -262,6 +266,8 @@ update_statefile() { *) # the 1st line local uid=$a + # data from 2nd line is also here + [ "$b" = "TP:" ] && local tp=$c tn=$e fp=$g fn=$i sc=$k nc=$m ;; esac done @@ -495,7 +501,7 @@ print_fetch() { if [ -n "$pattern" ]; then debug env.pattern was set, so use it: $pattern continue - elif [ $target == "ALL" ]; then + elif [ $target = "ALL" ]; then local pattern="-v TOTAL" debug target=ALL: need pattern for all users, but not for TOTAL: $pattern else From 22c41cd6c8b7adf6eec33783b2c8d80c9182704b Mon Sep 17 00:00:00 2001 From: Tom Hendrikx Date: Sat, 16 Nov 2013 18:35:34 +0100 Subject: [PATCH 2/2] Found another problem with variable handling, when it contains a dash --- plugins/dspam/dspam_activity | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/dspam/dspam_activity b/plugins/dspam/dspam_activity index 6cae2b65..39ffd5bf 100755 --- a/plugins/dspam/dspam_activity +++ b/plugins/dspam/dspam_activity @@ -175,8 +175,8 @@ print_config() { echo graph_period minute for activity in I S W V O A M F N C; do - local label=$(get_activity_description $activity short) - local info=$(get_activity_description $activity long) + local label="$(get_activity_description $activity short)" + local info="$(get_activity_description $activity long)" echo $activity.label $label echo $activity.info $info echo $activity.draw AREASTACK