aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-13 12:58:45 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-13 12:58:45 +0000
commit1e9de7b24eb911e318a72b66e27b8f4922d0e2f0 (patch)
treef0958f665f541a5fc4deef930423eafe9f82b80f /src/lua
parentfaefdae249d6646a0ebcca7db9a40c92bb5e4bc7 (diff)
downloadrspamd-1e9de7b24eb911e318a72b66e27b8f4922d0e2f0.tar.gz
rspamd-1e9de7b24eb911e318a72b66e27b8f4922d0e2f0.zip
Add task:get_content() method.
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_task.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 6fee606c4..c830a48ef 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -158,6 +158,12 @@ end
*/
LUA_FUNCTION_DEF (task, get_urls);
/***
+ * @method task:get_content()
+ * Get raw content for the specified task
+ * @return {string} the data contained in the task
+ */
+LUA_FUNCTION_DEF (task, get_content);
+/***
* @method task:get_urls()
* Get all email addresses found in a message.
* @return {table rspamd_url} list of all email addresses found
@@ -434,6 +440,7 @@ static const struct luaL_reg tasklib_m[] = {
LUA_INTERFACE_DEF (task, insert_result),
LUA_INTERFACE_DEF (task, set_pre_result),
LUA_INTERFACE_DEF (task, get_urls),
+ LUA_INTERFACE_DEF (task, get_content),
LUA_INTERFACE_DEF (task, get_emails),
LUA_INTERFACE_DEF (task, get_text_parts),
LUA_INTERFACE_DEF (task, get_parts),
@@ -954,6 +961,20 @@ lua_task_get_urls (lua_State * L)
}
static gint
+lua_task_get_content (lua_State * L)
+{
+ struct rspamd_task *task = lua_check_task (L);
+
+ if (task) {
+ lua_pushlstring (L, task->msg.start, task->msg.len);
+ return 1;
+ }
+
+ lua_pushnil (L);
+ return 1;
+}
+
+static gint
lua_task_get_emails (lua_State * L)
{
struct rspamd_task *task = lua_check_task (L);