]> source.dussan.org Git - rspamd.git/commitdiff
* Insert fuzzy check symbol correctly as it depends not only on factor but also to...
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 8 Apr 2010 15:42:56 +0000 (19:42 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 8 Apr 2010 15:42:56 +0000 (19:42 +0400)
src/plugins/fuzzy_check.c
src/plugins/regexp.c

index 0a58464d69b375e0a9bfe6c4a44d142e36917a95..bb66d10372195e52867762d3b23707fe7a1be394 100644 (file)
@@ -255,11 +255,22 @@ fuzzy_check_module_config (struct config_file *cfg)
 
        /* Search in factors hash table */
        w = g_hash_table_lookup (cfg->factors, fuzzy_module_ctx->symbol);
+
        if (w == NULL) {
-               register_symbol (&metric->cache, fuzzy_module_ctx->symbol, 1, fuzzy_symbol_callback, NULL);
+               if (fabs (fuzzy_module_ctx->max_score) < 0.001) {
+                       register_symbol (&metric->cache, fuzzy_module_ctx->symbol, 1, fuzzy_symbol_callback, NULL);
+               }
+               else {
+                       register_symbol (&metric->cache, fuzzy_module_ctx->symbol, fuzzy_module_ctx->max_score, fuzzy_symbol_callback, NULL);
+               }
        }
        else {
-               register_symbol (&metric->cache, fuzzy_module_ctx->symbol, *w, fuzzy_symbol_callback, NULL);
+               if (fabs (fuzzy_module_ctx->max_score) < 0.001) {
+                       register_symbol (&metric->cache, fuzzy_module_ctx->symbol, *w, fuzzy_symbol_callback, NULL);
+               }
+               else {
+                       register_symbol (&metric->cache, fuzzy_module_ctx->symbol, *w * fuzzy_module_ctx->max_score, fuzzy_symbol_callback, NULL);
+               }
        }
 
        register_custom_controller_command ("fuzzy_add", fuzzy_add_handler, TRUE, TRUE);
index bb51af872deb227bc9708d941428dd7a8fcab5d6..d129664fd0c846ffbfc3368f06bd9fcd6f33f3c4 100644 (file)
@@ -202,7 +202,16 @@ regexp_module_config (struct config_file *cfg)
                                res = FALSE;
                        }
                }
-
+               else {
+                       msg_err ("unknown variable type for %s", cur->param);
+                       res = FALSE;
+               }
+               
+               if ( !res) {
+                       /* Stop on errors */
+                       break;
+               }
+               
                /* Search in factors hash table */
                w = g_hash_table_lookup (cfg->factors, cur->param);
                if (w == NULL) {