commit a15e3d2: [Minor] Restore Lua API

Vsevolod Stakhov vsevolod at rspamd.com
Sun Jul 24 19:42:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-07-24 20:37:15 +0100
URL: https://github.com/rspamd/rspamd/commit/a15e3d27f41d18d917f93c25a1f475f09ad14e41 (HEAD -> master)

[Minor] Restore Lua API

---
 src/lua/lua_config.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 06a22f096..0ab834054 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -2913,13 +2913,31 @@ lua_config_set_peak_cb (lua_State *L)
 static gint
 lua_config_enable_symbol (lua_State *L)
 {
-	return luaL_error (L, "obsoleted method");
+	struct rspamd_config *cfg = lua_check_config (L, 1);
+	const char *sym = luaL_checkstring (L, 2);
+
+	if (!sym || !cfg) {
+		return luaL_error (L, "invalid arguments");
+	}
+
+	rspamd_symcache_enable_symbol_static(cfg->cache, sym);
+
+	return 0;
 }
 
 static gint
 lua_config_disable_symbol (lua_State *L)
 {
-	return luaL_error (L, "obsoleted method");
+	struct rspamd_config *cfg = lua_check_config (L, 1);
+	const char *sym = luaL_checkstring (L, 2);
+
+	if (!sym || !cfg) {
+		return luaL_error (L, "invalid arguments");
+	}
+
+	rspamd_symcache_disable_symbol_static(cfg->cache, sym);
+
+	return 0;
 }
 
 static gint


More information about the Commits mailing list