summaryrefslogtreecommitdiffstats
path: root/src/cfg_xml.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-15 18:23:22 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-15 18:23:22 +0400
commitecbbd935773673d8df1f2cb8334b447f7b834b5a (patch)
treef97a716b471f52c3f6e05347c1e7866d497868a4 /src/cfg_xml.c
parent99cd57ba7f0e6b9178ccacc6987b0854ed137d83 (diff)
downloadrspamd-ecbbd935773673d8df1f2cb8334b447f7b834b5a.tar.gz
rspamd-ecbbd935773673d8df1f2cb8334b447f7b834b5a.zip
* Add ability to set metric's action from config file
* Fix bug with writing garbadge if message has no urls or no messages * Fix bug with incorrect behaviour of compare_parts_distance function
Diffstat (limited to 'src/cfg_xml.c')
-rw-r--r--src/cfg_xml.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/cfg_xml.c b/src/cfg_xml.c
index aeb64d1ae..c88bf60db 100644
--- a/src/cfg_xml.c
+++ b/src/cfg_xml.c
@@ -261,6 +261,12 @@ static struct xml_parser_rule grammar[] = {
0,
NULL
},
+ {
+ "action",
+ handle_metric_action,
+ 0,
+ NULL
+ },
NULL_ATTR
},
NULL_ATTR
@@ -667,6 +673,27 @@ worker_handle_bind (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GH
}
gboolean
+handle_metric_action (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, int offset)
+{
+ struct metric *metric = ctx->section_pointer;
+
+ if (g_ascii_strcasecmp (data, "reject") == 0) {
+ metric->action = METRIC_ACTION_REJECT;
+ }
+ else if (g_ascii_strcasecmp (data, "greylist") == 0) {
+ metric->action = METRIC_ACTION_GREYLIST;
+ }
+ else if (g_ascii_strcasecmp (data, "add_header") == 0) {
+ metric->action = METRIC_ACTION_ADD_HEADER;
+ }
+ else {
+ msg_err ("unknown action for metric: %s", data);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+gboolean
handle_metric_symbol (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, int offset)
{
char *strval, *err;