aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_task.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-04-25 16:56:48 +0100
committerGitHub <noreply@github.com>2020-04-25 16:56:48 +0100
commitc2a26412ba839e4859ac5077907b2c69825b3287 (patch)
tree1b9f054398f5750897f7cb44985b5c69bec15db8 /src/lua/lua_task.c
parent74e8f0076bcc78fc34a1e44de386ddbf79628159 (diff)
parentebfde825561e434cb7d9a9da5bbe2398290030c2 (diff)
downloadrspamd-c2a26412ba839e4859ac5077907b2c69825b3287.tar.gz
rspamd-c2a26412ba839e4859ac5077907b2c69825b3287.zip
Merge pull request #3344 from jendis/raw_envfrom
[Feature] extend lua api
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r--src/lua/lua_task.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 43f8580f3..270d5ec06 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -517,6 +517,7 @@ LUA_FUNCTION_DEF (task, has_from);
* @method task:get_from([type])
* Return SMTP or MIME sender for a task. This function returns an internet address which one is a table with the following structure:
*
+ * - `raw` - the original value without any processing
* - `name` - name of internet address in UTF8, e.g. for `Vsevolod Stakhov <blah@foo.com>` it returns `Vsevolod Stakhov`
* - `addr` - address part of the address
* - `user` - user part (if present) of the address, e.g. `blah`
@@ -3152,8 +3153,18 @@ static void
lua_push_email_address (lua_State *L, struct rspamd_email_address *addr)
{
if (addr) {
- lua_createtable (L, 0, 4);
+ lua_createtable (L, 0, 5);
+ if (addr->raw_len > 0) {
+ lua_pushstring (L, "raw");
+ lua_pushlstring (L, addr->raw, addr->raw_len);
+ lua_settable (L, -3);
+ }
+ else {
+ lua_pushstring (L, "raw");
+ lua_pushstring (L, "");
+ lua_settable (L, -3);
+ }
if (addr->addr_len > 0) {
lua_pushstring (L, "addr");
lua_pushlstring (L, addr->addr, addr->addr_len);