From 759fa05d26aeb86fa9005ce39d222c65c45ef787 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 4 Jul 2016 16:14:53 +0100 Subject: [Rework] Remove dedicated images list --- src/libstat/stat_process.c | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/libstat') diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 081f1825b..cca676288 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -78,36 +78,36 @@ rspamd_stat_tokenize_parts_metadata (struct rspamd_stat_ctx *st_ctx, ar = g_array_sized_new (FALSE, FALSE, sizeof (elt), 4); /* Insert images */ - cur = g_list_first (task->images); + for (i = 0; i < task->parts->len; i ++) { + part = g_ptr_array_index (task->parts, i); - while (cur) { - img = cur->data; + if (part->flags & RSPAMD_MIME_PART_IMAGE) { + img = part->specific_data; - /* If an image has a linked HTML part, then we push its details to the stat */ - if (img->html_image) { - elt.begin = (gchar *)"image"; - elt.len = 5; - g_array_append_val (ar, elt); - elt.begin = (gchar *)&img->html_image->height; - elt.len = sizeof (img->html_image->height); - g_array_append_val (ar, elt); - elt.begin = (gchar *)&img->html_image->width; - elt.len = sizeof (img->html_image->width); - g_array_append_val (ar, elt); - elt.begin = (gchar *)&img->type; - elt.len = sizeof (img->type); - g_array_append_val (ar, elt); - - if (img->filename) { - elt.begin = (gchar *)img->filename; - elt.len = strlen (elt.begin); + /* If an image has a linked HTML part, then we push its details to the stat */ + if (img->html_image) { + elt.begin = (gchar *)"image"; + elt.len = 5; + g_array_append_val (ar, elt); + elt.begin = (gchar *)&img->html_image->height; + elt.len = sizeof (img->html_image->height); + g_array_append_val (ar, elt); + elt.begin = (gchar *)&img->html_image->width; + elt.len = sizeof (img->html_image->width); + g_array_append_val (ar, elt); + elt.begin = (gchar *)&img->type; + elt.len = sizeof (img->type); g_array_append_val (ar, elt); - } - msg_debug_task ("added stat tokens for image '%s'", img->html_image->src); - } + if (img->filename) { + elt.begin = (gchar *)img->filename; + elt.len = strlen (elt.begin); + g_array_append_val (ar, elt); + } - cur = g_list_next (cur); + msg_debug_task ("added stat tokens for image '%s'", img->html_image->src); + } + } } /* Process mime parts */ -- cgit v1.2.3