]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Configurable min_word_len.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 23 Feb 2015 12:46:08 +0000 (12:46 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 23 Feb 2015 12:46:08 +0000 (12:46 +0000)
src/libmime/message.c
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c
src/libserver/cfg_utils.c

index 2f96447bf279a38f48a147587b828e3ced9d58eb..bcdb86259fc2682fddec03b67bd331cf5f35a720 100644 (file)
@@ -1271,7 +1271,7 @@ process_text_part (struct rspamd_task *task,
        /* Post process part */
        detect_text_language (text_part);
        text_part->words = rspamd_tokenize_text (text_part->content->data,
-                       text_part->content->len, text_part->is_utf, 4,
+                       text_part->content->len, text_part->is_utf, task->cfg->min_word_len,
                        &text_part->urls_offset);
 }
 
index 3b6191306a67aa9ec439d03842d3ad430c96e5cf..8af3c542fba689d59ed01d61bbbb57a33d1f014d 100644 (file)
@@ -289,6 +289,8 @@ struct rspamd_config {
        guint upstream_max_errors;                                              /**< upstream max errors before shutting off                    */
        gdouble upstream_error_time;                                    /**< rate of upstream errors                                                    */
        gdouble upstream_revive_time;                                   /**< revive timeout for upstreams                                               */
+
+       guint32 min_word_len;                                                   /**< minimum length of the word to be considered                */
 };
 
 
index 0ba9423a1d5e755ed61e8690e038d36a147fa01b..5ffd07cedc7d4e0cc9614dcaac2ca8ab39d12b4f 100644 (file)
@@ -1300,6 +1300,11 @@ rspamd_rcl_config_init (void)
                rspamd_rcl_parse_struct_boolean,
                G_STRUCT_OFFSET (struct rspamd_config, check_all_filters),
                0);
+       rspamd_rcl_add_default_handler (sub,
+               "min_word_len",
+               rspamd_rcl_parse_struct_integer,
+               G_STRUCT_OFFSET (struct rspamd_config, min_word_len),
+               RSPAMD_CL_FLAG_INT_32);
 
        /**
         * Metric section
index b34873a2cc45155d33e897c98720d71c72b08907..234f639d45ab2ce3ab58b427adcbee3d73b4a0f0 100644 (file)
@@ -40,6 +40,7 @@
 #define DEFAULT_RLIMIT_NOFILE 2048
 #define DEFAULT_RLIMIT_MAXCORE 0
 #define DEFAULT_MAP_TIMEOUT 10
+#define DEFAULT_MIN_WORD 4
 
 struct rspamd_ucl_map_cbdata {
        struct rspamd_config *cfg;
@@ -165,6 +166,8 @@ rspamd_config_defaults (struct rspamd_config *cfg)
 
        cfg->log_level = G_LOG_LEVEL_WARNING;
        cfg->log_extended = TRUE;
+
+       cfg->min_word_len = DEFAULT_MIN_WORD;
 }
 
 void