cur->type = C_FILTER;
msg_debug ("parse_filters_str: found C filter %s", *p);
cur->func_name = memory_pool_strdup (cfg->cfg_pool, *p);
+ cur->module = &modules[i];
cfg->filters = g_list_prepend (cfg->filters, cur);
break;
struct rlimit rlim;
struct metric *metric;
struct cache_item *item;
+ struct filter *filt;
FILE *f;
pid_t wrk;
GList *l;
counters = rspamd_hash_new_shared (rspamd->server_pool, g_str_hash, g_str_equal, 64);
/* Init C modules */
- for (i = 0; i < MODULES_NUM; i ++) {
- cur_module = memory_pool_alloc (rspamd->cfg->cfg_pool, sizeof (struct module_ctx));
- if (modules[i].module_init_func(cfg, &cur_module) == 0) {
- g_hash_table_insert (cfg->c_modules, (gpointer)modules[i].name, cur_module);
+ l = g_list_first (rspamd->cfg->filters);
+
+ while (l) {
+ filt = l->data;
+ if (filt->module) {
+ cur_module = memory_pool_alloc (rspamd->cfg->cfg_pool, sizeof (struct module_ctx));
+ if (filt->module->module_init_func(cfg, &cur_module) == 0) {
+ g_hash_table_insert (cfg->c_modules, (gpointer)filt->module->name, cur_module);
+ }
}
+ l = g_list_next (l);
}
if (cfg->config_test || dump_vars || dump_cache) {
event_init ();
res = TRUE;
/* Perform modules configuring */
- for (i = 0; i < MODULES_NUM; i ++) {
- if (!modules[i].module_config_func (cfg)) {
- res = FALSE;
+ l = g_list_first (rspamd->cfg->filters);
+
+ while (l) {
+ filt = l->data;
+ if (filt->module) {
+ if (filt->module->module_config_func (cfg)) {
+ res = FALSE;
+ }
}
+ l = g_list_next (l);
}
if (dump_vars) {
dump_cfg_vars ();
g_mime_init (0);
/* Perform modules configuring */
- for (i = 0; i < MODULES_NUM; i ++) {
- modules[i].module_config_func (cfg);
+ l = g_list_first (rspamd->cfg->filters);
+
+ while (l) {
+ filt = l->data;
+ if (filt->module) {
+ if (filt->module->module_config_func (cfg)) {
+ res = FALSE;
+ }
+ }
+ l = g_list_next (l);
}
/* Init symbols cache for each metric */