diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2013-01-09 16:35:03 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2013-01-09 16:35:03 +0400 |
commit | 823c263b9d417a9d28344c469b253e0dfe76e640 (patch) | |
tree | 9b87cc08829c7a66c5b4181848da8baf53fba415 /src/protocol.c | |
parent | 86d52c83c8cb219e503704e4ee762a7633431e36 (diff) | |
download | rspamd-823c263b9d417a9d28344c469b253e0dfe76e640.tar.gz rspamd-823c263b9d417a9d28344c469b253e0dfe76e640.zip |
Add saving of actions, symbols and maps.
Diffstat (limited to 'src/protocol.c')
-rw-r--r-- | src/protocol.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/protocol.c b/src/protocol.c index a303b4285..ab9836e85 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -96,6 +96,28 @@ static GList *custom_commands = NULL; +/* XXX: remove this legacy sometimes */ +static const gchar * +str_action_metric_spamc (enum rspamd_metric_action action) +{ + switch (action) { + case METRIC_ACTION_REJECT: + return "reject"; + case METRIC_ACTION_SOFT_REJECT: + return "soft reject"; + case METRIC_ACTION_REWRITE_SUBJECT: + return "rewrite subject"; + case METRIC_ACTION_ADD_HEADER: + return "add header"; + case METRIC_ACTION_GREYLIST: + return "greylist"; + case METRIC_ACTION_NOACTION: + return "no action"; + } + + return "unknown action"; +} + /* For default metric, dirty hack, but much faster than hash lookup */ static double default_score, default_required_score; @@ -1040,12 +1062,12 @@ print_metric_data_rspamc (struct worker_task *task, gchar *outbuf, gsize size, if (task->pre_result.action == METRIC_ACTION_NOACTION) { r += rspamd_snprintf (outbuf + r, size - r, - "Action: %s" CRLF, str_action_metric ( + "Action: %s" CRLF, str_action_metric_spamc ( METRIC_ACTION_NOACTION)); } else { r += rspamd_snprintf (outbuf + r, size - r, - "Action: %s" CRLF, str_action_metric ( + "Action: %s" CRLF, str_action_metric_spamc ( task->pre_result.action)); if (task->pre_result.str != NULL) { r += rspamd_snprintf (outbuf + r, size - r, @@ -1086,7 +1108,7 @@ print_metric_data_rspamc (struct worker_task *task, gchar *outbuf, gsize size, metric_res->score, ms); } r += rspamd_snprintf (outbuf + r, size - r, - "Action: %s" CRLF, str_action_metric (action)); + "Action: %s" CRLF, str_action_metric_spamc (action)); } if (action == METRIC_ACTION_REWRITE_SUBJECT && metric_res->metric->subject != NULL) { r += rspamd_snprintf (outbuf + r, size - r, |