diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-23 13:41:05 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-23 13:41:05 +0100 |
commit | 41fc49bb5d1a2f9e9ac2c840744e26628312e812 (patch) | |
tree | 7b5463caaf94f0f0551e132de14ba1267b498a4c /src/libmime | |
parent | 6667595b57b5b1383f568b06c410d135d831b983 (diff) | |
download | rspamd-41fc49bb5d1a2f9e9ac2c840744e26628312e812.tar.gz rspamd-41fc49bb5d1a2f9e9ac2c840744e26628312e812.zip |
Refactor functions in images processing.
Diffstat (limited to 'src/libmime')
-rw-r--r-- | src/libmime/images.c | 11 | ||||
-rw-r--r-- | src/libmime/images.h | 16 | ||||
-rw-r--r-- | src/libmime/message.c | 2 |
3 files changed, 14 insertions, 15 deletions
diff --git a/src/libmime/images.c b/src/libmime/images.c index d60ecf2a0..30150c335 100644 --- a/src/libmime/images.c +++ b/src/libmime/images.c @@ -37,7 +37,7 @@ static void process_image (struct rspamd_task *task, struct mime_part *part); void -process_images (struct rspamd_task *task) +rspamd_images_process (struct rspamd_task *task) { guint i; struct mime_part *part; @@ -52,7 +52,7 @@ process_images (struct rspamd_task *task) } -static enum known_image_types +static enum rspamd_image_type detect_image_type (GByteArray *data) { if (data->len > sizeof (png_signature) / sizeof (png_signature[0])) { @@ -230,7 +230,7 @@ process_image (struct rspamd_task *task, struct mime_part *part) if (img != NULL) { debug_task ("detected %s image of size %ud x %ud in message <%s>", - image_type_str (img->type), + rspamd_image_type_str (img->type), img->width, img->height, task->message_id); img->filename = part->filename; @@ -286,7 +286,7 @@ process_image (struct rspamd_task *task, struct mime_part *part) } const gchar * -image_type_str (enum known_image_types type) +rspamd_image_type_str (enum rspamd_image_type type) { switch (type) { case IMAGE_TYPE_PNG: @@ -301,9 +301,6 @@ image_type_str (enum known_image_types type) case IMAGE_TYPE_BMP: return "BMP"; break; - case IMAGE_TYPE_HTML: - return "HTML"; - break; default: break; } diff --git a/src/libmime/images.h b/src/libmime/images.h index 5fcfdbc4c..5d01e6f75 100644 --- a/src/libmime/images.h +++ b/src/libmime/images.h @@ -4,31 +4,33 @@ #include "config.h" #include "main.h" -enum known_image_types { - IMAGE_TYPE_PNG, +struct html_image; + +enum rspamd_image_type { + IMAGE_TYPE_PNG = 0, IMAGE_TYPE_JPG, IMAGE_TYPE_GIF, IMAGE_TYPE_BMP, - IMAGE_TYPE_HTML, - IMAGE_TYPE_UNKNOWN = 9000 + IMAGE_TYPE_UNKNOWN }; struct rspamd_image { - enum known_image_types type; + enum rspamd_image_type type; GByteArray *data; guint32 width; guint32 height; const gchar *filename; + struct html_image *html_image; }; /* * Process images from a worker task */ -void process_images (struct rspamd_task *task); +void rspamd_images_process (struct rspamd_task *task); /* * Get textual representation of an image's type */ -const gchar * image_type_str (enum known_image_types type); +const gchar * rspamd_image_type_str (enum rspamd_image_type type); #endif /* IMAGES_H_ */ diff --git a/src/libmime/message.c b/src/libmime/message.c index 46662b3fd..96e22545c 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -1506,7 +1506,7 @@ rspamd_message_parse (struct rspamd_task *task) task->raw_headers_content.len); } - process_images (task); + rspamd_images_process (task); /* Parse received headers */ first = |