aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_expressions.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-18 16:55:42 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-18 16:55:42 +0100
commite9d009906667410087e1a4472f53ab6858a9cfb9 (patch)
tree64b8d5f7d46fcf24f76df14fd60752f0d1d5567f /src/libmime/mime_expressions.c
parentcaa48320d8af752624faedb53bad20229c905cb2 (diff)
downloadrspamd-e9d009906667410087e1a4472f53ab6858a9cfb9.tar.gz
rspamd-e9d009906667410087e1a4472f53ab6858a9cfb9.zip
[Minor] Add `is_empty_body` regexp function
Diffstat (limited to 'src/libmime/mime_expressions.c')
-rw-r--r--src/libmime/mime_expressions.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index c33d852be..7e6816170 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -77,6 +77,9 @@ static gboolean rspamd_has_content_part (struct rspamd_task *task,
static gboolean rspamd_has_content_part_len (struct rspamd_task *task,
GArray * args,
void *unused);
+static gboolean rspamd_is_empty_body (struct rspamd_task *task,
+ GArray * args,
+ void *unused);
static rspamd_expression_atom_t * rspamd_mime_expr_parse (const gchar *line, gsize len,
rspamd_mempool_t *pool, gpointer ud, GError **err);
@@ -145,6 +148,7 @@ static struct _fl {
{"has_html_tag", rspamd_has_html_tag, NULL},
{"has_only_html_part", rspamd_has_only_html_part, NULL},
{"header_exists", rspamd_header_exists, NULL},
+ {"is_empty_body", rspamd_is_empty_body, NULL},
{"is_html_balanced", rspamd_is_html_balanced, NULL},
{"is_recipients_sorted", rspamd_is_recipients_sorted, NULL},
{"raw_header_exists", rspamd_raw_header_exists, NULL}
@@ -1949,3 +1953,20 @@ rspamd_has_content_part_len (struct rspamd_task * task,
return common_has_content_part (task, param_type, param_subtype, min, max);
}
+
+static gboolean
+rspamd_is_empty_body (struct rspamd_task *task,
+ GArray * args,
+ void *unused)
+{
+ struct rspamd_mime_part *part;
+ guint i;
+
+ PTR_ARRAY_FOREACH (task->parts, i, part) {
+ if (part->parsed_data.len > 0) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+} \ No newline at end of file