diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-12 14:40:51 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-12 14:40:51 +0300 |
commit | 6c8fc71eafb0f0bb069dba703c805a5247c917c7 (patch) | |
tree | efca07d7ff100a183b56eb1bb5d31602444408b3 /src | |
parent | 54480f21f115b40e76806210a61bdde00d3842f7 (diff) | |
download | rspamd-6c8fc71eafb0f0bb069dba703c805a5247c917c7.tar.gz rspamd-6c8fc71eafb0f0bb069dba703c805a5247c917c7.zip |
* Add log function to perl API
* Prepare for more detailed work on rspamd perl API
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 20 | ||||
-rw-r--r-- | src/main.h | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c index f315367d7..e33d6e8dd 100644 --- a/src/main.c +++ b/src/main.c @@ -25,6 +25,8 @@ /* 2 seconds to fork new process in place of dead one */ #define SOFT_FORK_TIME 2 +/* Perl module init function */ +#define MODULE_INIT_FUNC "module_init" struct config_file *cfg; @@ -85,10 +87,28 @@ static void init_filters (struct config_file *cfg) { struct perl_module *module; + char *init_func, *class; + size_t funclen; + dSP; LIST_FOREACH (module, &cfg->perl_modules, next) { if (module->path) { require_pv (module->path); + ENTER; + SAVETMPS; + + PUSHMARK (SP); + XPUSHs (sv_2mortal (newSVpv (class, 0))); + XPUSHs (sv_2mortal (newSViv (PTR2IV (cfg)))); + PUTBACK; + /* Call module init function */ + funclen = strlen (module->path) + sizeof ("::") + sizeof (MODULE_INIT_FUNC) - 1; + init_func = g_malloc (funclen); + snptintf (init_func, funclen, "%s::%s", module->path, MODULE_INIT_FUNC); + call_method (init_func, G_DISCARD); + + FREETMPS; + LEAVE; } } } diff --git a/src/main.h b/src/main.h index 10f9ef215..fb64ffed4 100644 --- a/src/main.h +++ b/src/main.h @@ -43,7 +43,7 @@ #define DEFAULT_METRIC "default" /* Logging in postfix style */ -#define msg_err g_error +#define msg_err g_critical #define msg_warn g_warning #define msg_info g_message #define msg_debug g_debug |