diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-20 14:36:41 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-20 14:36:41 +0100 |
commit | 86d8939ad4371f80d1b034a84224faf5d173cdb3 (patch) | |
tree | 3e5425244c22705302772c07863d6894dabbcf13 /src | |
parent | 25661e2ab288e5f5d9291baf9b8b43f68735d4c9 (diff) | |
download | rspamd-86d8939ad4371f80d1b034a84224faf5d173cdb3.tar.gz rspamd-86d8939ad4371f80d1b034a84224faf5d173cdb3.zip |
[Fix] Replies: Fix 'Reply-To' handling in task:get_reply_sender
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_task.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index cb9ca4994..01c450422 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -4103,10 +4103,23 @@ lua_task_get_reply_sender (lua_State *L) if (task) { - rh = rspamd_message_get_header_array(task, "Reply-To", FALSE); + rh = rspamd_message_get_header_array (task, "Reply-To", FALSE); if (rh) { - lua_pushstring (L, rh->decoded); + GPtrArray *addrs; + + addrs = rspamd_email_address_from_mime (task->task_pool, rh->decoded, + strlen (rh->decoded), NULL, -1); + + if (addrs == NULL) { + lua_pushnil (L); + } + else { + struct rspamd_email_address *addr; + + addr = (struct rspamd_email_address *)g_ptr_array_index (addrs, 0); + lua_pushlstring (L, addr->addr, addr->addr_len); + } } else if (MESSAGE_FIELD_CHECK (task, from_mime) && MESSAGE_FIELD (task, from_mime)->len == 1) { |