From: Vsevolod Stakhov Date: Sat, 16 Jun 2018 15:08:58 +0000 (+0100) Subject: [Minor] Add method to get tlds file X-Git-Tag: 1.7.7~97 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e3f81b38fe352591c708512c1ea7b614905a236a;p=rspamd.git [Minor] Add method to get tlds file --- diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 37d122402..4495135c2 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -710,6 +710,13 @@ LUA_FUNCTION_DEF (config, parse_rcl); */ LUA_FUNCTION_DEF (config, init_modules); +/*** + * @method rspamd_config:get_tld_path() + * Returns path to TLD file + * @return {string} path to tld file + */ +LUA_FUNCTION_DEF (config, get_tld_path); + static const struct luaL_reg configlib_m[] = { LUA_INTERFACE_DEF (config, get_module_opt), LUA_INTERFACE_DEF (config, get_mempool), @@ -771,6 +778,7 @@ static const struct luaL_reg configlib_m[] = { LUA_INTERFACE_DEF (config, load_ucl), LUA_INTERFACE_DEF (config, parse_rcl), LUA_INTERFACE_DEF (config, init_modules), + LUA_INTERFACE_DEF (config, get_tld_path), {"__tostring", rspamd_lua_class_tostring}, {"__newindex", lua_config_newindex}, {NULL, NULL} @@ -3411,6 +3419,21 @@ lua_config_init_modules (lua_State *L) return 1; } +static gint +lua_config_get_tld_path (lua_State *L) +{ + struct rspamd_config *cfg = lua_check_config (L, 1); + + if (cfg != NULL) { + lua_pushstring (L, cfg->tld_file); + } + else { + return luaL_error (L, "invalid arguments"); + } + + return 1; +} + static gint lua_monitored_alive (lua_State *L) {