diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-16 14:34:35 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-16 14:34:35 +0100 |
commit | 7ffeac6f52de59a57456adbbe075fec0c4cd4c49 (patch) | |
tree | 41465741f485b374ddea3ff316ca2c38bbbb612b /src/libmime/mime_expressions.c | |
parent | 7e5e5b53360d95d7d3cddc18c4811ce8a4c8cba1 (diff) | |
download | rspamd-7ffeac6f52de59a57456adbbe075fec0c4cd4c49.tar.gz rspamd-7ffeac6f52de59a57456adbbe075fec0c4cd4c49.zip |
[Rework] Distinguish protocol and task flags
Diffstat (limited to 'src/libmime/mime_expressions.c')
-rw-r--r-- | src/libmime/mime_expressions.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c index 975a112bc..7354b3aeb 100644 --- a/src/libmime/mime_expressions.c +++ b/src/libmime/mime_expressions.c @@ -2223,6 +2223,18 @@ rspamd_is_empty_body (struct rspamd_task *task, } \ } while(0) +#define TASK_PROTOCOL_FLAG_READ(flag) do { \ + result = !!(task->protocol_flags & (flag)); \ +} while(0) + +#define TASK_GET_PROTOCOL_FLAG(flag, strname, macro) do { \ + if (!found && strcmp ((flag), strname) == 0) { \ + TASK_PROTOCOL_FLAG_READ((macro)); \ + found = TRUE; \ + } \ +} while(0) + + static gboolean rspamd_has_flag_expr (struct rspamd_task *task, GArray * args, @@ -2250,7 +2262,8 @@ rspamd_has_flag_expr (struct rspamd_task *task, TASK_GET_FLAG (flag_str, "no_log", RSPAMD_TASK_FLAG_NO_LOG); TASK_GET_FLAG (flag_str, "no_stat", RSPAMD_TASK_FLAG_NO_STAT); TASK_GET_FLAG (flag_str, "skip", RSPAMD_TASK_FLAG_SKIP); - TASK_GET_FLAG (flag_str, "extended_urls", RSPAMD_TASK_FLAG_EXT_URLS); + TASK_GET_PROTOCOL_FLAG (flag_str, "extended_urls", + RSPAMD_TASK_PROTOCOL_FLAG_EXT_URLS); TASK_GET_FLAG (flag_str, "learn_spam", RSPAMD_TASK_FLAG_LEARN_SPAM); TASK_GET_FLAG (flag_str, "learn_ham", RSPAMD_TASK_FLAG_LEARN_HAM); TASK_GET_FLAG (flag_str, "greylisted", RSPAMD_TASK_FLAG_GREYLISTED); @@ -2258,8 +2271,8 @@ rspamd_has_flag_expr (struct rspamd_task *task, RSPAMD_TASK_FLAG_BROKEN_HEADERS); TASK_GET_FLAG (flag_str, "skip_process", RSPAMD_TASK_FLAG_SKIP_PROCESS); - TASK_GET_FLAG (flag_str, "milter", - RSPAMD_TASK_FLAG_MILTER); + TASK_GET_PROTOCOL_FLAG (flag_str, "milter", + RSPAMD_TASK_PROTOCOL_FLAG_MILTER); TASK_GET_FLAG (flag_str, "bad_unicode", RSPAMD_TASK_FLAG_BAD_UNICODE); |