aboutsummaryrefslogtreecommitdiffstats
path: root/src/expressions.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-13 19:39:37 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-13 19:39:37 +0400
commitb0ddff4f0d56a877305649a14b902b3f23140b4b (patch)
tree65a2066d13b480b062b20036280d18321fb91e94 /src/expressions.c
parent091e84951a2b032bb2930b300ffe43eaf01a304e (diff)
downloadrspamd-b0ddff4f0d56a877305649a14b902b3f23140b4b.tar.gz
rspamd-b0ddff4f0d56a877305649a14b902b3f23140b4b.zip
* Add new algorithm based on diff algorithm to compare relatively short text parts
Diffstat (limited to 'src/expressions.c')
-rw-r--r--src/expressions.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/expressions.c b/src/expressions.c
index c2af8288c..3dfd542a4 100644
--- a/src/expressions.c
+++ b/src/expressions.c
@@ -31,6 +31,7 @@
#include "expressions.h"
#include "html.h"
#include "lua/lua_common.h"
+#include "diff.h"
gboolean rspamd_compare_encoding (struct worker_task *task, GList * args, void *unused);
gboolean rspamd_header_exists (struct worker_task *task, GList * args, void *unused);
@@ -1083,7 +1084,12 @@ rspamd_parts_distance (struct worker_task * task, GList * args, void *unused)
return FALSE;
}
if (!p1->is_empty && !p2->is_empty) {
- diff = fuzzy_compare_parts (p1, p2);
+ if (p1->diff_str != NULL && p2->diff_str != NULL) {
+ diff = compare_diff_distance (p1->diff_str, p2->diff_str);
+ }
+ else {
+ diff = fuzzy_compare_parts (p1, p2);
+ }
debug_task ("got likeliness between parts of %d%%, threshold is %d%%", diff, threshold);
*pdiff = diff;
memory_pool_set_variable (task->task_pool, "parts_distance", pdiff, NULL);