From: Vsevolod Stakhov Date: Fri, 2 Jan 2015 11:09:48 +0000 (+0000) Subject: Update docs. X-Git-Tag: 0.8.0~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=93924542f9532e34ba9241ef009a4ce8f78eca9b;p=rspamd.git Update docs. --- diff --git a/doc/markdown/modules/fuzzy_check.md b/doc/markdown/modules/fuzzy_check.md index d363220ac..b85496a5a 100644 --- a/doc/markdown/modules/fuzzy_check.md +++ b/doc/markdown/modules/fuzzy_check.md @@ -135,7 +135,7 @@ fuzzy_check { If a hash has value `10`, then a symbol `FUZZY_DENIED` with weight of `2.0` will be added. If a hash has value `100500`, then `FUZZY_DENIED` will have weight `10.0`. -## Learning for fuzzy_check +## Learning fuzzy_check Module `fuzzy_check` also allows to learn messages. You can use `rspamc` command or connect to the **controller** worker using HTTP protocol. For learning you must check @@ -158,3 +158,5 @@ or delete hashes: rspamc -f fuzzy_del ... +On learning, rspamd sends commands to **all** servers inside specific rule. On check, +rspamd selects a server in round-robin matter. \ No newline at end of file diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index c7bf86c18..0a81e3d8b 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -475,12 +475,53 @@ static const struct luaL_reg tasklib_m[] = { }; /* Textpart methods */ +/*** + * @module rspamd_textpart + * This module provides access to text parts found in a message + */ + +/*** + * @method textpart:get_content() + * Get parsed content of a part + * @return {string} text contained in the part + */ LUA_FUNCTION_DEF (textpart, get_content); +/*** + * @method textpart:get_length() + * Get length of the text inside the part + * @return {integer} the lenght of text part in bytes + */ LUA_FUNCTION_DEF (textpart, get_length); +/*** + * @method textpart:is_empty() + * Check whether a part is empty + * @return {bool} `true` if a part is empty + */ LUA_FUNCTION_DEF (textpart, is_empty); +/*** + * @method textpart:is_html() + * Check whether a part contains HTML + * @return {bool} `true` if a part html part + */ LUA_FUNCTION_DEF (textpart, is_html); +/*** + * @method textpart:get_fuzzy() + * Get fuzzy hash for a message + * @return {string} fuzzy hash of the part + */ LUA_FUNCTION_DEF (textpart, get_fuzzy); +/*** + * @method textpart:get_language() + * Return short language code detected for the part + * @return {string} language code for the part or nil if language has not been detected + */ LUA_FUNCTION_DEF (textpart, get_language); +/*** + * @method textpart:compare_distance(part) + * Compares two parts + * @param {textpart} another text part + * @return {number} similarity rate from 0.0 (different parts) to 1.0 (equal parts) + */ LUA_FUNCTION_DEF (textpart, compare_distance); static const struct luaL_reg textpartlib_m[] = { @@ -496,6 +537,27 @@ static const struct luaL_reg textpartlib_m[] = { }; /* Mimepart methods */ + +/*** + * @module rspamd_mimepart + * This module provides access to mime parts found in a message +@example +rspamd_config.MISSING_CONTENT_TYPE = function(task) + local parts = task:get_parts() + if parts and table.maxn(parts) > 1 then + -- We have more than one part + for _,p in ipairs(parts) do + local ct = p:get_header('Content-Type') + -- And some parts have no Content-Type header + if not ct then + return true + end + end + end + return false +end + */ + /*** * @method mimepart:get_header(name[, case_sensitive]) * Get decoded value of a header specified with optional case_sensitive flag.