Skip to content

Commit

Permalink
[Rework] Finish utils rework
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Aug 14, 2023
1 parent 8f4a672 commit 81d9b6e
Show file tree
Hide file tree
Showing 15 changed files with 198 additions and 233 deletions.
7 changes: 3 additions & 4 deletions src/controller.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*-
* Copyright 2016 Vsevolod Stakhov
/*
* Copyright 2023 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -2086,7 +2086,6 @@ rspamd_controller_handle_learn_common(
task);
task->fin_arg = conn_ent;
task->http_conn = rspamd_http_connection_ref(conn_ent->conn);
;
task->sock = -1;
session->task = task;

Expand Down
40 changes: 7 additions & 33 deletions src/libserver/cfg_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ struct rspamd_external_libs_ctx;
struct rspamd_cryptobox_pubkey;
struct rspamd_dns_resolver;

/**
* Types of rspamd bind lines
*/
enum rspamd_cred_type {
CRED_NORMAL,
CRED_CONTROL,
CRED_LMTP,
CRED_DELIVERY
};

/**
* Logging type
*/
Expand Down Expand Up @@ -94,17 +84,6 @@ struct script_module {
gchar *digest;
};

/**
* Type of lua variable
*/
enum lua_var_type {
LUA_VAR_NUM,
LUA_VAR_BOOLEAN,
LUA_VAR_STRING,
LUA_VAR_FUNCTION,
LUA_VAR_UNKNOWN
};

enum rspamd_symbol_group_flags {
RSPAMD_SYMBOL_GROUP_NORMAL = 0u,
RSPAMD_SYMBOL_GROUP_DISABLED = (1u << 0u),
Expand Down Expand Up @@ -356,12 +335,12 @@ struct rspamd_config {
#ifdef WITH_GPERF_TOOLS
gchar *profile_path;
#endif
gdouble unknown_weight; /**< weight of unknown symbols */
gdouble grow_factor; /**< grow factor for metric */
GHashTable *symbols; /**< weights of symbols in metric */
const gchar *subject; /**< subject rewrite string */
GHashTable *groups; /**< groups of symbols */
struct rspamd_action *actions; /**< all actions of the metric */
gdouble unknown_weight; /**< weight of unknown symbols */
gdouble grow_factor; /**< grow factor for metric */
GHashTable *symbols; /**< weights of symbols in metric */
const gchar *subject; /**< subject rewrite string */
GHashTable *groups; /**< groups of symbols */
void *actions; /**< all actions of the metric (opaque type) */

gboolean one_shot_mode; /**< rules add only one symbol */
gboolean check_text_attachements; /**< check text attachements as text */
Expand Down Expand Up @@ -730,7 +709,7 @@ gboolean rspamd_config_is_enabled_from_ucl(rspamd_mempool_t *pool,
/*
* Get action from a string
*/
gboolean rspamd_action_from_str(const gchar *data, gint *result);
gboolean rspamd_action_from_str(const gchar *data, enum rspamd_action_type *result);

/*
* Return textual representation of action enumeration
Expand All @@ -739,11 +718,6 @@ const gchar *rspamd_action_to_str(enum rspamd_action_type action);

const gchar *rspamd_action_to_str_alt(enum rspamd_action_type action);

/*
* Resort all actions (needed to operate with thresholds)
*/
void rspamd_actions_sort(struct rspamd_config *cfg);

/**
* Parse radix tree or radix map from ucl object
* @param cfg configuration object
Expand Down
5 changes: 0 additions & 5 deletions src/libserver/cfg_file_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
#define RSPAMD_CFG_FILE_PRIVATE_H

#include "cfg_file.h"
#include "../../contrib/mumhash/mum.h"
#define HASH_CASELESS
#include "uthash_strcase.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -33,10 +30,8 @@ struct rspamd_action {
enum rspamd_action_type action_type;
int flags; /* enum rspamd_action_flags */
guint priority;
gint lua_handler_ref; /* If special handling is needed */
gdouble threshold;
gchar *name;
struct UT_hash_handle hh; /* Index by name */
};

#ifdef __cplusplus
Expand Down

0 comments on commit 81d9b6e

Please sign in to comment.