From: Vsevolod Stakhov Date: Mon, 4 Jul 2016 13:46:55 +0000 (+0100) Subject: [Rework] Rename mime parts structures X-Git-Tag: 1.3.0~183 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d52a62c089c6e498e936bd53ebd59b1a774b62a8;p=rspamd.git [Rework] Rename mime parts structures --- diff --git a/src/libmime/images.c b/src/libmime/images.c index bcb299f9c..008522a7b 100644 --- a/src/libmime/images.c +++ b/src/libmime/images.c @@ -26,14 +26,14 @@ static const guint8 jpg_sig_exif[] = {0xff, 0xe1}; static const guint8 gif_signature[] = {'G', 'I', 'F', '8'}; static const guint8 bmp_signature[] = {'B', 'M'}; -static void process_image (struct rspamd_task *task, struct mime_part *part); +static void process_image (struct rspamd_task *task, struct rspamd_mime_part *part); void rspamd_images_process (struct rspamd_task *task) { guint i; - struct mime_part *part; + struct rspamd_mime_part *part; for (i = 0; i < task->parts->len; i ++) { part = g_ptr_array_index (task->parts, i); @@ -190,12 +190,12 @@ process_bmp_image (struct rspamd_task *task, GByteArray *data) } static void -process_image (struct rspamd_task *task, struct mime_part *part) +process_image (struct rspamd_task *task, struct rspamd_mime_part *part) { enum rspamd_image_type type; struct rspamd_image *img = NULL; struct raw_header *rh; - struct mime_text_part *tp; + struct rspamd_mime_text_part *tp; struct html_image *himg; const gchar *cid, *html_cid; guint cid_len, i, j; diff --git a/src/libmime/message.c b/src/libmime/message.c index da9ded5ee..67624f6b2 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -37,8 +37,8 @@ #define UTF8_CHARSET "UTF-8" #define GTUBE_SYMBOL "GTUBE" -#define SET_PART_RAW(part) ((part)->flags &= ~RSPAMD_MIME_PART_FLAG_UTF) -#define SET_PART_UTF(part) ((part)->flags |= RSPAMD_MIME_PART_FLAG_UTF) +#define SET_PART_RAW(part) ((part)->flags &= ~RSPAMD_MIME_TEXT_PART_FLAG_UTF) +#define SET_PART_UTF(part) ((part)->flags |= RSPAMD_MIME_TEXT_PART_FLAG_UTF) static const gchar gtube_pattern[] = "XJS*C4JDBQADN1.NSBN3*2IDNEN*" "GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X"; @@ -432,7 +432,7 @@ static GByteArray * convert_text_to_utf (struct rspamd_task *task, GByteArray * part_content, GMimeContentType * type, - struct mime_text_part *text_part) + struct rspamd_mime_text_part *text_part) { GError *err = NULL; gsize write_bytes; @@ -519,7 +519,7 @@ language_elts_cmp (const void *a, const void *b) } static void -detect_text_language (struct mime_text_part *part) +detect_text_language (struct rspamd_mime_text_part *part) { /* Keep sorted */ static const struct language_match language_codes[] = { @@ -649,7 +649,7 @@ detect_text_language (struct mime_text_part *part) static void rspamd_normalize_text_part (struct rspamd_task *task, - struct mime_text_part *part) + struct rspamd_mime_text_part *part) { #ifdef WITH_SNOWBALL struct sb_stemmer *stem = NULL; @@ -840,7 +840,7 @@ rspamd_words_levenshtein_distance (struct rspamd_task *task, } static gboolean -rspamd_check_gtube (struct rspamd_task *task, struct mime_text_part *part) +rspamd_check_gtube (struct rspamd_task *task, struct rspamd_mime_text_part *part) { static const gsize max_check_size = 4 * 1024; g_assert (part != NULL); @@ -866,16 +866,16 @@ static void process_text_part (struct rspamd_task *task, GByteArray *part_content, GMimeContentType *type, - struct mime_part *mime_part, + struct rspamd_mime_part *mime_part, GMimeObject *parent, gboolean is_empty) { - struct mime_text_part *text_part; + struct rspamd_mime_text_part *text_part; const gchar *cd; /* Skip attachments */ #ifndef GMIME24 - cd = g_mime_part_get_content_disposition (GMIME_PART (mime_part->mime)); + cd = g_mime_part_get_content_disposition (GMIME_PART (rspamd_mime_part->mime)); if (cd && g_ascii_strcasecmp (cd, "attachment") == 0 && (task->cfg && !task->cfg->check_text_attachements)) { @@ -898,10 +898,10 @@ process_text_part (struct rspamd_task *task, text_part = rspamd_mempool_alloc0 (task->task_pool, - sizeof (struct mime_text_part)); - text_part->flags |= RSPAMD_MIME_PART_FLAG_HTML; + sizeof (struct rspamd_mime_text_part)); + text_part->flags |= RSPAMD_MIME_TEXT_PART_FLAG_HTML; if (is_empty) { - text_part->flags |= RSPAMD_MIME_PART_FLAG_EMPTY; + text_part->flags |= RSPAMD_MIME_TEXT_PART_FLAG_EMPTY; text_part->orig = NULL; text_part->content = NULL; g_ptr_array_add (task->text_parts, text_part); @@ -917,7 +917,7 @@ process_text_part (struct rspamd_task *task, text_part->parent = parent; text_part->mime_part = mime_part; - text_part->flags |= RSPAMD_MIME_PART_FLAG_BALANCED; + text_part->flags |= RSPAMD_MIME_TEXT_PART_FLAG_BALANCED; text_part->content = rspamd_html_process_part_full ( task->task_pool, text_part->html, @@ -927,7 +927,7 @@ process_text_part (struct rspamd_task *task, task->emails); if (text_part->content->len == 0) { - text_part->flags |= RSPAMD_MIME_PART_FLAG_EMPTY; + text_part->flags |= RSPAMD_MIME_TEXT_PART_FLAG_EMPTY; } /* Handle offsets of this part */ @@ -946,12 +946,12 @@ process_text_part (struct rspamd_task *task, text_part = rspamd_mempool_alloc0 (task->task_pool, - sizeof (struct mime_text_part)); + sizeof (struct rspamd_mime_text_part)); text_part->parent = parent; text_part->mime_part = mime_part; if (is_empty) { - text_part->flags |= RSPAMD_MIME_PART_FLAG_EMPTY; + text_part->flags |= RSPAMD_MIME_TEXT_PART_FLAG_EMPTY; text_part->orig = NULL; text_part->content = NULL; g_ptr_array_add (task->text_parts, text_part); @@ -1013,7 +1013,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data) { struct mime_foreach_data *md = user_data; struct rspamd_task *task; - struct mime_part *mime_part; + struct rspamd_mime_part *mime_part; GMimeContentType *type; GMimeDataWrapper *wrapper; GMimeStream *part_stream; @@ -1077,7 +1077,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data) type = (GMimeContentType *) g_mime_object_get_content_type (GMIME_OBJECT ( part)); mime_part = rspamd_mempool_alloc0 (task->task_pool, - sizeof (struct mime_part)); + sizeof (struct rspamd_mime_part)); hdrs = g_mime_object_get_headers (GMIME_OBJECT (part)); mime_part->raw_headers = g_hash_table_new (rspamd_strcase_hash, @@ -1142,7 +1142,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data) g_object_unref (part_stream); mime_part = rspamd_mempool_alloc0 (task->task_pool, - sizeof (struct mime_part)); + sizeof (struct rspamd_mime_part)); hdrs = g_mime_object_get_headers (GMIME_OBJECT (part)); mime_part->raw_headers = g_hash_table_new (rspamd_strcase_hash, @@ -1304,7 +1304,7 @@ rspamd_message_parse (struct rspamd_task *task) GMimeObject *parent; const GMimeContentType *ct; struct raw_header *rh; - struct mime_text_part *p1, *p2; + struct rspamd_mime_text_part *p1, *p2; struct mime_foreach_data md; struct received_header *recv, *trecv; const gchar *p; @@ -1746,7 +1746,7 @@ rspamd_message_get_mime_header_array (struct rspamd_task *task, GPtrArray *ret; struct raw_header *rh, *cur; guint nelems = 0, i; - struct mime_part *mp; + struct rspamd_mime_part *mp; for (i = 0; i < task->parts->len; i ++) { mp = g_ptr_array_index (task->parts, i); diff --git a/src/libmime/message.h b/src/libmime/message.h index 8017514f3..4055dc129 100644 --- a/src/libmime/message.h +++ b/src/libmime/message.h @@ -15,7 +15,14 @@ struct rspamd_task; struct controller_session; struct html_content; -struct mime_part { +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) +}; + +struct rspamd_mime_part { GMimeContentType *type; GByteArray *content; GMimeObject *parent; @@ -25,19 +32,21 @@ struct mime_part { gchar *checksum; const gchar *filename; const gchar *boundary; + enum rspamd_mime_part_flags flags; + gpointer specific_data; }; -#define RSPAMD_MIME_PART_FLAG_UTF (1 << 0) -#define RSPAMD_MIME_PART_FLAG_BALANCED (1 << 1) -#define RSPAMD_MIME_PART_FLAG_EMPTY (1 << 2) -#define RSPAMD_MIME_PART_FLAG_HTML (1 << 3) +#define RSPAMD_MIME_TEXT_PART_FLAG_UTF (1 << 0) +#define RSPAMD_MIME_TEXT_PART_FLAG_BALANCED (1 << 1) +#define RSPAMD_MIME_TEXT_PART_FLAG_EMPTY (1 << 2) +#define RSPAMD_MIME_TEXT_PART_FLAG_HTML (1 << 3) -#define IS_PART_EMPTY(part) ((part)->flags & RSPAMD_MIME_PART_FLAG_EMPTY) -#define IS_PART_UTF(part) ((part)->flags & RSPAMD_MIME_PART_FLAG_UTF) -#define IS_PART_RAW(part) (!((part)->flags & RSPAMD_MIME_PART_FLAG_UTF)) -#define IS_PART_HTML(part) ((part)->flags & RSPAMD_MIME_PART_FLAG_HTML) +#define IS_PART_EMPTY(part) ((part)->flags & RSPAMD_MIME_TEXT_PART_FLAG_EMPTY) +#define IS_PART_UTF(part) ((part)->flags & RSPAMD_MIME_TEXT_PART_FLAG_UTF) +#define IS_PART_RAW(part) (!((part)->flags & RSPAMD_MIME_TEXT_PART_FLAG_UTF)) +#define IS_PART_HTML(part) ((part)->flags & RSPAMD_MIME_TEXT_PART_FLAG_HTML) -struct mime_text_part { +struct rspamd_mime_text_part { guint flags; GUnicodeScript script; const gchar *lang_code; @@ -50,7 +59,7 @@ struct mime_text_part { struct html_content *html; GList *urls_offset; /**< list of offsets of urls */ GMimeObject *parent; - struct mime_part *mime_part; + struct rspamd_mime_part *mime_part; GArray *normalized_words; GArray *normalized_hashes; guint nlines; diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c index 065e63d6d..335346e89 100644 --- a/src/libmime/mime_expressions.c +++ b/src/libmime/mime_expressions.c @@ -1229,7 +1229,7 @@ gboolean rspamd_has_only_html_part (struct rspamd_task * task, GArray * args, void *unused) { - struct mime_text_part *p; + struct rspamd_mime_text_part *p; gboolean res = FALSE; if (task->text_parts->len == 1) { @@ -1395,7 +1395,7 @@ rspamd_compare_transfer_encoding (struct rspamd_task * task, gboolean rspamd_is_html_balanced (struct rspamd_task * task, GArray * args, void *unused) { - struct mime_text_part *p; + struct rspamd_mime_text_part *p; guint i; gboolean res = TRUE; @@ -1403,7 +1403,7 @@ rspamd_is_html_balanced (struct rspamd_task * task, GArray * args, void *unused) p = g_ptr_array_index (task->text_parts, i); if (!IS_PART_EMPTY (p) && IS_PART_HTML (p)) { - if (p->flags & RSPAMD_MIME_PART_FLAG_BALANCED) { + if (p->flags & RSPAMD_MIME_TEXT_PART_FLAG_BALANCED) { res = TRUE; } else { @@ -1420,7 +1420,7 @@ rspamd_is_html_balanced (struct rspamd_task * task, GArray * args, void *unused) gboolean rspamd_has_html_tag (struct rspamd_task * task, GArray * args, void *unused) { - struct mime_text_part *p; + struct rspamd_mime_text_part *p; struct expression_argument *arg; guint i; gboolean res = FALSE; @@ -1455,7 +1455,7 @@ rspamd_has_html_tag (struct rspamd_task * task, GArray * args, void *unused) gboolean rspamd_has_fake_html (struct rspamd_task * task, GArray * args, void *unused) { - struct mime_text_part *p; + struct rspamd_mime_text_part *p; guint i; gboolean res = FALSE; @@ -1650,7 +1650,7 @@ rspamd_content_type_compare_param (struct rspamd_task * task, gint r; guint i; gboolean recursive = FALSE; - struct mime_part *cur_part; + struct rspamd_mime_part *cur_part; if (args == NULL || args->len < 2) { msg_warn_task ("no parameters to function"); @@ -1727,7 +1727,7 @@ rspamd_content_type_has_param (struct rspamd_task * task, GMimeContentType *ct; gboolean recursive = FALSE, result = FALSE; guint i; - struct mime_part *cur_part; + struct rspamd_mime_part *cur_part; if (args == NULL || args->len < 1) { msg_warn_task ("no parameters to function"); @@ -1790,7 +1790,7 @@ rspamd_content_type_check (struct rspamd_task *task, gint r; guint i; gboolean recursive = FALSE; - struct mime_part *cur_part; + struct rspamd_mime_part *cur_part; if (args == NULL || args->len < 1) { msg_warn_task ("no parameters to function"); @@ -1899,7 +1899,7 @@ compare_subtype (struct rspamd_task *task, GMimeContentType * ct, } static gboolean -compare_len (struct mime_part *part, guint min, guint max) +compare_len (struct rspamd_mime_part *part, guint min, guint max) { if (min == 0 && max == 0) { return TRUE; @@ -1924,7 +1924,7 @@ common_has_content_part (struct rspamd_task * task, gint max_len) { rspamd_regexp_t *re; - struct mime_part *part; + struct rspamd_mime_part *part; GMimeContentType *ct; gint r; guint i; diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 332486cdd..4cffe675c 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -727,7 +727,7 @@ rspamd_re_cache_exec_re (struct rspamd_task *task, const guchar **scvec; guint *lenvec; gboolean raw = FALSE; - struct mime_text_part *part; + struct rspamd_mime_text_part *part; struct rspamd_url *url; struct rspamd_re_cache *cache = rt->cache; gpointer k, v; diff --git a/src/libserver/task.c b/src/libserver/task.c index 0f954ad34..c53f04242 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -170,8 +170,8 @@ rspamd_task_restore (void *arg) void rspamd_task_free (struct rspamd_task *task) { - struct mime_part *p; - struct mime_text_part *tp; + struct rspamd_mime_part *p; + struct rspamd_mime_text_part *tp; struct rspamd_email_address *addr; guint i; diff --git a/src/libserver/url.c b/src/libserver/url.c index 469830bd5..823e32a43 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -2286,7 +2286,7 @@ rspamd_url_trie_generic_callback_single (struct rspamd_multipattern *mp, struct rspamd_url_mimepart_cbdata { struct rspamd_task *task; - struct mime_text_part *part; + struct rspamd_mime_text_part *part; }; static void @@ -2358,7 +2358,7 @@ rspamd_url_text_part_callback (struct rspamd_url *url, gsize start_offset, void rspamd_url_text_extract (rspamd_mempool_t *pool, struct rspamd_task *task, - struct mime_text_part *part, + struct rspamd_mime_text_part *part, gboolean is_html) { struct rspamd_url_mimepart_cbdata mcbd; diff --git a/src/libserver/url.h b/src/libserver/url.h index 36fbb2c76..2e1862090 100644 --- a/src/libserver/url.h +++ b/src/libserver/url.h @@ -7,7 +7,7 @@ #include "fstring.h" struct rspamd_task; -struct mime_text_part; +struct rspamd_mime_text_part; enum rspamd_url_flags { RSPAMD_URL_FLAG_PHISHED = 1 << 0, @@ -79,7 +79,7 @@ void rspamd_url_init (const gchar *tld_file); */ void rspamd_url_text_extract (rspamd_mempool_t *pool, struct rspamd_task *task, - struct mime_text_part *part, + struct rspamd_mime_text_part *part, gboolean is_html); /* diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c index 30c9c74a2..2e49f8076 100644 --- a/src/libstat/backends/sqlite3_backend.c +++ b/src/libstat/backends/sqlite3_backend.c @@ -356,7 +356,7 @@ rspamd_sqlite3_get_language (struct rspamd_stat_sqlite3_db *db, gint rc, err_idx; guint i; const gchar *language = NULL; - struct mime_text_part *tp; + struct rspamd_mime_text_part *tp; struct rspamd_task **ptask; lua_State *L = db->L; GString *tb; diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 78166906f..081f1825b 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -68,8 +68,8 @@ rspamd_stat_tokenize_parts_metadata (struct rspamd_stat_ctx *st_ctx, struct rspamd_task *task) { struct rspamd_image *img; - struct mime_part *part; - struct mime_text_part *tp; + struct rspamd_mime_part *part; + struct rspamd_mime_text_part *tp; GList *cur; GArray *ar; rspamd_ftok_t elt; @@ -169,7 +169,7 @@ static void rspamd_stat_process_tokenize (struct rspamd_stat_ctx *st_ctx, struct rspamd_task *task) { - struct mime_text_part *part; + struct rspamd_mime_text_part *part; GArray *words; gchar *sub; guint i, reserved_len = 0; diff --git a/src/lmtp.c b/src/lmtp.c index 09c1f467c..c63dba38a 100644 --- a/src/lmtp.c +++ b/src/lmtp.c @@ -110,14 +110,14 @@ static void free_lmtp_task (struct rspamd_lmtp_proto *lmtp, gboolean is_soft) { GList *part; - struct mime_part *p; + struct rspamd_mime_part *p; struct rspamd_task *task = lmtp->task; if (lmtp) { debug_task ("free pointer %p", lmtp->task); while ((part = g_list_first (lmtp->task->parts))) { lmtp->task->parts = g_list_remove_link (lmtp->task->parts, part); - p = (struct mime_part *)part->data; + p = (struct rspamd_mime_part *)part->data; g_byte_array_free (p->content, FALSE); g_list_free_1 (part); } diff --git a/src/lua/lua_mimepart.c b/src/lua/lua_mimepart.c index b0bbce85f..933059603 100644 --- a/src/lua/lua_mimepart.c +++ b/src/lua/lua_mimepart.c @@ -223,27 +223,27 @@ static const struct luaL_reg mimepartlib_m[] = { }; -static struct mime_text_part * +static struct rspamd_mime_text_part * lua_check_textpart (lua_State * L) { void *ud = rspamd_lua_check_udata (L, 1, "rspamd{textpart}"); luaL_argcheck (L, ud != NULL, 1, "'textpart' expected"); - return ud ? *((struct mime_text_part **)ud) : NULL; + return ud ? *((struct rspamd_mime_text_part **)ud) : NULL; } -static struct mime_part * +static struct rspamd_mime_part * lua_check_mimepart (lua_State * L) { void *ud = rspamd_lua_check_udata (L, 1, "rspamd{mimepart}"); luaL_argcheck (L, ud != NULL, 1, "'mimepart' expected"); - return ud ? *((struct mime_part **)ud) : NULL; + return ud ? *((struct rspamd_mime_part **)ud) : NULL; } static gint lua_textpart_is_utf (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); if (part == NULL || IS_PART_EMPTY (part)) { lua_pushboolean (L, FALSE); @@ -259,7 +259,7 @@ lua_textpart_is_utf (lua_State * L) static gint lua_textpart_get_content (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); struct rspamd_lua_text *t; if (part == NULL || IS_PART_EMPTY (part)) { @@ -279,7 +279,7 @@ lua_textpart_get_content (lua_State * L) static gint lua_textpart_get_length (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); if (part == NULL) { lua_pushnil (L); @@ -299,7 +299,7 @@ lua_textpart_get_length (lua_State * L) static gint lua_textpart_get_raw_length (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); if (part == NULL) { lua_pushnil (L); @@ -319,7 +319,7 @@ lua_textpart_get_raw_length (lua_State * L) static gint lua_textpart_get_lines_count (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); if (part == NULL) { lua_pushnil (L); @@ -339,7 +339,7 @@ lua_textpart_get_lines_count (lua_State * L) static gint lua_textpart_get_words_count (lua_State *L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); if (part == NULL) { lua_pushnil (L); @@ -359,7 +359,7 @@ lua_textpart_get_words_count (lua_State *L) static gint lua_textpart_is_empty (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); if (part == NULL) { lua_pushnil (L); @@ -374,7 +374,7 @@ lua_textpart_is_empty (lua_State * L) static gint lua_textpart_is_html (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); if (part == NULL) { lua_pushnil (L); @@ -389,7 +389,7 @@ lua_textpart_is_html (lua_State * L) static gint lua_textpart_get_html (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); struct html_content **phc; if (part == NULL || part->html == NULL) { @@ -407,7 +407,7 @@ lua_textpart_get_html (lua_State * L) static gint lua_textpart_get_language (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_text_part *part = lua_check_textpart (L); if (part != NULL) { if (part->lang_code != NULL && part->lang_code[0] != '\0') { @@ -423,12 +423,12 @@ lua_textpart_get_language (lua_State * L) static gint lua_textpart_get_mimepart (lua_State * L) { - struct mime_text_part *part = lua_check_textpart (L); - struct mime_part **pmime; + struct rspamd_mime_text_part *part = lua_check_textpart (L); + struct rspamd_mime_part **pmime; if (part != NULL) { if (part->mime_part != NULL) { - pmime = lua_newuserdata (L, sizeof (struct mime_part *)); + pmime = lua_newuserdata (L, sizeof (struct rspamd_mime_part *)); rspamd_lua_setclass (L, "rspamd{mimepart}", -1); *pmime = part->mime_part; @@ -445,7 +445,7 @@ lua_textpart_get_mimepart (lua_State * L) static gint lua_mimepart_get_content (lua_State * L) { - struct mime_part *part = lua_check_mimepart (L); + struct rspamd_mime_part *part = lua_check_mimepart (L); struct rspamd_lua_text *t; if (part == NULL) { @@ -465,7 +465,7 @@ lua_mimepart_get_content (lua_State * L) static gint lua_mimepart_get_length (lua_State * L) { - struct mime_part *part = lua_check_mimepart (L); + struct rspamd_mime_part *part = lua_check_mimepart (L); if (part == NULL) { lua_pushnil (L); @@ -480,7 +480,7 @@ lua_mimepart_get_length (lua_State * L) static gint lua_mimepart_get_type (lua_State * L) { - struct mime_part *part = lua_check_mimepart (L); + struct rspamd_mime_part *part = lua_check_mimepart (L); if (part == NULL) { lua_pushnil (L); @@ -501,7 +501,7 @@ lua_mimepart_get_type (lua_State * L) static gint lua_mimepart_get_filename (lua_State * L) { - struct mime_part *part = lua_check_mimepart (L); + struct rspamd_mime_part *part = lua_check_mimepart (L); if (part == NULL || part->filename == NULL) { lua_pushnil (L); @@ -517,7 +517,7 @@ static gint lua_mimepart_get_header_common (lua_State *L, gboolean full, gboolean raw) { gboolean strong = FALSE; - struct mime_part *part = lua_check_mimepart (L); + struct rspamd_mime_part *part = lua_check_mimepart (L); const gchar *name; name = luaL_checkstring (L, 2); diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 15b0ae0b7..b46fd2671 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1135,14 +1135,14 @@ lua_task_get_text_parts (lua_State * L) { guint i; struct rspamd_task *task = lua_check_task (L, 1); - struct mime_text_part *part, **ppart; + struct rspamd_mime_text_part *part, **ppart; if (task != NULL) { lua_newtable (L); for (i = 0; i < task->text_parts->len; i ++) { part = g_ptr_array_index (task->text_parts, i); - ppart = lua_newuserdata (L, sizeof (struct mime_text_part *)); + ppart = lua_newuserdata (L, sizeof (struct rspamd_mime_text_part *)); *ppart = part; rspamd_lua_setclass (L, "rspamd{textpart}", -1); /* Make it array */ @@ -1161,14 +1161,14 @@ lua_task_get_parts (lua_State * L) { guint i; struct rspamd_task *task = lua_check_task (L, 1); - struct mime_part *part, **ppart; + struct rspamd_mime_part *part, **ppart; if (task != NULL) { lua_newtable (L); for (i = 0; i < task->parts->len; i ++) { part = g_ptr_array_index (task->parts, i); - ppart = lua_newuserdata (L, sizeof (struct mime_part *)); + ppart = lua_newuserdata (L, sizeof (struct rspamd_mime_part *)); *ppart = part; rspamd_lua_setclass (L, "rspamd{mimepart}", -1); /* Make it array */ diff --git a/src/lua/lua_trie.c b/src/lua/lua_trie.c index a0bf3afd4..0531197a2 100644 --- a/src/lua/lua_trie.c +++ b/src/lua/lua_trie.c @@ -251,7 +251,7 @@ lua_trie_search_mime (lua_State *L) { struct rspamd_multipattern *trie = lua_check_trie (L, 1); struct rspamd_task *task = lua_check_task (L, 2); - struct mime_text_part *part; + struct rspamd_mime_text_part *part; const gchar *text; gsize len, i; gboolean found = FALSE; diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c index 0ef9efff6..0cc6825f5 100644 --- a/src/plugins/chartable.c +++ b/src/plugins/chartable.c @@ -118,7 +118,7 @@ chartable_module_reconfig (struct rspamd_config *cfg) } static gboolean -check_part (struct mime_text_part *part, gboolean raw_mode) +check_part (struct rspamd_mime_text_part *part, gboolean raw_mode) { guchar *p, *p1; gunichar c, t; @@ -205,7 +205,7 @@ static void chartable_symbol_callback (struct rspamd_task *task, void *unused) { guint i; - struct mime_text_part *part; + struct rspamd_mime_text_part *part; for (i = 0; i < task->text_parts->len; i ++) { part = g_ptr_array_index (task->text_parts, i); diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 8ebbe68f1..9d05f9026 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -991,7 +991,7 @@ fuzzy_io_fin (void *ud) } static GArray * -fuzzy_preprocess_words (struct mime_text_part *part, rspamd_mempool_t *pool) +fuzzy_preprocess_words (struct rspamd_mime_text_part *part, rspamd_mempool_t *pool) { return part->normalized_words; } @@ -1157,7 +1157,7 @@ fuzzy_cmd_stat (struct fuzzy_rule *rule, static void * fuzzy_cmd_get_cached (struct fuzzy_rule *rule, rspamd_mempool_t *pool, - struct mime_text_part *part) + struct rspamd_mime_text_part *part) { gchar key[32]; gint key_part; @@ -1172,7 +1172,7 @@ fuzzy_cmd_get_cached (struct fuzzy_rule *rule, static void fuzzy_cmd_set_cached (struct fuzzy_rule *rule, rspamd_mempool_t *pool, - struct mime_text_part *part, + struct rspamd_mime_text_part *part, struct rspamd_fuzzy_encrypted_shingle_cmd *data) { gchar key[32]; @@ -1194,7 +1194,7 @@ fuzzy_cmd_from_text_part (struct fuzzy_rule *rule, gint flag, guint32 weight, rspamd_mempool_t *pool, - struct mime_text_part *part) + struct rspamd_mime_text_part *part) { struct rspamd_fuzzy_shingle_cmd *shcmd; struct rspamd_fuzzy_encrypted_shingle_cmd *encshcmd, *cached; @@ -1986,8 +1986,8 @@ static GPtrArray * fuzzy_generate_commands (struct rspamd_task *task, struct fuzzy_rule *rule, gint c, gint flag, guint32 value) { - struct mime_text_part *part; - struct mime_part *mime_part; + struct rspamd_mime_text_part *part; + struct rspamd_mime_part *mime_part; struct rspamd_image *image; struct fuzzy_cmd_io *io; guint i; diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index 1e0eacff1..020a9a891 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -1429,7 +1429,7 @@ surbl_test_url (struct rspamd_task *task, void *user_data) struct redirector_param param; struct suffix_item *suffix = user_data; guint i, j; - struct mime_text_part *part; + struct rspamd_mime_text_part *part; struct html_image *img; struct rspamd_url *url; diff --git a/src/rspamd.h b/src/rspamd.h index 0e32bcdcf..5626337fc 100644 --- a/src/rspamd.h +++ b/src/rspamd.h @@ -225,7 +225,7 @@ struct rspamd_config; struct tokenizer; struct rspamd_stat_classifier; struct rspamd_classifier_config; -struct mime_part; +struct rspamd_mime_part; struct rspamd_dns_resolver; struct rspamd_task; struct rspamd_cryptobox_library_ctx;