aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_config.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-03-17 14:21:38 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-03-17 14:21:38 +0000
commite4f459ef31aed15751edd9ae77f6183b7da3b7b4 (patch)
treeede84d963bd7eb5b0718449ac1d6c5a55f2ff89c /src/lua/lua_config.c
parent5dd0ab4ad379dd607ad808ca18cdf2b1032ccfb5 (diff)
downloadrspamd-e4f459ef31aed15751edd9ae77f6183b7da3b7b4.tar.gz
rspamd-e4f459ef31aed15751edd9ae77f6183b7da3b7b4.zip
[Feature] Ppopagate monitored errors from rbl module
Diffstat (limited to 'src/lua/lua_config.c')
-rw-r--r--src/lua/lua_config.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index f42ca268e..fdc572d9d 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -912,12 +912,14 @@ LUA_FUNCTION_DEF (monitored, alive);
LUA_FUNCTION_DEF (monitored, latency);
LUA_FUNCTION_DEF (monitored, offline);
LUA_FUNCTION_DEF (monitored, total_offline);
+LUA_FUNCTION_DEF (monitored, propagate_error);
static const struct luaL_reg monitoredlib_m[] = {
LUA_INTERFACE_DEF (monitored, alive),
LUA_INTERFACE_DEF (monitored, latency),
LUA_INTERFACE_DEF (monitored, offline),
LUA_INTERFACE_DEF (monitored, total_offline),
+ LUA_INTERFACE_DEF (monitored, propagate_error),
{"__tostring", rspamd_lua_class_tostring},
{NULL, NULL}
};
@@ -4631,6 +4633,23 @@ lua_monitored_latency (lua_State *L)
return 1;
}
+static gint
+lua_monitored_propagate_error (lua_State *L)
+{
+ LUA_TRACE_POINT;
+ struct rspamd_monitored *m = lua_check_monitored (L, 1);
+ const gchar *what = luaL_checkstring (L, 2);
+
+ if (m && what) {
+ rspamd_monitored_propagate_error (m, what);
+ }
+ else {
+ return luaL_error (L, "invalid arguments");
+ }
+
+ return 0;
+}
+
void
luaopen_config (lua_State * L)
{