From ea585b11e57b40046426597e09a550b3214d6b3a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 28 Aug 2015 13:51:49 +0100 Subject: Add documentation for the changes. --- doc/markdown/modules/regexp.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'doc/markdown/modules/regexp.md') diff --git a/doc/markdown/modules/regexp.md b/doc/markdown/modules/regexp.md index 59ddaa67e..4964a4d2c 100644 --- a/doc/markdown/modules/regexp.md +++ b/doc/markdown/modules/regexp.md @@ -97,5 +97,32 @@ Many of these functions are just legacy but they are supported in terms of compa ### Lua atoms -Lua atoms now can be lua global functions names. This is supported merely for compatibility and it is -a subject of future redesign. \ No newline at end of file +Lua atoms now can be lua global functions names or callbacks. This is +a compatibility feature for previously written rules. + +### Regexp objects + +From rspamd 1.0, it is possible to add more power to regexp rules by using of +table notation while writing rules. A table can have the following fields: + +- `callback`: lua callback for the rule +- `re`: regular expression (mutually exclusive with `callback` option) +- `condition`: function of task that determines when a rule should be executed +- `score`: default score +- `description`: default description +- `one_shot`: default one shot settings + +Here is an example of table form definition of regexp rule: + +~~~lua +config['regexp']['RE_TEST'] = { + re = '/test/P', + score = 10.0, + condition = function(task) + if task:get_header('Subject') then + return true + end + return false + end, +} +~~~ \ No newline at end of file -- cgit v1.2.3