aboutsummaryrefslogtreecommitdiffstats
path: root/src/fuzzy.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-12 21:13:10 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-12 21:13:10 +0400
commita569705d3057b09684ffda4452d2bf6101d2d9f3 (patch)
treec259a5aeefb7b3d239f3472305b369c20c38ecd4 /src/fuzzy.c
parentff4871310ff5b269dcd02ea300cf78092860e1d4 (diff)
downloadrspamd-a569705d3057b09684ffda4452d2bf6101d2d9f3.tar.gz
rspamd-a569705d3057b09684ffda4452d2bf6101d2d9f3.zip
* Add ability to get difference between two parts from lua code
Diffstat (limited to 'src/fuzzy.c')
-rw-r--r--src/fuzzy.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/fuzzy.c b/src/fuzzy.c
index cdc9922cc..5a2decb34 100644
--- a/src/fuzzy.c
+++ b/src/fuzzy.c
@@ -321,6 +321,7 @@ fuzzy_init_part (struct mime_text_part *part, memory_pool_t *pool)
GList *cur_offset;
struct process_exception *cur_ex = NULL;
gunichar uc;
+ GString *debug;
cur_offset = part->urls_offset;
if (cur_offset != NULL) {
@@ -370,6 +371,7 @@ fuzzy_init_part (struct mime_text_part *part, memory_pool_t *pool)
}
}
+ debug = g_string_sized_new (real_len);
new->block_size = fuzzy_blocksize (real_len);
new2->block_size = new->block_size * 2;
@@ -395,6 +397,7 @@ fuzzy_init_part (struct mime_text_part *part, memory_pool_t *pool)
uc = g_utf8_get_char (c);
if (g_unichar_isalnum (uc)) {
fuzzy_update2 (new, new2, uc);
+ g_string_append_unichar (debug, uc);
}
c = g_utf8_next_char (c);
}
@@ -412,11 +415,13 @@ fuzzy_init_part (struct mime_text_part *part, memory_pool_t *pool)
else {
if (!g_ascii_isspace (*c) && !g_ascii_ispunct (*c)) {
fuzzy_update2 (new, new2, *c);
+ g_string_append_c (debug, *c);
}
c++;
}
}
}
+ msg_info ("make hash of string: %v", debug);
/* Check whether we have more bytes in a rolling window */
if (new->rh != 0) {
new->hash_pipe[new->hi] = b64[new->h % 64];