aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-23 12:15:28 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-23 12:15:28 +0100
commit614767d4fe3a3b98e1c9d9e58cabcfcda2229fa8 (patch)
tree533fba1c8a4a36764e02641d2a6c40bb38114e38 /src/libmime
parente67faf530b5c86de91f476a1d17918d2dd08f466 (diff)
downloadrspamd-614767d4fe3a3b98e1c9d9e58cabcfcda2229fa8.tar.gz
rspamd-614767d4fe3a3b98e1c9d9e58cabcfcda2229fa8.zip
Refactor function names.
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/filter.c36
-rw-r--r--src/libmime/filter.h26
-rw-r--r--src/libmime/smtp_utils.c2
3 files changed, 32 insertions, 32 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index d26f26e1d..209e00e88 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -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)
diff --git a/src/libmime/filter.h b/src/libmime/filter.h
index f1f128f63..69c20bdd1 100644
--- a/src/libmime/filter.h
+++ b/src/libmime/filter.h
@@ -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);
diff --git a/src/libmime/smtp_utils.c b/src/libmime/smtp_utils.c
index 606d7de51..0940871dd 100644
--- a/src/libmime/smtp_utils.c
+++ b/src/libmime/smtp_utils.c
@@ -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);