From f216d5a0fb7e1d50467182c04d72ecfd347d483f Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 27 Jul 2010 20:02:20 +0400 Subject: * Try to save images hashes to fuzzy storage to stop some annoying spammers --- src/message.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/message.c') diff --git a/src/message.c b/src/message.c index be39bbb84..f819d4daf 100644 --- a/src/message.c +++ b/src/message.c @@ -708,6 +708,14 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data) mime_part->type = type; mime_part->content = part_content; mime_part->parent = task->parser_parent_part; + /* Extract checksums for some types */ + if (g_ascii_strcasecmp (type->type, "image") == 0) { + mime_part->checksum = g_compute_checksum_for_data (G_CHECKSUM_MD5, part_content->data, part_content->len); + memory_pool_add_destructor (task->task_pool, (pool_destruct_func)g_free, mime_part->checksum); + } + else { + mime_part->checksum = NULL; + } debug_task ("found part with content-type: %s/%s", type->type, type->subtype); task->parts = g_list_prepend (task->parts, mime_part); /* Skip empty parts */ -- cgit v1.2.3