aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-21 09:14:36 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-21 09:14:36 +0100
commit9f7ac8960eb18e4cc152cd52f102f621010b9c36 (patch)
tree1a4444540568e11093bdb849e41e2e61e7834f07 /src
parentc90ebed0c331c71f57eda2d2dcf092e95cdaae45 (diff)
downloadrspamd-9f7ac8960eb18e4cc152cd52f102f621010b9c36.tar.gz
rspamd-9f7ac8960eb18e4cc152cd52f102f621010b9c36.zip
[Feature] Allow underscore separated names in settings
Diffstat (limited to 'src')
-rw-r--r--src/libmime/filter.c23
-rw-r--r--src/libmime/filter.h1
-rw-r--r--src/lua/lua_task.c3
3 files changed, 26 insertions, 1 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index 6aaa19aaf..5b998406f 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -330,6 +330,29 @@ rspamd_action_to_str (enum rspamd_metric_action action)
return "unknown action";
}
+const gchar *
+rspamd_action_to_str_alt (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";
+ case METRIC_ACTION_MAX:
+ return "invalid max action";
+ }
+
+ return "unknown action";
+}
+
enum rspamd_metric_action
rspamd_check_action_metric (struct rspamd_task *task, struct metric_result *mres)
{
diff --git a/src/libmime/filter.h b/src/libmime/filter.h
index 280c54879..6c61f5d6f 100644
--- a/src/libmime/filter.h
+++ b/src/libmime/filter.h
@@ -93,6 +93,7 @@ gboolean rspamd_action_from_str (const gchar *data, gint *result);
* Return textual representation of action enumeration
*/
const gchar * rspamd_action_to_str (enum rspamd_metric_action action);
+const gchar * rspamd_action_to_str_alt (enum rspamd_metric_action action);
/*
* Get action for specific metric
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index a3e3b0564..d18eaa4ea 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -2822,7 +2822,8 @@ lua_task_set_settings (lua_State *L)
}
for (i = 0; i < METRIC_ACTION_MAX; i++) {
- elt = ucl_object_lookup (act, rspamd_action_to_str (i));
+ elt = ucl_object_lookup_any (act, rspamd_action_to_str (i),
+ rspamd_action_to_str_alt (i), NULL);
if (elt) {
mres->actions_limits[i] = ucl_object_todouble (elt);