aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_common.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-25 16:58:11 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-25 16:58:11 +0400
commit34ae83f0151a3fd31f4c045968defa39a2c40985 (patch)
tree3bb121336c76d16e3e5257c12a7905af0e04b70f /src/lua/lua_common.c
parent4a8c30c78940a9153de23dc4d031273649e93cce (diff)
downloadrspamd-34ae83f0151a3fd31f4c045968defa39a2c40985.tar.gz
rspamd-34ae83f0151a3fd31f4c045968defa39a2c40985.zip
* Add rspamd_log variable to lua plugins to access logging functions
* Each part in rspamd task now can have parent part * Check for parts distance only for multipart/alternative subparts * Do not check attachements even if they are text (but attached as file) * Do not die if write (2) returned ENOSPACE while doing logging, turn on throttling mode instead (1 write try in a second) * Add ability to turn on debug for specific symbols * Add ability to configure dns timeouts and dns retransmits in config file
Diffstat (limited to 'src/lua/lua_common.c')
-rw-r--r--src/lua/lua_common.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index aec72006c..2691a2abe 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -209,6 +209,7 @@ void
init_lua_filters (struct config_file *cfg)
{
struct config_file **pcfg;
+ gpointer *plogger;
GList *cur, *tmp;
struct script_module *module;
struct statfile *st;
@@ -224,11 +225,17 @@ init_lua_filters (struct config_file *cfg)
continue;
}
- /* Call module init function */
+ /* Initialize config structure */
pcfg = lua_newuserdata (L, sizeof (struct config_file *));
lua_setclass (L, "rspamd{config}", -1);
*pcfg = cfg;
lua_setglobal (L, "rspamd_config");
+ /* Initialize logger */
+ plogger = lua_newuserdata (L, sizeof (gpointer));
+ lua_setclass (L, "rspamd{logger}", -1);
+ *plogger = NULL;
+ lua_setglobal (L, "rspamd_log");
+
/* do the call (1 arguments, 1 result) */
if (lua_pcall (L, 0, LUA_MULTRET, 0) != 0) {
msg_info ("init of %s failed: %s", module->path, lua_tostring (L, -1));