aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_config.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-12-22 18:08:14 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-12-22 18:08:14 +0300
commit29c3237009537015e66875ab9ce1fbe3e101576b (patch)
treeae47f0223ed9f5c133f60580d9ffc4d811b47fdf /src/lua/lua_config.c
parent501f1465ff2e985def4159ab32de267e7b111624 (diff)
downloadrspamd-29c3237009537015e66875ab9ce1fbe3e101576b.tar.gz
rspamd-29c3237009537015e66875ab9ce1fbe3e101576b.zip
* Add versions to lua API
* Provide compatibility for lua plugins for old versions of rspamd
Diffstat (limited to 'src/lua/lua_config.c')
-rw-r--r--src/lua/lua_config.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index e05545355..b77c97bfc 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -44,6 +44,7 @@ LUA_FUNCTION_DEF (config, register_virtual_symbol);
LUA_FUNCTION_DEF (config, register_callback_symbol);
LUA_FUNCTION_DEF (config, register_post_filter);
LUA_FUNCTION_DEF (config, register_module_option);
+LUA_FUNCTION_DEF (config, get_api_version);
static const struct luaL_reg configlib_m[] = {
LUA_INTERFACE_DEF (config, get_module_opt),
@@ -57,6 +58,7 @@ static const struct luaL_reg configlib_m[] = {
LUA_INTERFACE_DEF (config, register_callback_symbol),
LUA_INTERFACE_DEF (config, register_module_option),
LUA_INTERFACE_DEF (config, register_post_filter),
+ LUA_INTERFACE_DEF (config, get_api_version),
{"__tostring", lua_class_tostring},
{NULL, NULL}
};
@@ -129,6 +131,13 @@ lua_check_trie (lua_State * L)
/*** Config functions ***/
static gint
+lua_config_get_api_version (lua_State *L)
+{
+ lua_pushinteger (L, RSPAMD_LUA_API_VERSION);
+ return 1;
+}
+
+static gint
lua_config_get_module_opt (lua_State * L)
{
struct config_file *cfg = lua_check_config (L);