From: Andrew Lewis Date: Thu, 7 Sep 2017 19:49:48 +0000 (+0200) Subject: Revert "[Fix] Remove incorrect method `task:set_metric_subject`" X-Git-Tag: 1.6.4~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1bd25528c38d6264450e9db855e377f195e67a27;p=rspamd.git Revert "[Fix] Remove incorrect method `task:set_metric_subject`" This reverts commit e809039a9e84cb6235a6447d1c9c8fc34ddcf8c6. --- diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index c57640162..45202f5ab 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -269,7 +269,7 @@ struct rspamd_metric { gdouble unknown_weight; /**< weight of unknown symbols */ gdouble grow_factor; /**< grow factor for metric */ GHashTable *symbols; /**< weights of symbols in metric */ - const gchar *subject; /**< subject rewrite string */ + gchar *subject; /**< subject rewrite string */ GHashTable * groups; /**< groups of symbols */ struct metric_action actions[METRIC_ACTION_MAX]; /**< all actions of the metric */ }; diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 5e1a6b9db..b026be47e 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -561,6 +561,12 @@ LUA_FUNCTION_DEF (task, set_metric_score); * @param {string} action name to set */ LUA_FUNCTION_DEF (task, set_metric_action); +/*** + * @method task:set_metric_subject(subject) + * Set the subject in the default metric + * @param {string} subject subject to set + */ +LUA_FUNCTION_DEF (task, set_metric_subject); /*** * @method task:learn(is_spam[, classifier) @@ -852,6 +858,7 @@ static const struct luaL_reg tasklib_m[] = { LUA_INTERFACE_DEF (task, get_metric_action), LUA_INTERFACE_DEF (task, set_metric_score), LUA_INTERFACE_DEF (task, set_metric_action), + LUA_INTERFACE_DEF (task, set_metric_subject), LUA_INTERFACE_DEF (task, learn), LUA_INTERFACE_DEF (task, set_settings), LUA_INTERFACE_DEF (task, get_settings),