]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow underscore separated names in settings
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 21 Jul 2016 08:14:36 +0000 (09:14 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 21 Jul 2016 08:14:36 +0000 (09:14 +0100)
src/libmime/filter.c
src/libmime/filter.h
src/lua/lua_task.c

index 6aaa19aaf9807d803d8cbcdb8ccf06ae6738f4bd..5b998406f9bcf356a1e3c9a427f81b20048158cb 100644 (file)
@@ -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)
 {
index 280c54879300d1b06e009b242b4a3bf693def63d..6c61f5d6f10e75130c28696cb795d0e7e1b9fe0a 100644 (file)
@@ -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
index a3e3b0564ed1e147188d46b75d9bd6aafe978f01..d18eaa4eadcf17dfd5f300d93d100cda25360e87 100644 (file)
@@ -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);