aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/message.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-21 12:35:58 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-21 12:35:58 +0000
commit3c772979bbcfee948054e853aa8325b8e43ac944 (patch)
tree8a25b12e7fa3f5d1389b004cd4a131ca717dd26c /src/libmime/message.h
parentcb5fa030df56eb424d832b99009816989072124c (diff)
downloadrspamd-3c772979bbcfee948054e853aa8325b8e43ac944.tar.gz
rspamd-3c772979bbcfee948054e853aa8325b8e43ac944.zip
[Rework] Change mime part specifics handling
Diffstat (limited to 'src/libmime/message.h')
-rw-r--r--src/libmime/message.h22
1 files changed, 18 insertions, 4 deletions
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];