diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-07-20 19:33:48 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-07-20 19:33:48 +0400 |
commit | f86068d197719b8758fc0a2aeb8556526b2331f8 (patch) | |
tree | 99f59e943f7437dc9987bb9b9d6a23d1e12df6a1 /src/view.c | |
parent | acc1e657ead019fd3e0835cadddf4d39a7b9f181 (diff) | |
download | rspamd-f86068d197719b8758fc0a2aeb8556526b2331f8.tar.gz rspamd-f86068d197719b8758fc0a2aeb8556526b2331f8.zip |
* Introduce new common system of map files, that can be used for different types of maps.
This includes new logic of callbacks and callbacks calling, files are monitored with
evtimers with jittering. HTTP support would be included soon as well.
Diffstat (limited to 'src/view.c')
-rw-r--r-- | src/view.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/view.c b/src/view.c index 0a03d4304..ec10eb120 100644 --- a/src/view.c +++ b/src/view.c @@ -28,6 +28,7 @@ #include "view.h" #include "expressions.h" #include "cfg_file.h" +#include "map.h" struct rspamd_view* init_view (memory_pool_t *pool) @@ -51,10 +52,8 @@ add_view_from (struct rspamd_view *view, char *line) { struct rspamd_regexp *re = NULL; - if (g_ascii_strncasecmp (line, "file://", sizeof ("file://") - 1) == 0) { - if (parse_host_list (view->pool, view->from_hash, line + sizeof ("file://") - 1)) { - return TRUE; - } + if (add_map (line, read_host_list, fin_host_list, (void **)&view->from_hash)) { + return TRUE; } else if ((re = parse_regexp (view->pool, line, TRUE)) != NULL) { view->from_re_list = g_list_prepend (view->from_re_list, re); @@ -70,10 +69,8 @@ add_view_symbols (struct rspamd_view *view, char *line) struct rspamd_regexp *re = NULL; GList *symbols; - if (g_ascii_strncasecmp (line, "file://", sizeof ("file://") - 1) == 0) { - if (parse_host_list (view->pool, view->symbols_hash, line + sizeof ("file://") - 1)) { - return TRUE; - } + if (add_map (line, read_host_list, fin_host_list, (void **)&view->symbols_hash)) { + return TRUE; } else if ((re = parse_regexp (view->pool, line, TRUE)) != NULL) { view->symbols_re_list = g_list_prepend (view->symbols_re_list, re); @@ -96,14 +93,11 @@ add_view_symbols (struct rspamd_view *view, char *line) gboolean add_view_ip (struct rspamd_view *view, char *line) { - if (g_ascii_strncasecmp (line, "file://", sizeof ("file://") - 1) == 0) { - if (parse_radix_list (view->pool, view->ip_tree, line + sizeof ("file://") - 1)) { - return TRUE; - } + if (add_map (line, read_radix_list, fin_radix_list, (void **)&view->symbols_hash)) { + return TRUE; } return FALSE; - } |