commit c7dc443: [Minor] Lua_task: Return number of recipients in has_recipients method

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Sep 9 10:35:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-09 11:03:23 +0100
URL: https://github.com/rspamd/rspamd/commit/c7dc4430fdfe25d4f86b0aa8c9bf6ca0c7a49c23

[Minor] Lua_task: Return number of recipients in has_recipients method

---
 src/lua/lua_task.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index ba4393200..576c7e1cc 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -3438,6 +3438,7 @@ lua_task_set_recipients (lua_State *L)
 	} \
 	else { \
 		ret = addr->len > 0; \
+		nrcpt = addr->len; \
 	} \
 } while (0)
 
@@ -3446,7 +3447,7 @@ lua_task_has_from (lua_State *L)
 {
 	LUA_TRACE_POINT;
 	struct rspamd_task *task = lua_check_task (L, 1);
-	gint what = 0;
+	gint what = 0, nrcpt = 0;
 	gboolean ret = FALSE;
 
 	if (task) {
@@ -3488,7 +3489,7 @@ lua_task_has_recipients (lua_State *L)
 {
 	LUA_TRACE_POINT;
 	struct rspamd_task *task = lua_check_task (L, 1);
-	gint what = 0;
+	gint what = 0, nrcpt = 0;
 	gboolean ret = FALSE;
 
 	if (task) {
@@ -3522,6 +3523,11 @@ lua_task_has_recipients (lua_State *L)
 
 	lua_pushboolean (L, ret);
 
+	if (ret) {
+		lua_pushinteger (L, nrcpt);
+		return 2;
+	}
+
 	return 1;
 }
 


More information about the Commits mailing list