aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-25 13:29:13 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-25 13:29:13 +0100
commit0e0b964d002f8029aa274408ef12d5870b61339f (patch)
treee23974082d6db2dda30800f2527b69a37ec2da53 /src
parenta03b2c328b0c9cb332527adb584b6e3496de5e46 (diff)
downloadrspamd-0e0b964d002f8029aa274408ef12d5870b61339f.tar.gz
rspamd-0e0b964d002f8029aa274408ef12d5870b61339f.zip
[Minor] Push email flags to the lua API
Diffstat (limited to 'src')
-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 9edfd39d4..1e3a9ce39 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -1987,6 +1987,14 @@ lua_task_str_to_get_type (lua_State *L, gint pos)
return ret;
}
+#define EMAIL_CHECK_FLAG(fl, str) do { \
+ if (addr->flags & (fl)) { \
+ lua_pushstring (L, (str)); \
+ lua_pushboolean (L, true); \
+ lua_settable (L, -3); \
+ } \
+} while(0)
+
static void
lua_push_email_address (lua_State *L, struct rspamd_email_address *addr)
{
@@ -2034,6 +2042,19 @@ lua_push_email_address (lua_State *L, struct rspamd_email_address *addr)
lua_pushstring (L, "");
lua_settable (L, -3);
}
+
+ lua_pushstring (L, "flags");
+ lua_createtable (L, 0, 7);
+
+ EMAIL_CHECK_FLAG (RSPAMD_EMAIL_ADDR_VALID, "valid");
+ EMAIL_CHECK_FLAG (RSPAMD_EMAIL_ADDR_IP, "ip");
+ EMAIL_CHECK_FLAG (RSPAMD_EMAIL_ADDR_BRACED, "braced");
+ EMAIL_CHECK_FLAG (RSPAMD_EMAIL_ADDR_QUOTED, "quoted");
+ EMAIL_CHECK_FLAG (RSPAMD_EMAIL_ADDR_EMPTY, "empty");
+ EMAIL_CHECK_FLAG (RSPAMD_EMAIL_ADDR_HAS_BACKSLASH, "backslash");
+ EMAIL_CHECK_FLAG (RSPAMD_EMAIL_ADDR_HAS_8BIT, "8bit");
+
+ lua_settable (L, -3);
}
}