* @param {rspamd_text/string} value new header's value
*/
LUA_FUNCTION_DEF (task, set_request_header);
+/***
+ * @method task:get_subject()
+ * Returns task subject (either from the protocol override or from a header)
+ * @return {string} value of a subject (decoded)
+ */
+LUA_FUNCTION_DEF (task, get_subject);
/***
* @method task:get_header(name[, case_sensitive])
* Get decoded value of a header specified with optional case_sensitive flag.
LUA_INTERFACE_DEF (task, set_from_ip),
LUA_INTERFACE_DEF (task, get_from_ip_num),
LUA_INTERFACE_DEF (task, get_client_ip),
+ LUA_INTERFACE_DEF (task, get_subject),
LUA_INTERFACE_DEF (task, get_helo),
LUA_INTERFACE_DEF (task, set_helo),
LUA_INTERFACE_DEF (task, get_hostname),
return 1;
}
+static gint
+lua_task_get_subject (lua_State *L)
+{
+ struct rspamd_task *task = lua_check_task (L, 1);
+
+ if (task) {
+ if (task->subject != NULL) {
+ lua_pushstring (L, task->subject);
+ return 1;
+ }
+ else {
+ lua_pushnil (L);
+ }
+ }
+ else {
+ return luaL_error (L, "invalid arguments");
+ }
+
+ return 1;
+}
+
static gint
lua_task_set_helo (lua_State *L)
{