aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-04 16:14:53 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-04 16:14:53 +0100
commit759fa05d26aeb86fa9005ce39d222c65c45ef787 (patch)
tree14242f0bb9738f9646fe240b4e41bfbd15bae074 /src/libstat
parentd52a62c089c6e498e936bd53ebd59b1a774b62a8 (diff)
downloadrspamd-759fa05d26aeb86fa9005ce39d222c65c45ef787.tar.gz
rspamd-759fa05d26aeb86fa9005ce39d222c65c45ef787.zip
[Rework] Remove dedicated images list
Diffstat (limited to 'src/libstat')
-rw-r--r--src/libstat/stat_process.c50
1 files changed, 25 insertions, 25 deletions
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 */