summaryrefslogtreecommitdiffstats
path: root/src/lua/rspamd.luadoc
blob: 7f2c5ccc9622407f5fd057d26b0c11c3de22e7a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
--- Rspamd interaction package
-- contains several subclasses:
-- config - for parsing config files
-- metric - for handling metrics callbacks
-- task - for interaction with task object
-- message - gate to GMime functions
-- textpart - a single textual part of message
module Rspamd

--- Each lua module has global rspamd_config that can be used for getting config
-- options and registering callbacks (via metric interface)

------------------------------------- CONFIG -----------------------------------------
--
--- Get module option from config
-- @param mname module name
-- @param option option
-- @return string with value
function config:get_module_opt (mname, option)

--- Get all module options as a table like ['param' => 'value']
-- @param mname module name
-- @return table with options
function config:get_all_opt (mname)

--- Get specified metric
-- @param name metric name
-- @return metric object
function config:get_metric (name)

------------------------------------- METRIC -----------------------------------------

--- Register symbol in metric
-- @param symbol name of symbol
-- @param weight weight of symbol
-- @param callback function that would be called as callback for symbol
function metric:register_symbol (symbol, weight, callback)

------------------------------------- TASK -------------------------------------------

--- Get message object from task
-- @return message object
function task:get_message ()

--- Insert result to specified metric with specified weight (obsoleted)
-- @param metric metric name
-- @param symbol symbol name
-- @param weight weight of symbol
function task:insert_result (metric, symbol, weight)

--- Get all urls as array
-- @return array of urls in textual form
function task:get_urls ()

--- Get all text parts
-- @return array of textpart objects
function task:get_text_parts ()

--- Get raw headers
-- @return string that contains raw headers
function task:get_raw_headers ()

--- Get array of received headers
-- @return array of received headers that are tables itself
function task:get_received_headers ()

--- Resolve A record using rspamd async resolver
-- @param host host to resolve
-- @param callback name of callback function
function task:resolve_dns_a (host, callback)

--- Resolve PTR record using rspamd async resolver
-- @param host host to resolve
-- @param callback name of callback function
function task:resolve_dns_ptr (host, callback)

--- Callback function for dns resolving
-- @param task task object
-- @param to_resolve ptr or a record that was resolved
-- @param results results of dns query (array or nil)
-- @param err resolver error or nil
function dns_cb(task, to_resolve, results, err)

------------------------------------- TEXTPART ---------------------------------------

--- Get part's content
-- @return string that contains part's content
function textpart:get_content ()

--- Check if part is empty
-- @return boolean value
function textpart:is_empty ()

--- Check if part is html
-- @return boolean value
function textpart:is_html ()

--- Get part's fuzzy
-- @return string that contains part's fuzzy
function textpart:get_fuzzy ()

------------------------------------- MESSAGE ----------------------------------------

--- Get message subject
-- @return message subject
function message:get_subject ()

--- Get message id
-- @return message id
function message:get_message_id ()

--- Get sender of message
-- @return sender's credits
function message:get_sender ()

--- Get reply-to field
-- @return value of reply-to header
function message:get_reply_to ()

--- Get header
-- @param header_name name of header
-- @return array of headers with specified name
function message:get_header (header_name)