summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-02 11:09:48 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-02 11:09:48 +0000
commit93924542f9532e34ba9241ef009a4ce8f78eca9b (patch)
treebee976a966b7eb9fe6e67c5a666af3f6cc8a0fc8
parent675616059cc7efe021ff76cd065d9c5a93eb40a9 (diff)
downloadrspamd-93924542f9532e34ba9241ef009a4ce8f78eca9b.tar.gz
rspamd-93924542f9532e34ba9241ef009a4ce8f78eca9b.zip
Update docs.
-rw-r--r--doc/markdown/modules/fuzzy_check.md4
-rw-r--r--src/lua/lua_task.c62
2 files changed, 65 insertions, 1 deletions
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 <flag> 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.