diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-12 20:46:55 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-12 20:46:55 +0400 |
commit | ff4871310ff5b269dcd02ea300cf78092860e1d4 (patch) | |
tree | cfa435f5de1dc8efc646a0ca1fc6fd261b2c1aa6 /src/cfg_utils.c | |
parent | c4105fc43199d51af271bc24d3345aa57906d973 (diff) | |
download | rspamd-ff4871310ff5b269dcd02ea300cf78092860e1d4.tar.gz rspamd-ff4871310ff5b269dcd02ea300cf78092860e1d4.zip |
* First commit to implement multi-statfile filter system with new learning mechanizm (untested yet)
Diffstat (limited to 'src/cfg_utils.c')
-rw-r--r-- | src/cfg_utils.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c index 720d931ef..6bd16d620 100644 --- a/src/cfg_utils.c +++ b/src/cfg_utils.c @@ -751,7 +751,7 @@ parse_comma_list (memory_pool_t * pool, gchar *line) } struct classifier_config * -check_classifier_cfg (struct config_file *cfg, struct classifier_config *c) +check_classifier_conf (struct config_file *cfg, struct classifier_config *c) { if (c == NULL) { c = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct classifier_config)); @@ -764,6 +764,20 @@ check_classifier_cfg (struct config_file *cfg, struct classifier_config *c) return c; } +struct statfile* +check_statfile_conf (struct config_file *cfg, struct statfile *c) +{ + if (c == NULL) { + c = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct statfile)); + } + if (c->opts == NULL) { + c->opts = g_hash_table_new (g_str_hash, g_str_equal); + memory_pool_add_destructor (cfg->cfg_pool, (pool_destruct_func) g_hash_table_destroy, c->opts); + } + + return c; +} + struct metric * check_metric_conf (struct config_file *cfg, struct metric *c) { @@ -1006,6 +1020,30 @@ insert_classifier_symbols (struct config_file *cfg) g_hash_table_foreach (cfg->classifiers_symbols, symbols_classifiers_callback, cfg); } +struct classifier_config* +find_classifier_conf (struct config_file *cfg, const gchar *name) +{ + GList *cur; + struct classifier_config *cf; + + if (name == NULL) { + return NULL; + } + + cur = cfg->classifiers; + while (cur) { + cf = cur->data; + + if (g_ascii_strcasecmp (cf->classifier->name, name) == 0) { + return cf; + } + + cur = g_list_next (cur); + } + + return NULL; +} + /* * vi:ts=4 */ |