diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-06-17 19:31:48 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-06-17 19:31:48 +0400 |
commit | bca226772e9747a4587866a50122d4a8f7973b26 (patch) | |
tree | aae459617c9b3a7a82dd0b9e2a8b03be11e3ff52 /src/plugins/surbl.c | |
parent | 453ecf68e3b51941944dbc3b1dece11342be3810 (diff) | |
download | rspamd-bca226772e9747a4587866a50122d4a8f7973b26.tar.gz rspamd-bca226772e9747a4587866a50122d4a8f7973b26.zip |
* Introduce new system of workers spawning and configuring, now rspamd can be easily extended by new types of wrokers
* Rework config system and avoid from using queue (3) lists
* Upgrade version to 0.2.0 as config format is now incompatible with older one
Diffstat (limited to 'src/plugins/surbl.c')
-rw-r--r-- | src/plugins/surbl.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index 020bf7764..81acb1f7b 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -82,7 +82,7 @@ int surbl_module_config (struct config_file *cfg) { struct hostent *hent; - LIST_HEAD (moduleoptq, module_opt) *opt = NULL; + GList *cur_opt; struct module_opt *cur; struct suffix_item *new_suffix; struct surbl_bit_item *new_bit; @@ -160,35 +160,35 @@ surbl_module_config (struct config_file *cfg) } } - opt = g_hash_table_lookup (cfg->modules_opts, "surbl"); - if (opt) { - LIST_FOREACH (cur, opt, next) { - if (!g_strncasecmp (cur->param, "suffix", sizeof ("suffix") - 1)) { - if ((str = strchr (cur->param, '_')) != NULL) { - new_suffix = memory_pool_alloc (surbl_module_ctx->surbl_pool, sizeof (struct suffix_item)); - *str = '\0'; - new_suffix->symbol = memory_pool_strdup (surbl_module_ctx->surbl_pool, str + 1); - new_suffix->suffix = memory_pool_strdup (surbl_module_ctx->surbl_pool, cur->value); - msg_debug ("surbl_module_config: add new surbl suffix: %s with symbol: %s", - new_suffix->suffix, new_suffix->symbol); - *str = '_'; - surbl_module_ctx->suffixes = g_list_prepend (surbl_module_ctx->suffixes, new_suffix); - } + cur_opt = g_hash_table_lookup (cfg->modules_opts, "surbl"); + while (cur_opt) { + cur = cur_opt->data; + if (!g_strncasecmp (cur->param, "suffix", sizeof ("suffix") - 1)) { + if ((str = strchr (cur->param, '_')) != NULL) { + new_suffix = memory_pool_alloc (surbl_module_ctx->surbl_pool, sizeof (struct suffix_item)); + *str = '\0'; + new_suffix->symbol = memory_pool_strdup (surbl_module_ctx->surbl_pool, str + 1); + new_suffix->suffix = memory_pool_strdup (surbl_module_ctx->surbl_pool, cur->value); + msg_debug ("surbl_module_config: add new surbl suffix: %s with symbol: %s", + new_suffix->suffix, new_suffix->symbol); + *str = '_'; + surbl_module_ctx->suffixes = g_list_prepend (surbl_module_ctx->suffixes, new_suffix); } - if (!g_strncasecmp (cur->param, "bit", sizeof ("bit") - 1)) { - if ((str = strchr (cur->param, '_')) != NULL) { - bit = strtoul (str + 1, NULL, 10); - if (bit != 0) { - new_bit = memory_pool_alloc (surbl_module_ctx->surbl_pool, sizeof (struct surbl_bit_item)); - new_bit->bit = bit; - new_bit->symbol = memory_pool_strdup (surbl_module_ctx->surbl_pool, cur->value); - msg_debug ("surbl_module_config: add new bit suffix: %d with symbol: %s", - (int)new_bit->bit, new_bit->symbol); - surbl_module_ctx->bits = g_list_prepend (surbl_module_ctx->bits, new_bit); - } + } + if (!g_strncasecmp (cur->param, "bit", sizeof ("bit") - 1)) { + if ((str = strchr (cur->param, '_')) != NULL) { + bit = strtoul (str + 1, NULL, 10); + if (bit != 0) { + new_bit = memory_pool_alloc (surbl_module_ctx->surbl_pool, sizeof (struct surbl_bit_item)); + new_bit->bit = bit; + new_bit->symbol = memory_pool_strdup (surbl_module_ctx->surbl_pool, cur->value); + msg_debug ("surbl_module_config: add new bit suffix: %d with symbol: %s", + (int)new_bit->bit, new_bit->symbol); + surbl_module_ctx->bits = g_list_prepend (surbl_module_ctx->bits, new_bit); } } } + cur_opt = g_list_next (cur_opt); } /* Add default suffix */ if (surbl_module_ctx->suffixes == NULL) { |