summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_common.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-03-30 20:54:18 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-03-30 20:54:18 +0400
commite5d0c7f8f6cda246eddfcab82b056650be753fe7 (patch)
tree6a2370ad9e0bd6dbf363ef0cb6927196c832c758 /src/lua/lua_common.c
parent8e09451a57dda5becb741e289a5dbb9890747f8d (diff)
downloadrspamd-e5d0c7f8f6cda246eddfcab82b056650be753fe7.tar.gz
rspamd-e5d0c7f8f6cda246eddfcab82b056650be753fe7.zip
* Implement pre-filters that realizes concepts to check mail by some absolute values like:
- greylisting - DNS BL/WL - ratelimits
Diffstat (limited to 'src/lua/lua_common.c')
-rw-r--r--src/lua/lua_common.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index 8fbff979c..4a62a7d02 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -219,6 +219,22 @@ luaopen_logger (lua_State * L)
return 1;
}
+static void
+lua_add_actions_global (lua_State *L)
+{
+ gint i;
+
+ lua_newtable (L);
+
+ for (i = METRIC_ACTION_REJECT; i <= METRIC_ACTION_NOACTION; i ++) {
+ lua_pushstring (L, str_action_metric (i));
+ lua_pushinteger (L, i);
+ lua_settable (L, -3);
+ }
+ /* Set global table */
+ lua_setglobal (L, "rspamd_actions");
+}
+
void
init_lua (struct config_file *cfg)
{
@@ -253,6 +269,8 @@ init_lua (struct config_file *cfg)
(void)luaopen_http (L);
(void)luaopen_redis (L);
(void)luaopen_upstream (L);
+ (void)lua_add_actions_global (L);
+
cfg->lua_state = L;
memory_pool_add_destructor (cfg->cfg_pool, (pool_destruct_func)lua_close, L);