diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-21 13:39:39 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-21 13:39:39 +0100 |
commit | 5f25b69c03972b0adff6bc649e1922111d0ebb2b (patch) | |
tree | 62fb361ba8eab64f59a1874e5d045d404727ae4e /src/lua | |
parent | bc997b7b94a36103a3d409d0de422a71df0a19d6 (diff) | |
download | rspamd-5f25b69c03972b0adff6bc649e1922111d0ebb2b.tar.gz rspamd-5f25b69c03972b0adff6bc649e1922111d0ebb2b.zip |
Refactor worker task structure and API.
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_cfg_file.c | 2 | ||||
-rw-r--r-- | src/lua/lua_classifier.c | 14 | ||||
-rw-r--r-- | src/lua/lua_common.c | 18 | ||||
-rw-r--r-- | src/lua/lua_common.h | 18 | ||||
-rw-r--r-- | src/lua/lua_config.c | 28 | ||||
-rw-r--r-- | src/lua/lua_http.c | 16 | ||||
-rw-r--r-- | src/lua/lua_redis.c | 16 | ||||
-rw-r--r-- | src/lua/lua_task.c | 90 |
8 files changed, 101 insertions, 101 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c index cc9c71309..8325db107 100644 --- a/src/lua/lua_cfg_file.c +++ b/src/lua/lua_cfg_file.c @@ -193,7 +193,7 @@ lua_post_load_config (struct config_file *cfg) /* Handle lua dynamic config param */ gboolean -lua_handle_param (struct worker_task *task, gchar *mname, gchar *optname, enum lua_var_type expected_type, gpointer *res) +lua_handle_param (struct rspamd_task *task, gchar *mname, gchar *optname, enum lua_var_type expected_type, gpointer *res) { /* xxx: Adopt this for rcl */ diff --git a/src/lua/lua_classifier.c b/src/lua/lua_classifier.c index 82e7ea2b7..1e33f704d 100644 --- a/src/lua/lua_classifier.c +++ b/src/lua/lua_classifier.c @@ -80,11 +80,11 @@ lua_check_classifier (lua_State * L) } static GList * -call_classifier_pre_callback (struct classifier_config *ccf, struct worker_task *task, +call_classifier_pre_callback (struct classifier_config *ccf, struct rspamd_task *task, lua_State *L, gboolean is_learn, gboolean is_spam) { struct classifier_config **pccf; - struct worker_task **ptask; + struct rspamd_task **ptask; struct statfile **pst; GList *res = NULL; @@ -92,7 +92,7 @@ call_classifier_pre_callback (struct classifier_config *ccf, struct worker_task lua_setclass (L, "rspamd{classifier}", -1); *pccf = ccf; - ptask = lua_newuserdata (L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (L, sizeof (struct rspamd_task *)); lua_setclass (L, "rspamd{task}", -1); *ptask = task; @@ -120,7 +120,7 @@ call_classifier_pre_callback (struct classifier_config *ccf, struct worker_task /* Return list of statfiles that should be checked for this message */ GList * -call_classifier_pre_callbacks (struct classifier_config *ccf, struct worker_task *task, +call_classifier_pre_callbacks (struct classifier_config *ccf, struct rspamd_task *task, gboolean is_learn, gboolean is_spam, lua_State *L) { GList *res = NULL, *cur; @@ -158,11 +158,11 @@ call_classifier_pre_callbacks (struct classifier_config *ccf, struct worker_task /* Return result mark for statfile */ double -call_classifier_post_callbacks (struct classifier_config *ccf, struct worker_task *task, double in, lua_State *L) +call_classifier_post_callbacks (struct classifier_config *ccf, struct rspamd_task *task, double in, lua_State *L) { struct classifier_callback_data *cd; struct classifier_config **pccf; - struct worker_task **ptask; + struct rspamd_task **ptask; double out = in; GList *cur; @@ -176,7 +176,7 @@ call_classifier_post_callbacks (struct classifier_config *ccf, struct worker_tas lua_setclass (L, "rspamd{classifier}", -1); *pccf = ccf; - ptask = lua_newuserdata (L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (L, sizeof (struct rspamd_task *)); lua_setclass (L, "rspamd{task}", -1); *ptask = task; diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 0774615e5..ee624db3d 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -400,14 +400,14 @@ init_lua_filters (struct config_file *cfg) /* Callback functions */ gint -lua_call_filter (const gchar *function, struct worker_task *task) +lua_call_filter (const gchar *function, struct rspamd_task *task) { gint result; - struct worker_task **ptask; + struct rspamd_task **ptask; lua_State *L = task->cfg->lua_state; lua_getglobal (L, function); - ptask = lua_newuserdata (L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (L, sizeof (struct rspamd_task *)); lua_setclass (L, "rspamd{task}", -1); *ptask = task; @@ -426,7 +426,7 @@ lua_call_filter (const gchar *function, struct worker_task *task) } gint -lua_call_chain_filter (const gchar *function, struct worker_task *task, gint *marks, guint number) +lua_call_chain_filter (const gchar *function, struct rspamd_task *task, gint *marks, guint number) { gint result; guint i; @@ -454,17 +454,17 @@ lua_call_chain_filter (const gchar *function, struct worker_task *task, gint *ma /* Call custom lua function in rspamd expression */ gboolean lua_call_expression_func (gpointer lua_data, - struct worker_task *task, GList *args, gboolean *res) + struct rspamd_task *task, GList *args, gboolean *res) { lua_State *L = task->cfg->lua_state; - struct worker_task **ptask; + struct rspamd_task **ptask; GList *cur; struct expression_argument *arg; int nargs = 1, pop = 0; lua_rawgeti (L, LUA_REGISTRYINDEX, GPOINTER_TO_INT (lua_data)); /* Now we got function in top of stack */ - ptask = lua_newuserdata (L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (L, sizeof (struct rspamd_task *)); lua_setclass (L, "rspamd{task}", -1); *ptask = task; @@ -511,7 +511,7 @@ lua_call_expression_func (gpointer lua_data, * LUA custom consolidation function */ struct consolidation_callback_data { - struct worker_task *task; + struct rspamd_task *task; double score; const gchar *func; }; @@ -542,7 +542,7 @@ lua_consolidation_callback (gpointer key, gpointer value, gpointer arg) } double -lua_consolidation_func (struct worker_task *task, const gchar *metric_name, const gchar *function_name) +lua_consolidation_func (struct rspamd_task *task, const gchar *metric_name, const gchar *function_name) { struct metric_result *metric_res; double res = 0.; diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h index d03ca168e..9902fd845 100644 --- a/src/lua/lua_common.h +++ b/src/lua/lua_common.h @@ -179,17 +179,17 @@ gint luaopen_dns_resolver (lua_State * L); gint luaopen_rsa (lua_State * L); gint luaopen_ip (lua_State * L); -gint lua_call_filter (const gchar *function, struct worker_task *task); -gint lua_call_chain_filter (const gchar *function, struct worker_task *task, gint *marks, guint number); -double lua_consolidation_func (struct worker_task *task, const gchar *metric_name, const gchar *function_name); -gboolean lua_call_expression_func (gpointer lua_data, struct worker_task *task, GList *args, gboolean *res); -void lua_call_post_filters (struct worker_task *task); -void lua_call_pre_filters (struct worker_task *task); +gint lua_call_filter (const gchar *function, struct rspamd_task *task); +gint lua_call_chain_filter (const gchar *function, struct rspamd_task *task, gint *marks, guint number); +double lua_consolidation_func (struct rspamd_task *task, const gchar *metric_name, const gchar *function_name); +gboolean lua_call_expression_func (gpointer lua_data, struct rspamd_task *task, GList *args, gboolean *res); +void lua_call_post_filters (struct rspamd_task *task); +void lua_call_pre_filters (struct rspamd_task *task); void add_luabuf (const gchar *line); /* Classify functions */ -GList *call_classifier_pre_callbacks (struct classifier_config *ccf, struct worker_task *task, gboolean is_learn, gboolean is_spam, lua_State *L); -double call_classifier_post_callbacks (struct classifier_config *ccf, struct worker_task *task, double in, lua_State *L); +GList *call_classifier_pre_callbacks (struct classifier_config *ccf, struct rspamd_task *task, gboolean is_learn, gboolean is_spam, lua_State *L); +double call_classifier_post_callbacks (struct classifier_config *ccf, struct rspamd_task *task, double in, lua_State *L); double lua_normalizer_func (struct config_file *cfg, long double score, void *params); @@ -197,7 +197,7 @@ double lua_normalizer_func (struct config_file *cfg, long double score, void *pa void lua_post_load_config (struct config_file *cfg); void lua_process_element (struct config_file *cfg, const gchar *name, const gchar *module_name, struct module_opt *opt, gint idx, gboolean allow_meta); -gboolean lua_handle_param (struct worker_task *task, gchar *mname, gchar *optname, +gboolean lua_handle_param (struct rspamd_task *task, gchar *mname, gchar *optname, enum lua_var_type expected_type, gpointer *res); gboolean lua_check_condition (struct config_file *cfg, const gchar *condition); void lua_dumpstack (lua_State *L); diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index b8be57896..d922cac47 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -266,10 +266,10 @@ lua_destroy_cfg_symbol (gpointer ud) } static gboolean -lua_config_function_callback (struct worker_task *task, GList *args, void *user_data) +lua_config_function_callback (struct rspamd_task *task, GList *args, void *user_data) { struct lua_callback_data *cd = user_data; - struct worker_task **ptask; + struct rspamd_task **ptask; gint i = 1; struct expression_argument *arg; GList *cur; @@ -281,7 +281,7 @@ lua_config_function_callback (struct worker_task *task, GList *args, void *user_ else { lua_getglobal (cd->L, cd->callback.name); } - ptask = lua_newuserdata (cd->L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (cd->L, sizeof (struct rspamd_task *)); lua_setclass (cd->L, "rspamd{task}", -1); *ptask = task; /* Now push all arguments */ @@ -346,10 +346,10 @@ lua_config_register_module_option (lua_State *L) } void -lua_call_post_filters (struct worker_task *task) +lua_call_post_filters (struct rspamd_task *task) { struct lua_callback_data *cd; - struct worker_task **ptask; + struct rspamd_task **ptask; GList *cur; cur = task->cfg->post_filters; @@ -361,7 +361,7 @@ lua_call_post_filters (struct worker_task *task) else { lua_getglobal (cd->L, cd->callback.name); } - ptask = lua_newuserdata (cd->L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (cd->L, sizeof (struct rspamd_task *)); lua_setclass (cd->L, "rspamd{task}", -1); *ptask = task; @@ -399,10 +399,10 @@ lua_config_register_post_filter (lua_State *L) } void -lua_call_pre_filters (struct worker_task *task) +lua_call_pre_filters (struct rspamd_task *task) { struct lua_callback_data *cd; - struct worker_task **ptask; + struct rspamd_task **ptask; GList *cur; cur = task->cfg->pre_filters; @@ -414,7 +414,7 @@ lua_call_pre_filters (struct worker_task *task) else { lua_getglobal (cd->L, cd->callback.name); } - ptask = lua_newuserdata (cd->L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (cd->L, sizeof (struct rspamd_task *)); lua_setclass (cd->L, "rspamd{task}", -1); *ptask = task; @@ -547,10 +547,10 @@ lua_config_add_kv_map (lua_State *L) static void -lua_metric_symbol_callback (struct worker_task *task, gpointer ud) +lua_metric_symbol_callback (struct rspamd_task *task, gpointer ud) { struct lua_callback_data *cd = ud; - struct worker_task **ptask; + struct rspamd_task **ptask; if (cd->cb_is_ref) { lua_rawgeti (cd->L, LUA_REGISTRYINDEX, cd->callback.ref); @@ -558,7 +558,7 @@ lua_metric_symbol_callback (struct worker_task *task, gpointer ud) else { lua_getglobal (cd->L, cd->callback.name); } - ptask = lua_newuserdata (cd->L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (cd->L, sizeof (struct rspamd_task *)); lua_setclass (cd->L, "rspamd{task}", -1); *ptask = task; @@ -851,7 +851,7 @@ static gint lua_trie_search_task (lua_State *L) { rspamd_trie_t *trie = lua_check_trie (L); - struct worker_task *task; + struct rspamd_task *task; struct mime_text_part *part; GList *cur; const gchar *pos, *end; @@ -862,7 +862,7 @@ lua_trie_search_task (lua_State *L) if (trie) { ud = luaL_checkudata (L, 2, "rspamd{task}"); luaL_argcheck (L, ud != NULL, 1, "'task' expected"); - task = ud ? *((struct worker_task **)ud) : NULL; + task = ud ? *((struct rspamd_task **)ud) : NULL; if (task) { lua_newtable (L); cur = task->text_parts; diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 31bcffb77..60253c000 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -44,7 +44,7 @@ struct lua_http_header { }; struct lua_http_ud { - struct worker_task *task; + struct rspamd_task *task; gint parser_state; struct rspamd_async_session *s; rspamd_mempool_t *pool; @@ -81,13 +81,13 @@ lua_http_fin (void *arg) static void lua_http_push_error (gint code, struct lua_http_ud *ud) { - struct worker_task **ptask; + struct rspamd_task **ptask; gint num; /* Push error */ if (ud->callback) { lua_getglobal (ud->L, ud->callback); - ptask = lua_newuserdata (ud->L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (ud->L, sizeof (struct rspamd_task *)); lua_setclass (ud->L, "rspamd{task}", -1); *ptask = ud->task; num = 4; @@ -122,13 +122,13 @@ lua_http_push_reply (f_str_t *in, struct lua_http_ud *ud) { GList *cur; struct lua_http_header *header; - struct worker_task **ptask; + struct rspamd_task **ptask; gint num; if (ud->callback) { /* Push error */ lua_getglobal (ud->L, ud->callback); - ptask = lua_newuserdata (ud->L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (ud->L, sizeof (struct rspamd_task *)); lua_setclass (ud->L, "rspamd{task}", -1); *ptask = ud->task; @@ -339,7 +339,7 @@ lua_http_dns_callback (struct rdns_reply *reply, gpointer arg) * Common request function */ static gint -lua_http_make_request_common (lua_State *L, struct worker_task *task, const gchar *callback, +lua_http_make_request_common (lua_State *L, struct rspamd_task *task, const gchar *callback, const gchar *hostname, const gchar *path, const gchar *data, gint top) { gint r, s, datalen; @@ -518,7 +518,7 @@ lua_http_make_request_common_new (lua_State *L, struct rspamd_async_session *ses static gint lua_http_make_post_request (lua_State *L) { - struct worker_task *task, **ptask; + struct rspamd_task *task, **ptask; rspamd_mempool_t *pool, **ppool; struct rspamd_async_session *session, **psession; struct event_base *base, **pbase; @@ -579,7 +579,7 @@ lua_http_make_post_request (lua_State *L) static gint lua_http_make_get_request (lua_State *L) { - struct worker_task *task, **ptask; + struct rspamd_task *task, **ptask; rspamd_mempool_t *pool, **ppool; struct rspamd_async_session *session, **psession; struct event_base *base, **pbase; diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index 33caefad3..2642daf9a 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -53,7 +53,7 @@ static const struct luaL_reg redislib_m[] = { struct lua_redis_userdata { redisAsyncContext *ctx; lua_State *L; - struct worker_task *task; + struct rspamd_task *task; gint cbref; gchar *server; struct in_addr ina; @@ -68,12 +68,12 @@ struct lua_redis_userdata { * @param L lua stack * @return worker task object */ -static struct worker_task * +static struct rspamd_task * lua_check_task (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{task}"); luaL_argcheck (L, ud != NULL, 1, "'task' expected"); - return ud ? *((struct worker_task **)ud) : NULL; + return ud ? *((struct rspamd_task **)ud) : NULL; } static void @@ -95,11 +95,11 @@ lua_redis_fin (void *arg) static void lua_redis_push_error (const gchar *err, struct lua_redis_userdata *ud, gboolean connected) { - struct worker_task **ptask; + struct rspamd_task **ptask; /* Push error */ lua_rawgeti (ud->L, LUA_REGISTRYINDEX, ud->cbref); - ptask = lua_newuserdata (ud->L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (ud->L, sizeof (struct rspamd_task *)); lua_setclass (ud->L, "rspamd{task}", -1); *ptask = ud->task; @@ -125,11 +125,11 @@ lua_redis_push_error (const gchar *err, struct lua_redis_userdata *ud, gboolean static void lua_redis_push_data (const redisReply *r, struct lua_redis_userdata *ud) { - struct worker_task **ptask; + struct rspamd_task **ptask; /* Push error */ lua_rawgeti (ud->L, LUA_REGISTRYINDEX, ud->cbref); - ptask = lua_newuserdata (ud->L, sizeof (struct worker_task *)); + ptask = lua_newuserdata (ud->L, sizeof (struct rspamd_task *)); lua_setclass (ud->L, "rspamd{task}", -1); *ptask = ud->task; @@ -271,7 +271,7 @@ lua_redis_dns_callback (struct rdns_reply *reply, gpointer arg) static int lua_redis_make_request (lua_State *L) { - struct worker_task *task; + struct rspamd_task *task; struct lua_redis_userdata *ud; const gchar *server, *tmp; guint port, i; diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 075260359..de42989da 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -220,12 +220,12 @@ static const struct luaL_reg urllib_m[] = { }; /* Utility functions */ -static struct worker_task * +static struct rspamd_task * lua_check_task (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{task}"); luaL_argcheck (L, ud != NULL, 1, "'task' expected"); - return ud ? *((struct worker_task **)ud) : NULL; + return ud ? *((struct rspamd_task **)ud) : NULL; } static struct mime_text_part * @@ -265,7 +265,7 @@ lua_check_url (lua_State * L) static int lua_task_create_empty (lua_State *L) { - struct worker_task **ptask, *task; + struct rspamd_task **ptask, *task; task = construct_task (NULL); ptask = lua_newuserdata (L, sizeof (gpointer)); @@ -277,7 +277,7 @@ lua_task_create_empty (lua_State *L) static int lua_task_create_from_buffer (lua_State *L) { - struct worker_task **ptask, *task; + struct rspamd_task **ptask, *task; const gchar *data; size_t len; @@ -295,7 +295,7 @@ lua_task_create_from_buffer (lua_State *L) static int lua_task_process_message (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task != NULL && task->msg != NULL && task->msg->len > 0) { if (process_message (task) == 0) { @@ -314,7 +314,7 @@ lua_task_process_message (lua_State *L) static int lua_task_set_cfg (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); void *ud = luaL_checkudata (L, 2, "rspamd{config}"); luaL_argcheck (L, ud != NULL, 1, "'config' expected"); @@ -325,7 +325,7 @@ lua_task_set_cfg (lua_State *L) static int lua_task_destroy (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task != NULL) { free_task (task, FALSE); @@ -338,7 +338,7 @@ static int lua_task_get_message (lua_State * L) { GMimeMessage **pmsg; - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task != NULL && task->message != NULL) { pmsg = lua_newuserdata (L, sizeof (GMimeMessage *)); @@ -355,7 +355,7 @@ static int lua_task_get_mempool (lua_State * L) { rspamd_mempool_t **ppool; - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task != NULL) { ppool = lua_newuserdata (L, sizeof (rspamd_mempool_t *)); @@ -372,7 +372,7 @@ static int lua_task_get_session (lua_State * L) { struct rspamd_async_session **psession; - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task != NULL) { psession = lua_newuserdata (L, sizeof (void *)); @@ -389,7 +389,7 @@ static int lua_task_get_ev_base (lua_State * L) { struct event_base **pbase; - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task != NULL) { pbase = lua_newuserdata (L, sizeof (struct event_base *)); @@ -405,7 +405,7 @@ lua_task_get_ev_base (lua_State * L) static gint lua_task_insert_result (lua_State * L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); const gchar *symbol_name, *param; double flag; GList *params = NULL; @@ -429,7 +429,7 @@ lua_task_insert_result (lua_State * L) static gint lua_task_set_pre_result (lua_State * L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); gchar *action_str; guint action; @@ -471,7 +471,7 @@ lua_tree_url_callback (gpointer key, gpointer value, gpointer ud) static gint lua_task_get_urls (lua_State * L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); struct lua_tree_cb_data cb; if (task) { @@ -489,7 +489,7 @@ lua_task_get_urls (lua_State * L) static gint lua_task_get_emails (lua_State * L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); struct lua_tree_cb_data cb; if (task) { @@ -508,7 +508,7 @@ static gint lua_task_get_text_parts (lua_State * L) { gint i = 1; - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); GList *cur; struct mime_text_part *part, **ppart; @@ -534,7 +534,7 @@ static gint lua_task_get_parts (lua_State * L) { gint i = 1; - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); GList *cur; struct mime_part *part, **ppart; @@ -560,7 +560,7 @@ lua_task_get_parts (lua_State * L) static gint lua_task_get_raw_headers (lua_State * L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task) { lua_pushstring (L, task->raw_headers_str); @@ -575,7 +575,7 @@ lua_task_get_raw_headers (lua_State * L) static gint lua_task_get_raw_header_common (lua_State * L, gboolean strong) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); struct raw_header *rh; gint i = 1; const gchar *name; @@ -649,7 +649,7 @@ lua_task_get_raw_header_strong (lua_State * L) static gint lua_task_get_received_headers (lua_State * L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); GList *cur; struct received_header *rh; gint i = 1; @@ -691,7 +691,7 @@ lua_task_get_received_headers (lua_State * L) static gint lua_task_get_resolver (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); struct rspamd_dns_resolver **presolver; if (task != NULL && task->resolver != NULL) { @@ -709,7 +709,7 @@ lua_task_get_resolver (lua_State *L) static gint lua_task_inc_dns_req (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task != NULL) { task->dns_requests ++; @@ -721,7 +721,7 @@ lua_task_inc_dns_req (lua_State *L) static gint lua_task_call_rspamd_function (lua_State * L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); struct expression_function f; gint i, top; gboolean res; @@ -823,7 +823,7 @@ lua_push_internet_address_list (lua_State *L, InternetAddressList *addrs) static gint lua_task_get_recipients (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); GList *cur; InternetAddressList *addrs; gint idx = 1; @@ -864,7 +864,7 @@ lua_task_get_recipients (lua_State *L) static gint lua_task_get_from (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); InternetAddressList *addrs; if (task) { @@ -897,7 +897,7 @@ lua_task_get_from (lua_State *L) static gint lua_task_set_from (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); const gchar *new_from; if (task) { @@ -913,7 +913,7 @@ lua_task_set_from (lua_State *L) static gint lua_task_get_user (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task && task->user != NULL) { lua_pushstring (L, task->user); @@ -927,7 +927,7 @@ lua_task_get_user (lua_State *L) static gint lua_task_set_user (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); const gchar *new_user; if (task) { @@ -946,7 +946,7 @@ lua_task_set_user (lua_State *L) static gint lua_task_get_recipients_headers (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task && task->rcpts) { lua_push_internet_address_list (L, task->rcpts); @@ -960,7 +960,7 @@ lua_task_get_recipients_headers (lua_State *L) static gint lua_task_get_from_headers (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); InternetAddressList *addrs; if (task && task->message != NULL) { @@ -990,7 +990,7 @@ lua_task_get_from_headers (lua_State *L) static gint lua_task_get_from_ip (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task) { lua_ip_push (L, task->from_addr.ipv6 ? AF_INET6 : AF_INET, &task->from_addr.d); @@ -1020,7 +1020,7 @@ lua_task_get_from_ip_num (lua_State *L) static gint lua_task_get_client_ip_num (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task) { lua_ip_push (L, AF_INET, &task->client_addr); @@ -1035,7 +1035,7 @@ lua_task_get_client_ip_num (lua_State *L) static gint lua_task_get_helo (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task) { if (task->helo != NULL) { @@ -1051,7 +1051,7 @@ lua_task_get_helo (lua_State *L) static gint lua_task_set_helo (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); const gchar *new_helo; if (task) { @@ -1067,7 +1067,7 @@ lua_task_set_helo (lua_State *L) static gint lua_task_get_hostname (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task) { if (task->hostname != NULL) { @@ -1097,7 +1097,7 @@ lua_task_get_hostname (lua_State *L) static gint lua_task_set_hostname (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); const gchar *new_hostname; if (task) { @@ -1113,7 +1113,7 @@ lua_task_set_hostname (lua_State *L) static gint lua_task_get_images (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); gint i = 1; GList *cur; struct rspamd_image **pimg; @@ -1138,7 +1138,7 @@ lua_task_get_images (lua_State *L) } static inline gboolean -lua_push_symbol_result (lua_State *L, struct worker_task *task, struct metric *metric, const gchar *symbol) +lua_push_symbol_result (lua_State *L, struct rspamd_task *task, struct metric *metric, const gchar *symbol) { struct metric_result *metric_res; struct symbol *s; @@ -1178,7 +1178,7 @@ lua_push_symbol_result (lua_State *L, struct worker_task *task, struct metric *m static gint lua_task_get_symbol (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); const gchar *symbol; struct metric *metric; GList *cur = NULL, *metric_list; @@ -1224,7 +1224,7 @@ lua_task_get_symbol (lua_State *L) static gint lua_task_get_date (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); time_t task_time; if (task != NULL) { @@ -1242,7 +1242,7 @@ lua_task_get_date (lua_State *L) static gint lua_task_get_message_id (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task != NULL && task->message_id != NULL) { lua_pushstring (L, task->message_id); @@ -1257,7 +1257,7 @@ lua_task_get_message_id (lua_State *L) static gint lua_task_get_timeval (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); if (task != NULL) { lua_newtable (L); @@ -1279,7 +1279,7 @@ lua_task_get_timeval (lua_State *L) static gint lua_task_learn_statfile (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); const gchar *symbol; struct classifier_config *cl; GTree *tokens; @@ -1322,7 +1322,7 @@ lua_task_learn_statfile (lua_State *L) static gint lua_task_get_metric_score (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); const gchar *metric_name; struct metric_result *metric_res; @@ -1350,7 +1350,7 @@ lua_task_get_metric_score (lua_State *L) static gint lua_task_get_metric_action (lua_State *L) { - struct worker_task *task = lua_check_task (L); + struct rspamd_task *task = lua_check_task (L); const gchar *metric_name; struct metric_result *metric_res; enum rspamd_metric_action action; |