From 3c772979bbcfee948054e853aa8325b8e43ac944 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 21 Nov 2019 12:35:58 +0000 Subject: [Rework] Change mime part specifics handling --- src/libmime/message.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/libmime/message.h') diff --git a/src/libmime/message.h b/src/libmime/message.h index f3a8315fc..7f6ea86dd 100644 --- a/src/libmime/message.h +++ b/src/libmime/message.h @@ -30,14 +30,25 @@ struct rspamd_image; struct rspamd_archive; enum rspamd_mime_part_flags { - RSPAMD_MIME_PART_TEXT = (1 << 0), RSPAMD_MIME_PART_ATTACHEMENT = (1 << 1), - RSPAMD_MIME_PART_IMAGE = (1 << 2), - RSPAMD_MIME_PART_ARCHIVE = (1 << 3), RSPAMD_MIME_PART_BAD_CTE = (1 << 4), - RSPAMD_MIME_PART_MISSING_CTE = (1 << 5) + RSPAMD_MIME_PART_MISSING_CTE = (1 << 5), }; +enum rspamd_mime_part_type { + RSPAMD_MIME_PART_UNDEFINED = 0, + RSPAMD_MIME_PART_MULTIPART, + RSPAMD_MIME_PART_MESSAGE, + RSPAMD_MIME_PART_TEXT, + RSPAMD_MIME_PART_ARCHIVE, + RSPAMD_MIME_PART_IMAGE, + RSPAMD_MIME_PART_CUSTOM_LUA +}; + +#define IS_PART_MULTIPART(part) ((part) && ((part)->part_type == RSPAMD_MIME_PART_MULTIPART)) +#define IS_PART_TEXT(part) ((part) && ((part)->part_type == RSPAMD_MIME_PART_TEXT)) +#define IS_PART_MESSAGE(part) ((part) &&((part)->part_type == RSPAMD_MIME_PART_MESSAGE)) + enum rspamd_cte { RSPAMD_CTE_UNKNOWN = 0, RSPAMD_CTE_7BIT = 1, @@ -72,6 +83,7 @@ struct rspamd_mime_part { enum rspamd_cte cte; guint flags; + enum rspamd_mime_part_type part_type; guint id; union { @@ -79,6 +91,7 @@ struct rspamd_mime_part { struct rspamd_mime_text_part *txt; struct rspamd_image *img; struct rspamd_archive *arch; + gint lua_ref; } specific; guchar digest[rspamd_cryptobox_HASHBYTES]; @@ -153,6 +166,7 @@ struct rspamd_message { GHashTable *emails; /**< list of parsed emails */ struct rspamd_mime_headers_table *raw_headers; /**< list of raw headers */ struct rspamd_mime_header *headers_order; /**< order of raw headers */ + struct rspamd_task *task; GPtrArray *rcpt_mime; GPtrArray *from_mime; guchar digest[16]; -- cgit v1.2.3