#include "ottery.h"
#include "unix-std.h"
#include "libserver/milter.h"
+#include "libmime/lang_detection.h"
#include "contrib/zstd/zstd.h"
#ifdef HAVE_NETINET_TCP_H
gchar *spam_header;
/* Sessions cache */
void *sessions_cache;
+ /* Language detector */
+ struct rspamd_lang_detector *lang_det;
};
enum rspamd_backend_flags {
if (ctx->has_self_scan) {
/* Additional initialisation needed */
- rspamd_worker_init_scanner (worker, ctx->ev_base, ctx->resolver);
+ rspamd_worker_init_scanner (worker, ctx->ev_base, ctx->resolver,
+ &ctx->lang_det);
}
if (worker->srv->cfg->enable_sessions_cache) {
* Rspamd worker implementation
*/
-#include <libserver/rspamd_control.h>
-#include <src/libserver/rspamd_control.h>
#include "config.h"
#include "libutil/util.h"
#include "libutil/map.h"
#include "worker_private.h"
#include "utlist.h"
#include "libutil/http_private.h"
-#include "monitored.h"
+#include "libmime/lang_detection.h"
#include "unix-std.h"
#include "lua/lua_common.h"
void
rspamd_worker_init_scanner (struct rspamd_worker *worker,
struct event_base *ev_base,
- struct rspamd_dns_resolver *resolver)
+ struct rspamd_dns_resolver *resolver,
+ struct rspamd_lang_detector **plang_det)
{
rspamd_stat_init (worker->srv->cfg, ev_base);
g_ptr_array_add (worker->finish_actions,
RSPAMD_CONTROL_MONITORED_CHANGE,
rspamd_worker_monitored_handler,
worker->srv->cfg);
+
+ *plang_det = rspamd_language_detector_init (worker->srv->cfg);
}
/*
/* XXX: stupid default */
ctx->keys_cache = rspamd_keypair_cache_new (256);
- rspamd_worker_init_scanner (worker, ctx->ev_base, ctx->resolver);
+ rspamd_worker_init_scanner (worker, ctx->ev_base, ctx->resolver,
+ &ctx->lang_det);
rspamd_lua_run_postloads (ctx->cfg->lua_state, ctx->cfg, ctx->ev_base,
worker);
static const guint64 rspamd_worker_magic = 0xb48abc69d601dc1dULL;
+struct rspamd_lang_detector;
+
struct rspamd_worker_ctx {
guint64 magic;
/* Events base */
struct rspamd_cryptobox_keypair *key;
/* Keys cache */
struct rspamd_keypair_cache *keys_cache;
+ /* Language detector */
+ struct rspamd_lang_detector *lang_det;
};
-
/*
* Init scanning routines
*/
void rspamd_worker_init_scanner (struct rspamd_worker *worker,
struct event_base *ev_base,
- struct rspamd_dns_resolver *resolver);
+ struct rspamd_dns_resolver *resolver,
+ struct rspamd_lang_detector **plang_det);
/*
* Called on forced timeout