]> source.dussan.org Git - rspamd.git/commitdiff
Refactor function names.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 23 Sep 2014 11:15:28 +0000 (12:15 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 23 Sep 2014 11:15:28 +0000 (12:15 +0100)
24 files changed:
src/classifiers/bayes.c
src/classifiers/winnow.c
src/controller.c
src/legacy_controller.c
src/libmime/filter.c
src/libmime/filter.h
src/libmime/smtp_utils.c
src/libserver/cfg_rcl.c
src/libserver/dynamic_cfg.c
src/libserver/protocol.c
src/libserver/roll_history.c
src/libserver/task.c
src/lmtp.c
src/lua/lua_common.c
src/lua/lua_config.c
src/lua/lua_task.c
src/plugins/chartable.c
src/plugins/dkim_check.c
src/plugins/fuzzy_check.c
src/plugins/regexp.c
src/plugins/spf.c
src/plugins/surbl.c
src/smtp.c
src/worker.c

index bd001a8c327ef7f65eb2e6a81d6ce07b8f46bd9c..0afd3109c3fa6ce4bfb57e58161ff0f8171e99dc 100644 (file)
@@ -345,7 +345,7 @@ bayes_classify (struct classifier_ctx * ctx,
                        }
                        rspamd_snprintf (sumbuf, 32, "%.2f%%", final_prob * 100.);
                        cur = g_list_prepend (NULL, sumbuf);
-                       insert_result (task,
+                       rspamd_task_insert_result (task,
                                data.statfiles[selected_st].st->symbol,
                                final_prob,
                                cur);
index 25ff0b37d14c4963a6c41bc7f8cfa69cf52cd388..4bfe086bfc175fb4c211d86875398361772dcde3 100644 (file)
@@ -316,7 +316,7 @@ winnow_classify (struct classifier_ctx *ctx,
                sumbuf = rspamd_mempool_alloc (task->task_pool, 32);
                rspamd_snprintf (sumbuf, 32, "%.2F", max);
                cur = g_list_prepend (NULL, sumbuf);
-               insert_result (task, sel->symbol, max, cur);
+               rspamd_task_insert_result (task, sel->symbol, max, cur);
        }
 
        return TRUE;
index e135ecdea2f0d9cf25127894a0139ecc9924c4e7..eb9bb5d1e311a3e46e681a9837a1110e36f58a99 100644 (file)
@@ -378,7 +378,7 @@ rspamd_controller_handle_actions (struct rspamd_http_connection_entry *conn_ent,
                        if (act->score >= 0) {
                                obj = ucl_object_typed_new (UCL_OBJECT);
                                ucl_object_insert_key (obj,
-                                       ucl_object_fromstring (str_action_metric (
+                                       ucl_object_fromstring (rspamd_action_to_str (
                                                act->action)), "action", 0, false);
                                ucl_object_insert_key (obj, ucl_object_fromdouble (
                                                act->score), "value", 0, false);
@@ -704,7 +704,7 @@ rspamd_controller_handle_history (struct rspamd_http_connection_entry *conn_ent,
                        ucl_object_insert_key (obj, ucl_object_fromstring (
                                        ip_buf),                  "ip",   0, false);
                        ucl_object_insert_key (obj,
-                               ucl_object_fromstring (str_action_metric (
+                               ucl_object_fromstring (rspamd_action_to_str (
                                        row->action)), "action", 0, false);
                        ucl_object_insert_key (obj, ucl_object_fromdouble (
                                        row->score),              "score",                      0, false);
@@ -743,7 +743,7 @@ rspamd_controller_learn_fin_task (void *ud)
        conn_ent = task->fin_arg;
        session = conn_ent->ud;
 
-       if (!learn_task_spam (session->cl, task, session->is_spam, &err)) {
+       if (!rspamd_learn_task_spam (session->cl, task, session->is_spam, &err)) {
                rspamd_controller_send_error (conn_ent, 500 + err->code, err->message);
                return TRUE;
        }
@@ -763,7 +763,7 @@ rspamd_controller_check_fin_task (void *ud)
        struct rspamd_http_connection_entry *conn_ent;
        struct rspamd_http_message *msg;
 
-       process_statfiles (task);
+       rspamd_process_statistics (task);
        conn_ent = task->fin_arg;
        msg = rspamd_http_new_message (HTTP_RESPONSE);
        msg->date = time (NULL);
@@ -1289,7 +1289,7 @@ rspamd_controller_handle_stat_common (
                for (i = METRIC_ACTION_REJECT; i <= METRIC_ACTION_NOACTION; i++) {
                        ucl_object_insert_key (sub,
                                ucl_object_fromint (stat->actions_stat[i]),
-                               str_action_metric (i), 0, false);
+                               rspamd_action_to_str (i), 0, false);
                        if (i < METRIC_ACTION_GREYLIST) {
                                spam += stat->actions_stat[i];
                        }
index a03480462d95cb9e8a73e4efcbd62f27f5aeab5a..da20b6d3fdf39e02499cf65b41e5909c178e8aad 100644 (file)
@@ -504,7 +504,7 @@ process_stat_command (struct controller_session *session, gboolean do_reset)
                for (i = METRIC_ACTION_REJECT; i <= METRIC_ACTION_NOACTION; i++) {
                        rspamd_printf_gstring (out,
                                "Messages with action %s: %ud, %.2f%%" CRLF,
-                               str_action_metric (
+                               rspamd_action_to_str (
                                        i),
                                stat->actions_stat[i],
                                (double)stat->actions_stat[i] / (double)stat->messages_scanned *
@@ -708,7 +708,7 @@ process_dynamic_conf_command (gchar **cmd_args,
        }
 
        if (is_action) {
-               if (!check_action_str (name, &real_act)) {
+               if (!rspamd_action_from_str (name, &real_act)) {
                        msg_info ("invalid action string: %s", name);
                        res = FALSE;
                }
@@ -1658,7 +1658,7 @@ controller_read_socket (f_str_t * in, void *arg)
                        return FALSE;
                }
 
-               if (!learn_task (session->learn_symbol, task, &err)) {
+               if (!rspamd_learn_task (session->learn_symbol, task, &err)) {
                        rspamd_task_free (task, FALSE);
                        if (err) {
                                if (session->restful) {
@@ -1759,7 +1759,7 @@ controller_read_socket (f_str_t * in, void *arg)
                session->learn_task = task;
                session->state = STATE_LEARN_SPAM;
                rspamd_dispatcher_pause (session->dispatcher);
-               r = process_filters (task);
+               r = rspamd_process_filters (task);
                if (r == -1) {
                        rspamd_dispatcher_restore (session->dispatcher);
                        session->state = STATE_REPLY;
@@ -1966,7 +1966,7 @@ controller_write_socket (void *arg)
                        }
                }
                else {
-                       if (!learn_task_spam (session->learn_classifier,
+                       if (!rspamd_learn_task_spam (session->learn_classifier,
                                session->learn_task, session->in_class, &err)) {
                                if (err) {
                                        if (session->restful) {
index d26f26e1d397c38cbfb1666ed89bc335d162e65e..209e00e888fe259d78bc34f2a9e2c43622325301 100644 (file)
@@ -63,7 +63,7 @@ filter_error_quark (void)
 }
 
 struct metric_result *
-create_metric_result (struct rspamd_task *task, const gchar *name)
+rspamd_create_metric_result (struct rspamd_task *task, const gchar *name)
 {
        struct metric_result *metric_res;
        struct metric *metric;
@@ -110,7 +110,7 @@ insert_metric_result (struct rspamd_task *task,
        gdouble *weight, w;
        const ucl_object_t *mobj, *sobj;
 
-       metric_res = create_metric_result (task, metric->name);
+       metric_res = rspamd_create_metric_result (task, metric->name);
 
        weight = g_hash_table_lookup (metric->symbols, symbol);
        if (weight == NULL) {
@@ -265,7 +265,7 @@ insert_result_common (struct rspamd_task *task,
 
 /* Insert result that may be increased on next insertions */
 void
-insert_result (struct rspamd_task *task,
+rspamd_task_insert_result (struct rspamd_task *task,
        const gchar *symbol,
        double flag,
        GList * opts)
@@ -275,7 +275,7 @@ insert_result (struct rspamd_task *task,
 
 /* Insert result as a single option */
 void
-insert_result_single (struct rspamd_task *task,
+rspamd_task_insert_result_single (struct rspamd_task *task,
        const gchar *symbol,
        double flag,
        GList * opts)
@@ -299,7 +299,7 @@ check_metric_settings (struct rspamd_task *task, struct metric *metric,
                act = ucl_object_find_key (mobj, "actions");
                if (act != NULL) {
                        reject = ucl_object_find_key (act,
-                                       str_action_metric (METRIC_ACTION_REJECT));
+                                       rspamd_action_to_str (METRIC_ACTION_REJECT));
                        if (reject != NULL && ucl_object_todouble_safe (reject, &val)) {
                                *score = val;
                                return TRUE;
@@ -346,14 +346,14 @@ check_metric_is_spam (struct rspamd_task *task, struct metric *metric)
 }
 
 gint
-process_filters (struct rspamd_task *task)
+rspamd_process_filters (struct rspamd_task *task)
 {
        GList *cur;
        struct metric *metric;
        gpointer item = NULL;
 
        /* Insert default metric to be sure that it exists all the time */
-       create_metric_result (task, DEFAULT_METRIC);
+       rspamd_create_metric_result (task, DEFAULT_METRIC);
        if (task->settings) {
                const ucl_object_t *wl;
 
@@ -568,7 +568,7 @@ composites_foreach_callback (gpointer key, gpointer value, void *data)
                                s = g_list_next (s);
                        }
                        /* Add new symbol */
-                       insert_result_single (cd->task, key, 1.0, NULL);
+                       rspamd_task_insert_result_single (cd->task, key, 1.0, NULL);
                        msg_info ("%s", logbuf);
                }
        }
@@ -716,7 +716,7 @@ composites_metric_callback (gpointer key, gpointer value, gpointer data)
 }
 
 void
-make_composites (struct rspamd_task *task)
+rspamd_make_composites (struct rspamd_task *task)
 {
        g_hash_table_foreach (task->results, composites_metric_callback, task);
 }
@@ -871,7 +871,7 @@ classifiers_callback (gpointer value, void *arg)
 
 
 void
-process_statfiles (struct rspamd_task *task)
+rspamd_process_statistics (struct rspamd_task *task)
 {
        struct classifiers_cbdata cbdata;
 
@@ -889,11 +889,11 @@ process_statfiles (struct rspamd_task *task)
        g_list_foreach (task->cfg->classifiers, classifiers_callback, &cbdata);
 
        /* Process results */
-       make_composites (task);
+       rspamd_make_composites (task);
 }
 
 void
-process_statfiles_threaded (gpointer data, gpointer user_data)
+rspamd_process_statistic_threaded (gpointer data, gpointer user_data)
 {
        struct rspamd_task *task = (struct rspamd_task *)data;
        struct lua_locked_state *nL = user_data;
@@ -977,7 +977,7 @@ insert_headers (struct rspamd_task *task)
 }
 
 gboolean
-check_action_str (const gchar *data, gint *result)
+rspamd_action_from_str (const gchar *data, gint *result)
 {
        if (g_ascii_strncasecmp (data, "reject", sizeof ("reject") - 1) == 0) {
                *result = METRIC_ACTION_REJECT;
@@ -1009,7 +1009,7 @@ check_action_str (const gchar *data, gint *result)
 }
 
 const gchar *
-str_action_metric (enum rspamd_metric_action action)
+rspamd_action_to_str (enum rspamd_metric_action action)
 {
        switch (action) {
        case METRIC_ACTION_REJECT:
@@ -1041,7 +1041,7 @@ get_specific_action_score (const ucl_object_t *metric,
        if (metric) {
                act = ucl_object_find_key (metric, "actions");
                if (act) {
-                       sact = ucl_object_find_key (act, str_action_metric (action->action));
+                       sact = ucl_object_find_key (act, rspamd_action_to_str (action->action));
                        if (sact != NULL && ucl_object_todouble_safe (sact, &score)) {
                                return score;
                        }
@@ -1052,7 +1052,7 @@ get_specific_action_score (const ucl_object_t *metric,
 }
 
 gint
-check_metric_action (struct rspamd_task *task,
+rspamd_check_action_metric (struct rspamd_task *task,
                double score, double *rscore, struct metric *metric)
 {
        struct metric_action *action, *selected_action = NULL;
@@ -1092,7 +1092,7 @@ check_metric_action (struct rspamd_task *task,
 }
 
 gboolean
-learn_task (const gchar *statfile, struct rspamd_task *task, GError **err)
+rspamd_learn_task (const gchar *statfile, struct rspamd_task *task, GError **err)
 {
        GList *cur, *ex;
        struct rspamd_classifier_config *cl;
@@ -1237,7 +1237,7 @@ learn_task (const gchar *statfile, struct rspamd_task *task, GError **err)
 }
 
 gboolean
-learn_task_spam (struct rspamd_classifier_config *cl,
+rspamd_learn_task_spam (struct rspamd_classifier_config *cl,
        struct rspamd_task *task,
        gboolean is_spam,
        GError **err)
index f1f128f6357ec3a781d6e73d72d50f01ad5b8b6c..69c20bdd1f7c5e85cc28eaa4cbd94e79dede3e81 100644 (file)
@@ -84,7 +84,7 @@ struct rspamd_composite {
  * @param name name of metric
  * @return metric result or NULL if metric `name` has not been found
  */
-struct metric_result * create_metric_result (struct rspamd_task *task,
+struct metric_result * rspamd_create_metric_result (struct rspamd_task *task,
                const gchar *name);
 
 /**
@@ -92,19 +92,19 @@ struct metric_result * create_metric_result (struct rspamd_task *task,
  * @param task worker's task that present message from user
  * @return 0 - if there is non-finished tasks and 1 if processing is completed
  */
-gint process_filters (struct rspamd_task *task);
+gint rspamd_process_filters (struct rspamd_task *task);
 
 /**
  * Process message with statfiles
  * @param task worker's task that present message from user
  */
-void process_statfiles (struct rspamd_task *task);
+void rspamd_process_statistics (struct rspamd_task *task);
 
 /**
  * Process message with statfiles threaded
  * @param data worker's task that present message from user
  */
-void process_statfiles_threaded (gpointer data, gpointer user_data);
+void rspamd_process_statistic_threaded (gpointer data, gpointer user_data);
 
 /**
  * Insert a result to task
@@ -114,7 +114,7 @@ void process_statfiles_threaded (gpointer data, gpointer user_data);
  * @param flag numeric weight for symbol
  * @param opts list of symbol's options
  */
-void insert_result (struct rspamd_task *task,
+void rspamd_task_insert_result (struct rspamd_task *task,
        const gchar *symbol,
        double flag,
        GList *opts);
@@ -127,7 +127,7 @@ void insert_result (struct rspamd_task *task,
  * @param flag numeric weight for symbol
  * @param opts list of symbol's options
  */
-void insert_result_single (struct rspamd_task *task,
+void rspamd_task_insert_result_single (struct rspamd_task *task,
        const gchar *symbol,
        double flag,
        GList *opts);
@@ -136,7 +136,7 @@ void insert_result_single (struct rspamd_task *task,
  * Process all results and form composite metrics from existent metrics as it is defined in config
  * @param task worker's task that present message from user
  */
-void make_composites (struct rspamd_task *task);
+void rspamd_make_composites (struct rspamd_task *task);
 
 /**
  * Default consolidation function for metric, it get all symbols and multiply symbol
@@ -145,7 +145,7 @@ void make_composites (struct rspamd_task *task);
  * @param metric_name name of metric
  * @return result metric weight
  */
-double factor_consolidation_func (struct rspamd_task *task,
+double rspamd_factor_consolidation_func (struct rspamd_task *task,
        const gchar *metric_name,
        const gchar *unused);
 
@@ -156,7 +156,7 @@ double factor_consolidation_func (struct rspamd_task *task,
  * @param err pointer to GError
  * @return true if learn succeed
  */
-gboolean learn_task (const gchar *statfile,
+gboolean rspamd_learn_task (const gchar *statfile,
        struct rspamd_task *task,
        GError **err);
 
@@ -167,7 +167,7 @@ gboolean learn_task (const gchar *statfile,
  * @param err pointer to GError
  * @return true if learn succeed
  */
-gboolean learn_task_spam (struct rspamd_classifier_config *cl,
+gboolean rspamd_learn_task_spam (struct rspamd_classifier_config *cl,
        struct rspamd_task *task,
        gboolean is_spam,
        GError **err);
@@ -175,17 +175,17 @@ gboolean learn_task_spam (struct rspamd_classifier_config *cl,
 /*
  * Get action from a string
  */
-gboolean check_action_str (const gchar *data, gint *result);
+gboolean rspamd_action_from_str (const gchar *data, gint *result);
 
 /*
  * Return textual representation of action enumeration
  */
-const gchar * str_action_metric (enum rspamd_metric_action action);
+const gchar * rspamd_action_to_str (enum rspamd_metric_action action);
 
 /*
  * Get action for specific metric
  */
-gint check_metric_action (struct rspamd_task *task,
+gint rspamd_check_action_metric (struct rspamd_task *task,
        double score,
        double *rscore,
        struct metric *metric);
index 606d7de511598600a468884f8f724b01807a42ec..0940871dd0b4595bd55491b049dab3d69d666c69 100644 (file)
@@ -195,7 +195,7 @@ smtp_metric_callback (gpointer key, gpointer value, gpointer ud)
                                "(%s: %c (%s): [%.2f/%.2f/%.2f] [",
                                (gchar *)key,
                                is_spam ? 'T' : 'F',
-                               str_action_metric (action),
+                               rspamd_action_to_str (action),
                                metric_res->score,
                                ms,
                                rs);
index a878677c08fb0f70357c9bec5ab3a56943de37f4..95510388350dc5404091c5899b337f9ec38bc0e5 100644 (file)
@@ -393,7 +393,7 @@ rspamd_rcl_metric_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
                        return FALSE;
                }
                while ((cur = ucl_iterate_object (val, &it, true)) != NULL) {
-                       if (!check_action_str (ucl_object_key (cur), &action_value) ||
+                       if (!rspamd_action_from_str (ucl_object_key (cur), &action_value) ||
                                !ucl_object_todouble_safe (cur, &action_score)) {
                                g_set_error (err,
                                        CFG_RCL_ERROR,
@@ -423,7 +423,7 @@ rspamd_rcl_metric_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
                                act_str = ucl_object_tostring (cur);
                                semicolon = strchr (act_str, ':');
                                if (semicolon != NULL) {
-                                       if (check_action_str (act_str, &action_value)) {
+                                       if (rspamd_action_from_str (act_str, &action_value)) {
                                                action_score = strtod (semicolon + 1, NULL);
                                                action = &metric->actions[action_value];
                                                action->action = action_value;
index 27635f4be371a1f74ac8335d7751c805d0266ad6..97bb2c91ec8e02d0adfcba1715f4ab1e42940043 100644 (file)
@@ -108,7 +108,7 @@ apply_dynamic_conf (const ucl_object_t *top, struct rspamd_config *cfg)
                        while ((it_val = ucl_iterate_object (cur_nm, &nit, true))) {
                                if (ucl_object_find_key (it_val, "name") &&
                                                ucl_object_find_key (it_val, "value")) {
-                                       if (!check_action_str (ucl_object_tostring (
+                                       if (!rspamd_action_from_str (ucl_object_tostring (
                                                        ucl_object_find_key (it_val, "name")), &test_act)) {
                                                msg_err ("unknown action: %s",
                                                                ucl_object_tostring (ucl_object_find_key (it_val,
@@ -485,7 +485,7 @@ add_dynamic_action (struct rspamd_config *cfg,
        gdouble value)
 {
        ucl_object_t *metric, *acts;
-       const gchar *action_name = str_action_metric (action);
+       const gchar *action_name = rspamd_action_to_str (action);
 
        if (cfg->dynamic_conf == NULL) {
                msg_info ("dynamic conf is disabled");
index e70e2d954a79919e043f3348ecc8e3a3e828983b..56f29071c64c2480b82a499b09961517d146ccc9 100644 (file)
@@ -648,7 +648,7 @@ rspamd_metric_result_ucl (struct rspamd_task *task,
        m = mres->metric;
 
        /* XXX: handle settings */
-       action = check_metric_action (task, mres->score, &required_score, m);
+       action = rspamd_check_action_metric (task, mres->score, &required_score, m);
        is_spam = (action == METRIC_ACTION_REJECT);
        if (task->is_skipped) {
                action_char = 'S';
@@ -661,7 +661,7 @@ rspamd_metric_result_ucl (struct rspamd_task *task,
        }
        rspamd_printf_gstring (logbuf, "(%s: %c (%s): [%.2f/%.2f] [",
                m->name, action_char,
-               str_action_metric (action),
+               rspamd_action_to_str (action),
                mres->score, required_score);
 
        obj = ucl_object_typed_new (UCL_OBJECT);
@@ -674,7 +674,7 @@ rspamd_metric_result_ucl (struct rspamd_task *task,
        ucl_object_insert_key (obj, ucl_object_fromdouble (required_score),
                "required_score", 0, false);
        ucl_object_insert_key (obj,
-               ucl_object_fromstring (str_action_metric (action)),
+               ucl_object_fromstring (rspamd_action_to_str (action)),
                "action", 0, false);
 
        if (action == METRIC_ACTION_REWRITE_SUBJECT) {
@@ -835,7 +835,7 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg,
        /* Update stat for default metric */
        metric_res = g_hash_table_lookup (task->results, DEFAULT_METRIC);
        if (metric_res != NULL) {
-               action = check_metric_action (task, metric_res->score, &required_score,
+               action = rspamd_check_action_metric (task, metric_res->score, &required_score,
                                metric_res->metric);
                if (action <= METRIC_ACTION_NOACTION) {
                        task->worker->srv->stat->actions_stat[action]++;
index 9a07fbad9219dad4c7b75327dfeca8c30b7fc0c2..4e6ee01a815f4a48b859a22be080721b67c82353 100644 (file)
@@ -129,7 +129,7 @@ rspamd_roll_history_update (struct roll_history *history,
        }
        else {
                row->score = metric_res->score;
-               row->action = check_metric_action (task, metric_res->score,
+               row->action = rspamd_check_action_metric (task, metric_res->score,
                                &row->required_score,
                                metric_res->metric);
                cbdata.pos = row->symbols;
index e03790f7b1a2bc5c12ed2e54a2bbfb117d9228b9..5eaa620fc4c278b66c07948bc6ef0772ec53f59d 100644 (file)
@@ -142,11 +142,11 @@ rspamd_task_fin (void *arg)
                /* Process all statfiles */
                if (task->classify_pool == NULL) {
                        /* Non-threaded version */
-                       process_statfiles (task);
+                       rspamd_process_statistics (task);
                }
                else {
                        /* Just process composites */
-                       make_composites (task);
+                       rspamd_make_composites (task);
                }
                if (task->cfg->post_filters) {
                        /* More to process */
@@ -173,7 +173,7 @@ rspamd_task_fin (void *arg)
                }
                else {
                        task->state = WAIT_FILTER;
-                       r = process_filters (task);
+                       r = rspamd_process_filters (task);
                        if (r == -1) {
                                task->last_error = "Filter processing error";
                                task->error_code = RSPAMD_FILTER_ERROR;
@@ -311,7 +311,7 @@ rspamd_task_process (struct rspamd_task *task,
        }
        task->skip_extra_filters = !process_extra_filters;
        if (!process_extra_filters || task->cfg->pre_filters == NULL) {
-               r = process_filters (task);
+               r = rspamd_process_filters (task);
                if (r == -1) {
                        task->last_error = "filter processing error";
                        task->error_code = RSPAMD_FILTER_ERROR;
index 0b8a7a79f2409d35dbaaf6dce1ba8eb7f5f9fcbb..350c61ff4e6ea9e7bbc2a370514f72b5817eceed 100644 (file)
@@ -167,7 +167,7 @@ lmtp_read_socket (f_str_t * in, void *arg)
                break;
        case READ_MESSAGE:
                r = process_message (lmtp->task);
-               r = process_filters (lmtp->task);
+               r = rspamd_process_filters (lmtp->task);
                if (r == -1) {
                        return FALSE;
                }
@@ -176,7 +176,7 @@ lmtp_read_socket (f_str_t * in, void *arg)
                        rspamd_dispatcher_pause (lmtp->task->dispatcher);
                }
                else {
-                       process_statfiles (lmtp->task);
+                       rspamd_process_statistics (lmtp->task);
                        task->state = WRITE_REPLY;
                        lmtp_write_socket (lmtp);
                }
index 691bd34455c7d1434b9f933ac618bd3ea80ea875..a4ae9759052fd80e8d849f3ff7a579d8252dc2e3 100644 (file)
@@ -273,7 +273,7 @@ lua_add_actions_global (lua_State *L)
        lua_newtable (L);
 
        for (i = METRIC_ACTION_REJECT; i <= METRIC_ACTION_NOACTION; i++) {
-               lua_pushstring (L, str_action_metric (i));
+               lua_pushstring (L, rspamd_action_to_str (i));
                lua_pushinteger (L, i);
                lua_settable (L, -3);
        }
index e1b0b4f385aacbac7f9a1f3eee1001075589548d..a84ae9a0d58720ce8bb65615df20dfb5519159e9 100644 (file)
@@ -877,7 +877,7 @@ lua_metric_symbol_callback (struct rspamd_task *task, gpointer ud)
                                                        rspamd_mempool_strdup (task->task_pool, opt));
                                        }
                                }
-                               insert_result (task, cd->symbol, flag, opts);
+                               rspamd_task_insert_result (task, cd->symbol, flag, opts);
                        }
                }
                lua_pop (cd->L, nresults);
index 2383a8ae0fbab359d5a83b33a07288285d1d2309..27417547d198d4d7b9d583b02f5be106b6deb970 100644 (file)
@@ -761,7 +761,7 @@ lua_task_insert_result (lua_State * L)
                                        rspamd_mempool_strdup (task->task_pool, param));
                }
 
-               insert_result (task, symbol_name, flag, params);
+               rspamd_task_insert_result (task, symbol_name, flag, params);
        }
        return 0;
 }
@@ -1738,7 +1738,7 @@ lua_task_learn (lua_State *L)
                ret = 2;
        }
        else {
-               if (!learn_task_spam (cl, task, is_spam, &err)) {
+               if (!rspamd_learn_task_spam (cl, task, is_spam, &err)) {
                        lua_pushboolean (L, FALSE);
                        if (err != NULL) {
                                lua_pushstring (L, err->message);
@@ -1811,10 +1811,10 @@ lua_task_get_metric_action (lua_State *L)
        if (task && metric_name) {
                if ((metric_res =
                        g_hash_table_lookup (task->results, metric_name)) != NULL) {
-                       action = check_metric_action (task, metric_res->score,
+                       action = rspamd_check_action_metric (task, metric_res->score,
                                        NULL,
                                        metric_res->metric);
-                       lua_pushstring (L, str_action_metric (action));
+                       lua_pushstring (L, rspamd_action_to_str (action));
                }
                else {
                        lua_pushnil (L);
index 8e5bfac5a3f9ea9c026c19ed4bda4d2f687216f1..bb0113a8b8dec318c464775d9b61a90b6c944103 100644 (file)
@@ -217,7 +217,7 @@ chartable_symbol_callback (struct rspamd_task *task, void *unused)
        while (cur) {
                part = cur->data;
                if (!part->is_empty && check_part (part, task->cfg->raw_mode)) {
-                       insert_result (task, chartable_module_ctx->symbol, 1, NULL);
+                       rspamd_task_insert_result (task, chartable_module_ctx->symbol, 1, NULL);
                }
                cur = g_list_next (cur);
        }
index 74168bcf07ddb8c58699d26328ca93617b00a16e..2a5ac220327465f2c0ac41c62e69aaf052fc3cc4 100644 (file)
@@ -308,13 +308,13 @@ dkim_module_check (struct rspamd_task *task,
        }
 
        if (res == DKIM_REJECT) {
-               insert_result (task, dkim_module_ctx->symbol_reject, score_deny, NULL);
+               rspamd_task_insert_result (task, dkim_module_ctx->symbol_reject, score_deny, NULL);
        }
        else if (res == DKIM_TRYAGAIN) {
-               insert_result (task, dkim_module_ctx->symbol_tempfail, 1, NULL);
+               rspamd_task_insert_result (task, dkim_module_ctx->symbol_tempfail, 1, NULL);
        }
        else if (res == DKIM_CONTINUE) {
-               insert_result (task, dkim_module_ctx->symbol_allow, score_allow, NULL);
+               rspamd_task_insert_result (task, dkim_module_ctx->symbol_allow, score_allow, NULL);
        }
 }
 
@@ -339,13 +339,13 @@ dkim_module_key_handler (rspamd_dkim_key_t *key,
                /* Insert tempfail symbol */
                msg_info ("cannot get key for domain %s", ctx->dns_key);
                if (err != NULL) {
-                       insert_result (task, dkim_module_ctx->symbol_tempfail, 1,
+                       rspamd_task_insert_result (task, dkim_module_ctx->symbol_tempfail, 1,
                                g_list_prepend (NULL,
                                rspamd_mempool_strdup (task->task_pool, err->message)));
 
                }
                else {
-                       insert_result (task, dkim_module_ctx->symbol_tempfail, 1, NULL);
+                       rspamd_task_insert_result (task, dkim_module_ctx->symbol_tempfail, 1, NULL);
                }
        }
 
index 87b9b629c32984f91fd207a3219d9138745177e0..0eddab3b396e571dce6f518405a427ec861f714b 100644 (file)
@@ -610,7 +610,7 @@ fuzzy_io_callback (gint fd, short what, void *arg)
                                        flag,
                                        value,
                                        nval);
-                               insert_result_single (session->task,
+                               rspamd_task_insert_result_single (session->task,
                                        symbol,
                                        nval,
                                        g_list_prepend (NULL,
index 228f3f08bc937031b736cb970da21789b84cf290..76a8b8af59bcbd7235bf665a841f0014f04af48e 100644 (file)
@@ -1018,7 +1018,7 @@ process_regexp_item_threaded (gpointer data, gpointer user_data)
        if (process_regexp_expression (ud->item->expr, ud->item->symbol, ud->task,
                NULL, nL)) {
                g_mutex_lock (workers_mtx);
-               insert_result (ud->task, ud->item->symbol, 1, NULL);
+               rspamd_task_insert_result (ud->task, ud->item->symbol, 1, NULL);
                g_mutex_unlock (workers_mtx);
        }
        remove_async_thread (ud->task->s);
@@ -1085,14 +1085,14 @@ process_regexp_item (struct rspamd_task *task, void *user_data)
                        /* Just call function */
                        if (rspamd_lua_call_expression_func (item->lua_function, task, NULL,
                                &res) && res) {
-                               insert_result (task, item->symbol, 1, NULL);
+                               rspamd_task_insert_result (task, item->symbol, 1, NULL);
                        }
                }
                else {
                        /* Process expression */
                        if (process_regexp_expression (item->expr, item->symbol, task, NULL,
                                NULL)) {
-                               insert_result (task, item->symbol, 1, NULL);
+                               rspamd_task_insert_result (task, item->symbol, 1, NULL);
                        }
                }
        }
index 106b5f019499c61de3d50a5fca40941f3cab9944..11303b33afaea4ad24ef0b185b541d5e197f3dd3 100644 (file)
@@ -243,7 +243,7 @@ spf_check_element (struct spf_addr *addr, struct rspamd_task *task)
        if (res) {
                switch (addr->mech) {
                case SPF_FAIL:
-                       insert_result (task,
+                       rspamd_task_insert_result (task,
                                spf_module_ctx->symbol_fail,
                                1,
                                g_list_prepend (NULL, addr->spf_string));
@@ -251,7 +251,7 @@ spf_check_element (struct spf_addr *addr, struct rspamd_task *task)
                        break;
                case SPF_SOFT_FAIL:
                case SPF_NEUTRAL:
-                       insert_result (task,
+                       rspamd_task_insert_result (task,
                                spf_module_ctx->symbol_softfail,
                                1,
                                g_list_prepend (NULL, addr->spf_string));
@@ -259,7 +259,7 @@ spf_check_element (struct spf_addr *addr, struct rspamd_task *task)
                                        "(SPF): spf softfail");
                        break;
                default:
-                       insert_result (task,
+                       rspamd_task_insert_result (task,
                                spf_module_ctx->symbol_allow,
                                1,
                                g_list_prepend (NULL,                   addr->spf_string));
index 289c30d01b9c24ebd46a66992293888b5d1c1996..ee54cace85343810fe6b7443f09e4b7d5a9d5293 100644 (file)
@@ -825,7 +825,7 @@ process_dns_results (struct rspamd_task *task,
                                (gint)ntohl (bit->bit),
                                (gint)bit->bit & (gint)ntohl (addr));
                        if (((gint)bit->bit & (gint)ntohl (addr)) != 0) {
-                               insert_result (task, bit->symbol, 1,
+                               rspamd_task_insert_result (task, bit->symbol, 1,
                                        g_list_prepend (NULL,
                                        rspamd_mempool_strdup (task->task_pool, url)));
                        }
@@ -833,7 +833,7 @@ process_dns_results (struct rspamd_task *task,
                }
        }
        else {
-               insert_result (task, suffix->symbol, 1,
+               rspamd_task_insert_result (task, suffix->symbol, 1,
                        g_list_prepend (NULL,
                        rspamd_mempool_strdup (task->task_pool, url)));
        }
@@ -1108,7 +1108,7 @@ surbl_tree_url_callback (gpointer key, gpointer value, void *data)
                                                g_regex_match (re, url->string, 0, NULL))) {
                                                /* If no regexp found or founded regexp matches url string register redirector's call */
                                                if (surbl_module_ctx->redirector_symbol != NULL) {
-                                                       insert_result (param->task,
+                                                       rspamd_task_insert_result (param->task,
                                                                surbl_module_ctx->redirector_symbol,
                                                                1,
                                                                g_list_prepend (NULL, red_domain));
index 436cc1526e20a89ea1cc114b63a292fa910fbf7b..e66e5bbb7e4e8d89c483003583df509049fb14db 100644 (file)
@@ -311,7 +311,7 @@ process_smtp_data (struct smtp_session *session)
                        goto err;
                }
                if (session->task->cfg->pre_filters == NULL) {
-                       r = process_filters (session->task);
+                       r = rspamd_process_filters (session->task);
                        if (r == -1) {
                                msg_err ("cannot process message");
                                munmap (session->task->msg->str, st.st_size);
index dc8765ea8723a223d55d1f0c0ce034760db4d820..abf02938fa294b5eec61a93116efbae934e4bc6d 100644 (file)
@@ -322,7 +322,7 @@ start_worker (struct rspamd_worker *worker)
        ctx->classify_pool = NULL;
        if (ctx->classify_threads > 1) {
                nL = rspamd_init_lua_locked (worker->srv->cfg);
-               ctx->classify_pool = g_thread_pool_new (process_statfiles_threaded,
+               ctx->classify_pool = g_thread_pool_new (rspamd_process_statistic_threaded,
                                nL,
                                ctx->classify_threads,
                                TRUE,