aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-08 17:06:03 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-08 17:06:03 +0000
commitc02521c917656a056f7786493d632bf10cce3791 (patch)
tree85377f6a21ac52e8e4c05ab28670e0abd7cfe7ff /src
parent683d3bf11ddb89e0ffe762dc6dae1c834f789453 (diff)
downloadrspamd-c02521c917656a056f7786493d632bf10cce3791.tar.gz
rspamd-c02521c917656a056f7786493d632bf10cce3791.zip
[Minor] Lua_task: Add topointer method
Diffstat (limited to 'src')
-rw-r--r--src/libserver/dkim.h2
-rw-r--r--src/lua/lua_task.c24
2 files changed, 24 insertions, 2 deletions
diff --git a/src/libserver/dkim.h b/src/libserver/dkim.h
index d57c923bb..fe2b4cc4e 100644
--- a/src/libserver/dkim.h
+++ b/src/libserver/dkim.h
@@ -101,8 +101,6 @@ typedef struct rspamd_dkim_sign_context_s rspamd_dkim_sign_context_t;
struct rspamd_dkim_key_s;
typedef struct rspamd_dkim_key_s rspamd_dkim_key_t;
-
-struct rspamd_dkim_key_s;
typedef struct rspamd_dkim_key_s rspamd_dkim_sign_key_t;
struct rspamd_task;
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index c4e1b6d92..90cb1f689 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -986,6 +986,13 @@ LUA_FUNCTION_DEF (task, get_stat_tokens);
*/
LUA_FUNCTION_DEF (task, lookup_words);
+/**
+ * @method task:topointer()
+ *
+ * Returns raw C pointer (lightuserdata) associated with task
+ */
+LUA_FUNCTION_DEF (task, topointer);
+
static const struct luaL_reg tasklib_f[] = {
LUA_INTERFACE_DEF (task, load_from_file),
LUA_INTERFACE_DEF (task, load_from_string),
@@ -1091,6 +1098,7 @@ static const struct luaL_reg tasklib_m[] = {
LUA_INTERFACE_DEF (task, get_stat_tokens),
LUA_INTERFACE_DEF (task, get_meta_words),
LUA_INTERFACE_DEF (task, lookup_words),
+ LUA_INTERFACE_DEF (task, topointer),
{"__tostring", rspamd_lua_class_tostring},
{NULL, NULL}
};
@@ -5434,6 +5442,22 @@ lua_task_lookup_words (lua_State *L)
return 1;
}
+static gint
+lua_task_topointer (lua_State *L)
+{
+ LUA_TRACE_POINT;
+ struct rspamd_task *task = lua_check_task (L, 1);
+
+ if (task) {
+ lua_pushlightuserdata (L, task);
+ }
+ else {
+ return luaL_error (L, "invalid arguments");
+ }
+
+ return 1;
+}
+
/* Image functions */
static gint