#define lua_getuservalue lua_getfenv
#define lua_setuservalue lua_setfenv
+#ifndef lua_rawlen
#define lua_rawlen lua_objlen
+#endif
+#ifndef luaL_setfuncs
#define luaL_setfuncs(L,f,n) luaL_register(L,NULL,f)
+#endif
+#ifndef luaL_newlib
#define luaL_newlib(L,f) luaL_register(L,"lpeg",f)
-
+#endif
#endif
return 1;
}
-static double real_time()
+static double real_time(void)
{
#ifdef _WIN32
if (ticksPerSecond.QuadPart == 0)
lua_task_set_pre_result (lua_State * L)
{
struct rspamd_task *task = lua_check_task (L, 1);
- struct rspamd_config *cfg;
gchar *action_str;
gint action = METRIC_ACTION_MAX;
if (task != NULL) {
- cfg = task->cfg;
if (lua_type (L, 2) == LUA_TNUMBER) {
action = lua_tointeger (L, 2);
else {
task->pre_result.str = "unknown";
}
+
msg_info_task ("<%s>: set pre-result to %s: '%s'",
task->message_id, rspamd_action_to_str (action),
task->pre_result.str);
{
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *action_name;
- struct rspamd_metric_result *metric_res;
gint action;
action_name = luaL_checkstring (L, 2);
static gint
lua_util_readpassphrase (lua_State *L)
{
- const gchar *prompt = NULL;
gchar test_password[8192];
gsize r;
- if (lua_type (L, 1) == LUA_TSTRING) {
- prompt = lua_tostring (L, 1);
- }
-
r = rspamd_read_passphrase (test_password, sizeof (test_password), 0, NULL);
if (r > 0) {