PageSourceSearch

https://docs.rspamd.com/assets/js/20d46fab.16a039ca.js

js rspamd.com collected 2026-10-02 02:31:15 UTC 178,052 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkrspamd_docs=self.webpackChunkrspamd_docs||[]).push([[7616],{28453:(e,s,n)=>{n.d(s,{R:()=>l,x:()=>t});var r=n(96540);const d={},i=r.createContext(d);function l(e){const s=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function t(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:l(e.components),r.createElement(i.Provider,{value:s},e.children)}},69559:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>c,contentTitle:()=>t,default:()=>o,frontMatter:()=>l,metadata:()=>r,toc:()=>a});const r=JSON.parse('{"id":"lua/rspamd_task","title":"Module rspamd_task","description":"Module rspamd_task","source":"@site/docs/lua/rspamd_task.md","sourceDirName":"lua","slug":"/lua/rspamd_task","permalink":"/lua/rspamd_task","draft":false,"unlisted":false,"editUrl":"https://github.com/rspamd/docs.rspamd.com/edit/master/docs/lua/rspamd_task.md","tags":[],"version":"current","frontMatter":{"title":"Module rspamd_task"},"sidebar":"docs","previous":{"title":"Module rspamd_sqlite3","permalink":"/lua/rspamd_sqlite3"},"next":{"title":"Module rspamd_tcp","permalink":"/lua/rspamd_tcp"}}');var d=n(74848),i=n(28453);const l={title:"Module rspamd_task"},t=void 0,c={},a=[{value:"Module <code>rspamd_task</code>",id:"m0f406",level:2},{value:"Example:",id:"example",level:3},{value:"Brief content:",id:"brief-content",level:3},{value:"Functions",id:"functions",level:2},{value:"Function <code>rspamd_task.create([cfg])</code>",id:"f493f2",level:3},{value:"Function <code>rspamd_task.load_from_file(filename[, cfg])</code>",id:"f993c3",level:3},{value:"Function <code>rspamd_task.load_from_string(message[, cfg])</code>",id:"fc9459",level:3},{value:"Methods",id:"methods",level:2},{value:"Method <code>task:get_message()</code>",id:"mcea29",level:3},{value:"Method <code>task:set_message(msg)</code>",id:"mafbc6",level:3},{value:"Method <code>task:process_message()</code>",id:"m5ed22",level:3},{value:"Method <code>task:get_cfg()</code>",id:"m4378b",level:3},{value:"Method <code>task:get_mempool()</code>",id:"m44275",level:3},{value:"Method <code>task:get_session()</code>",id:"mc3cbf",level:3},{value:"Method <code>task:set_session(session)</code>",id:"m69057",level:3},{value:"Method <code>task:get_ev_base()</code>",id:"m3e7ef",level:3},{value:"Method <code>task:get_worker()</code>",id:"meb3ea",level:3},{value:"Method <code>task:insert_result([enforce_symbol,]symbol, weight[, option1, ...])</code>",id:"mcf9a8",level:3},{value:"Example:",id:"example-1",level:3},{value:"Method <code>task:insert_result_named(shadow_result, [enforce_symbol,]symbol, weight[, option1, ...])</code>",id:"m594e0",level:3},{value:"Method <code>task:adjust_result(symbol, score[, option1, ...])</code>",id:"m7dffd",level:3},{value:"Method <code>task:remove_result(symbol[, shadow_result])</code>",id:"m0b646",level:3},{value:"Method <code>task:set_pre_result(action, [message, [module], [score], [priority], [flags])</code>",id:"m0426b",level:3},{value:"Example:",id:"example-2",level:3},{value:"Method <code>task:has_pre_result()</code>",id:"m0b392",level:3},{value:"Method <code>task:append_message(message, [category])</code>",id:"mcccb2",level:3},{value:"Example:",id:"example-3",level:3},{value:"Method <code>task:get_urls([need_emails|list_protos][, need_images])</code>",id:"m1860f",level:3},{value:"Example:",id:"example-4",level:3},{value:"Method <code>task:get_urls_filtered([{flags_include}, [{flags_exclude}]], [{protocols_mask}])</code>",id:"mbf9d0",level:3},{value:"Method <code>task:has_urls([need_emails])</code>",id:"m58ca2",level:3},{value:"Method <code>task:inject_url(url)</code>",id:"m780f5",level:3},{value:"Method <code>task:get_content()</code>",id:"mf492f",level:3},{value:"Method <code>task:get_filename()</code>",id:"m40112",level:3},{value:"Method <code>task:get_rawbody()</code>",id:"m92834",level:3},{value:"Method <code>task:get_emails()</code>",id:"m798cb",level:3},{value:"Method <code>task:inject_part(type, content[, original_part])</code>",id:"m95a07",level:3},{value:"Method <code>task:get_text_parts([include_virtual])</code>
1",id:"m9bf42",level:3},{value:"Method <code>task:get_parts([include_virtual])</code>",id:"m2ba8a",level:3},{value:"Method <code>task:get_meta_words([how=&#39;stem&#39;])</code>",id:"mf3554",level:3},{value:"Method <code>task:get_request_header(name)</code>",id:"m2af55",level:3},{value:"Method <code>task:set_request_header(name, value)</code>",id:"m99831",level:3},{value:"Method <code>task:get_subject()</code>",id:"m908c3",level:3},{value:"Method <code>task:get_header(name[, case_sensitive])</code>",id:"m9ce3b",level:3},{value:"Method <code>task:has_header(name[, case_sensitive])</code>",id:"mb152f",level:3},{value:"Method <code>task:get_header_raw(name[, case_sensitive])</code>",id:"me24f6",level:3},{value:"Method <code>task:get_header_full(name[, case_sensitive[, need_modified]])</code>",id:"mb4834",level:3},{value:"Example:",id:"example-5",level:3},{value:"Method <code>task:get_header_count(name[, case_sensitive])</code>",id:"m3816b",level:3},{value:"Method <code>task:get_raw_headers()</code>",id:"mb4f78",level:3},{value:"Method <code>task:get_headers([need_modified=false])</code>",id:"mf151d",level:3},{value:"Method <code>task:modify_header(name, mods)</code>",id:"m3b1f8",level:3},{value:"Method <code>task:get_received_headers()</code>",id:"mef364",level:3},{value:"Method <code>task:get_queue_id()</code>",id:"m0dee6",level:3},{value:"Method <code>task:get_uid()</code>",id:"m3a6ec",level:3},{value:"Method <code>task:get_uuid()</code>",id:"m43981",level:3},{value:"Method <code>task:get_resolver()</code>",id:"m01f06",level:3},{value:"Example:",id:"example-6",level:3},{value:"Method <code>task:set_resolver(resolver)</code>",id:"m39c38",level:3},{value:"Method <code>task:inc_dns_req()</code>",id:"m5b56a",level:3},{value:"Method <code>task:get_dns_req()</code>",id:"mab347",level:3},{value:"Method <code>task:has_recipients([type])</code>",id:"m493a9",level:3},{value:"Method <code>task:get_recipients([type])</code>",id:"m75e80",level:3},{value:"Method <code>task:get_principal_recipient()</code>",id:"mc5168",level:3},{value:"Method <code>task:get_reply_sender()</code>",id:"mafd2b",level:3},{value:"Method <code>task:set_recipients([type], {rcpt1, rcpt2...}, [how=&#39;add&#39;])</code>",id:"m248af",level:3},{value:"Method <code>task:has_from([type])</code>",id:"m03d01",level:3},{value:"Method <code>task:get_from([type])</code>",id:"m91f50",level:3},{value:"Method <code>task:set_from(type, addr)</code>",id:"m91c24",level:3},{value:"Method <code>task:get_mail_esmtp_args()</code>",id:"m4ecda",level:3},{value:"Example:",id:"example-7",level:3},{value:"Method <code>task:get_rcpt_esmtp_args([idx])</code>",id:"mbccdc",level:3},{value:"Example:",id:"example-8",level:3},{value:"Method <code>task:get_user()</code>",id:"m8ae15",level:3},{value:"Method <code>task:set_user([username])</code>",id:"mbe11a",level:3},{value:"Method <code>task:get_from_ip()</code>",id:"mea49b",level:3},{value:"Method <code>task:set_from_ip(str)</code>",id:"ma2e65",level:3},{value:"Method <code>task:get_client_ip()</code>",id:"m8cb37",level:3},{value:"Method <code>task:get_helo()</code>",id:"m9df17",level:3},{value:"Method <code>task:get_hostname()</code>",id:"m8a697",level:3},{value:"Method <code>task:get_images()</code>",id:"m21f46",level:3},{value:"Method <code>task:get_archives()</code>",id:"mb868a",level:3},{value:"Method <code>task:get_dkim_results()</code>",id:"mee6d7",level:3},{value:"Method <code>task:get_symbol(name, [shadow_result_name])</code>",id:"mb89bf",level:3},{value:"Method <code>task:get_symbol_regexp(regexp, [shadow_result_name])</code>",id:"m7db46",level:3},{value:"Method <code>task:get_symbols_all()</code>",id:"m4de24",level:3},{value:"Method <code>task:get_symbols([shadow_result_name])</code>",id:"m6717b",level:3},{value:"Method <code>task:get_groups([need_private])</code>",id:"m5d831",level:3},{value:"Method <code>task:get_symbols_numeric()</code>",id:"mf9c5d",level:3},{value:"Method <code>task:get_symbols_tokens()</code>",id:"me3b91",level:3},{value:"Method <code>task:process_ann_tokens(symbols, ann_tokens, offset, [min])</code>",id:"m99f5c",level:3},{value:"Method <code>task:has_symbol(name, [shadow_result_name])</code>
1",id:"m824ce",level:3},{value:"Method <code>task:has_symbol_regexp(regexp, [shadow_result_name])</code>",id:"m54487",level:3},{value:"Method <code>task:enable_symbol(name)</code>",id:"mcd676",level:3},{value:"Method <code>task:disable_symbol(name)</code>",id:"m99a01",level:3},{value:"Method <code>task:disable_all_symbols([skip_mask])</code>",id:"mb6e45",level:3},{value:"Method <code>task:get_date(type[, gmt])</code>",id:"m0693a",level:3},{value:"Example:",id:"example-9",level:3},{value:"Method <code>task:get_message_id()</code>",id:"mbbbc7",level:3},{value:"Method <code>task:get_timeval([raw])</code>",id:"mf77b0",level:3},{value:"Method <code>task:get_scan_time([set])</code>",id:"mfb31c",level:3},{value:"Method <code>task:get_metric_result()</code>",id:"mc326f",level:3},{value:"Method <code>task:get_metric_score(name)</code>",id:"m5519f",level:3},{value:"Method <code>task:get_metric_threshold(action)</code>",id:"m40b9d",level:3},{value:"Method <code>task:get_metric_action(name)</code>",id:"m9b471",level:3},{value:"Method <code>task:set_metric_score(name, score)</code>",id:"me3814",level:3},{value:"Method <code>task:set_metric_subject(subject)</code>",id:"m1bbbc",level:3},{value:"Method <code>task:learn(is_spam[, classifier)</code>",id:"m62c3f",level:3},{value:"Method <code>task:set_settings(obj)</code>",id:"m0efc8",level:3},{value:"Method <code>task:set_settings_id(id)</code>",id:"m0ffb9",level:3},{value:"Method <code>task:merge_and_apply_settings(layers)</code>",id:"m4b954",level:3},{value:"Method <code>task:get_settings()</code>",id:"mf449c",level:3},{value:"Method <code>task:get_fuzzy_results()</code>",id:"m59a66",level:3},{value:"Method <code>task:lookup_settings(key)</code>",id:"me8055",level:3},{value:"Method <code>task:get_metadata()</code>",id:"m959e9",level:3},{value:"Method <code>task:get_metadata_field(key)</code>",id:"maaf7a",level:3},{value:"Method <code>task:get_settings_id()</code>",id:"m19d7f",level:3},{value:"Method <code>task:set_milter_reply(obj)</code>",id:"m70081",level:3},{value:"Example:",id:"example-10",level:3},{value:"Method <code>task:process_re(params)</code>",id:"mef9bb",level:3},{value:"Method <code>task:cache_set(key, value)</code>",id:"m58b3b",level:3},{value:"Method <code>task:cache_get(key)</code>",id:"m0b56c",level:3},{value:"Method <code>task:get_size()</code>",id:"m3f5ec",level:3},{value:"Method <code>task:set_flag(flag_name[, set])</code>",id:"m09dd4",level:3},{value:"Example:",id:"example-11",level:3},{value:"Method <code>task:has_flag(flag_name)</code>",id:"m679aa",level:3},{value:"Method <code>task:get_flags()</code>",id:"m8ab26",level:3},{value:"Method <code>task:get_digest()</code>",id:"me8faa",level:3},{value:"Method <code>task:store_in_file([mode|table])</code>",id:"mbcdef",level:3},{value:"Method <code>task:get_protocol_reply([flags])</code>",id:"mce7a7",level:3},{value:"Method <code>task:headers_foreach(callback, [params])</code>",id:"m1a53d",level:3},{value:"Method <code>task:disable_action(action)</code>",id:"m54e2f",level:3},{value:"Method <code>task:get_newlines_type()</code>",id:"m671d9",level:3},{value:"Method <code>task:get_stat_tokens()</code>",id:"mcdecd",level:3},{value:"Method <code>task:lookup_words(map, function({o, n, s, f}) ... end)</code>",id:"mf5c96",level:3},{value:"Method <code>task:get_dns_req()</code>",id:"mab347",level:3},{value:"Method <code>task:add_timer(timeout, callback)</code>",id:"m21222",level:3},{value:"Method <code>task:rewrite_html_urls(callback)</code>",id:"m2ebd6",level:3},{value:"Method <code>task:get_html_urls()</code>",id:"m5ed23",level:3}];function h(e){const s={a:"a",code:"code",h2:"h2",h3:"h3",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(s.h2,{id:"m0f406",children:["Module ",(0,d.jsx)(s.code,{children:"rspamd_task"})]}),"\n",(0,d.jsx)(s.p,{children:"This module provides routines for tasks manipulation in rspamd. Tasks usually\nrepresent messages being scanned, and this API provides access to such elements\nas headers, symbols, metrics and so on and so forth. Normally, task objects\nare passed to the lua callbacks allowing to check 
1specific properties of messages\nand add the corresponding symbols to the scan's results."}),"\n",(0,d.jsx)(s.h3,{id:"example",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"rspamd_config.DATE_IN_PAST = function(task)\n\tlocal dm = task:get_date{format = 'message', gmt = true}\n\tlocal dt = task:get_date{format = 'connect', gmt = true}\n\t-- A day\n\tif dt - dm > 86400 then\n\t\treturn true\n\tend\n\n\treturn false\nend\n"})}),"\n",(0,d.jsx)(s.h3,{id:"brief-content",children:"Brief content:"}),"\n",(0,d.jsxs)(s.p,{children:[(0,d.jsx)(s.strong,{children:"Functions"}),":"]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,d.jsxs)(s.table,{children:[(0,d.jsx)(s.thead,{children:(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.th,{children:"Function"}),(0,d.jsx)(s.th,{children:"Description"})]})}),(0,d.jsxs)(s.tbody,{children:[(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#f493f2",children:(0,d.jsx)(s.code,{children:"rspamd_task.create([cfg])"})})}),(0,d.jsx)(s.td,{children:"Create a new empty task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#f993c3",children:(0,d.jsx)(s.code,{children:"rspamd_task.load_from_file(filename[, cfg])"})})}),(0,d.jsx)(s.td,{children:"Loads a message from specific file."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#fc9459",children:(0,d.jsx)(s.code,{children:"rspamd_task.load_from_string(message[, cfg])"})})}),(0,d.jsx)(s.td,{children:"Loads a message from specific file."})]})]})]}),"\n",(0,d.jsxs)(s.p,{children:[(0,d.jsx)(s.strong,{children:"Methods"}),":"]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,d.jsxs)(s.table,{children:[(0,d.jsx)(s.thead,{children:(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.th,{children:"Method"}),(0,d.jsx)(s.th,{children:"Description"})]})}),(0,d.jsxs)(s.tbody,{children:[(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mcea29",children:(0,d.jsx)(s.code,{children:"task:get_message()"})})}),(0,d.jsx)(s.td,{children:"Returns task raw message content as opaque text."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mafbc6",children:(0,d.jsx)(s.code,{children:"task:set_message(msg)"})})}),(0,d.jsx)(s.td,{children:"Updates task message with another message; It also parses a message to."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m5ed22",children:(0,d.jsx)(s.code,{children:"task:process_message()"})})}),(0,d.jsx)(s.td,{children:"Parses message."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m4378b",children:(0,d.jsx)(s.code,{children:"task:get_cfg()"})})}),(0,d.jsx)(s.td,{children:"Get configuration object for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m44275",children:(0,d.jsx)(s.code,{children:"task:get_mempool()"})})}),(0,d.jsx)(s.td,{children:"Returns memory pool valid for a lifetime of task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mc3cbf",children:(0,d.jsx)(s.code,{children:"task:get_session()"})})}),(0,d.jsx)(s.td,{children:"Returns asynchronous session object that is used by many rspamd asynchronous."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m69057",children:(0,d.jsx)(s.code,{children:"task:set_session(session)"})})}),(0,d.jsx)(s.td,{children:"Sets new async session for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m3e7ef",children:(0,d.jsx)(s.code,{children:"task:get_ev_base()"})})}),(0,d.jsx)(s.td,{children:"Return asynchronous event base for using in callbacks and resolver."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#meb3ea",children:(0,d.jsx)(s.code,{children:"task:get_worker()"})})}),(0,d.jsx)(s.td,{children:"Returns a worker object associated with the task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mcf9a8",children:(0,d.jsx)(s.code,{children:"task:insert_result([enforce_symbol,]symbol, weight[, option1, ...])"})})}),(0,d.jsx)(s.td,{children:"Insert specific symbol to the tasks scanning results assigning the initial."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m594e0",children:(0,d.jsx)(s.code,{children:"task:insert_result_named(shadow_result, [enforce_symbol,]symbol, weight[, option1, ...])"})})}),(0,d.jsx)(s.td,{children:"Insert specific symbol to the tasks scanning results assigning the initial."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m7dffd",children:(0,d.jsx)(s.code,{children:"task:adjust_result(symbol, score[, option1, ...])"})})}),(0,d.jsx)(s.td,{children:"Alters the existing symbol's score to a new score."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m0b646",children:(0,d.jsx)(s.code,{children:"task:remove_result(symbol[, shadow_result])"})})}),(0,d.jsx)(s.td,{children:"Removes the symbol from a named or unnamed/default result."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m0426b",children:(0,d.jsx)(s.code,{children:"task:set_pre_result(action, [message, [module], [score], [priority], [flags])"})})}),(0,d.jsx)(s.td,{children:"Sets pre-result for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m0b392",children:(0,d.jsx)(s.code,{children:"task:has_pre_result()"})})}),(0,d.jsx)(s.td,{children:"Returns true if task has some pre-result being set."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mcccb2",children:(0,d.jsx)(s.code,{children:"task:append_message(message, [category])"})})}),(0,d.jsx)(s.td,{children:"Adds a message to scanning output."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:"[`task:get_urls([need_emails"}),(0,d.jsx)(s.td,{children:"list_protos][, need_images])`](#m1860f)"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mbf9d0",children:(0,d.jsx)(s.code,{children:"task:get_urls_filtered([{flags_include}, [{flags_exclude}]], [{protocols_mask}])"})})}),(0,d.jsx)(s.td,{children:"Get urls managed by either exclude or include flags list."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m58ca2",children:(0,d.jsx)(s.code,{children:"task:has_urls([need_emails])"})})}),(0,d.jsx)(s.td,{children:"Returns 'true' if a task has urls listed."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m780f5",children:(0,d.jsx)(s.code,{children:"task:inject_url(url)"})})}),(0,d.jsx)(s.td,{children:"Inserts an url into a task (useful for redirected urls)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mf492f",children:(0,d.jsx)(s.code,{children:"task:get_content()"})})}),(0,d.jsx)(s.td,{children:"Get raw content for the specified task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m40112",children:(0,d.jsx)(s.code,{children:"task:get_filename()"})})}),(0,d.jsx)(s.td,{children:"Returns filename for a specific task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m92834",children:(0,d.jsx)(s.code,{children:"task:get_rawbody()"})})}),(0,d.jsx)(s.td,{children:"Get raw body for the specified task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m798cb",children:(0,d.jsx)(s.code,{children:"task:get_emails()"})})}),(0,d.jsx)(s.td,{children:"Get all email addresses found in a message."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m95a07",children:(0,d.jsx)(s.code,{children:"task:inject_part(type, content[, original_part])"})})}),(0,d.jsx)(s.td,{children:"Injects a virtual mime part into the task structure."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m9bf42",children:(0,d.jsx)(s.code,{children:"task:get_text_parts([include_virtual])"})})}),(0,d.jsx)(s.td,{children:"Get all text (and HTML) parts found in a message."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m2ba8a",children:(0,d.jsx)(s.code,{children:"task:get_parts([include_virtual])"})})}),(0,d.jsx)(s.td,{children:"Get all mime parts found in a message."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mf3554",children:(0,d.jsx)(s.code,{children:"task:get_meta_words([how='stem'])"})})}
1),(0,d.jsx)(s.td,{children:"Get meta words from task (subject and displayed names)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m2af55",children:(0,d.jsx)(s.code,{children:"task:get_request_header(name)"})})}),(0,d.jsx)(s.td,{children:"Get value of a HTTP request header."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m99831",children:(0,d.jsx)(s.code,{children:"task:set_request_header(name, value)"})})}),(0,d.jsx)(s.td,{children:"Set value of a HTTP request header."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m908c3",children:(0,d.jsx)(s.code,{children:"task:get_subject()"})})}),(0,d.jsx)(s.td,{children:"Returns task subject (either from the protocol override or from a header)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m9ce3b",children:(0,d.jsx)(s.code,{children:"task:get_header(name[, case_sensitive])"})})}),(0,d.jsx)(s.td,{children:"Get decoded value of a header specified with optional case_sensitive flag."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mb152f",children:(0,d.jsx)(s.code,{children:"task:has_header(name[, case_sensitive])"})})}),(0,d.jsx)(s.td,{children:"Get decoded value of a header specified with optional case_sensitive flag."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#me24f6",children:(0,d.jsx)(s.code,{children:"task:get_header_raw(name[, case_sensitive])"})})}),(0,d.jsx)(s.td,{children:"Get raw value of a header specified with optional case_sensitive flag."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mb4834",children:(0,d.jsx)(s.code,{children:"task:get_header_full(name[, case_sensitive[, need_modified]])"})})}),(0,d.jsx)(s.td,{children:"Get raw value of a header specified with optional case_sensitive flag."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m3816b",children:(0,d.jsx)(s.code,{children:"task:get_header_count(name[, case_sensitive])"})})}),(0,d.jsx)(s.td,{children:"Lightweight version if you need just a header's count."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mb4f78",children:(0,d.jsx)(s.code,{children:"task:get_raw_headers()"})})}),(0,d.jsx)(s.td,{children:"Get all undecoded headers of a message as a string."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mf151d",children:(0,d.jsx)(s.code,{children:"task:get_headers([need_modified=false])"})})}),(0,d.jsx)(s.td,{children:"Get all headers of a message in the same format as get_header_full."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m3b1f8",children:(0,d.jsx)(s.code,{children:"task:modify_header(name, mods)"})})}),(0,d.jsxs)(s.td,{children:["Modify an existing or non-existing header with the name ",(0,d.jsx)(s.code,{children:"name"}),"."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mef364",children:(0,d.jsx)(s.code,{children:"task:get_received_headers()"})})}),(0,d.jsx)(s.td,{children:"Returns a list of tables of parsed received headers."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m0dee6",children:(0,d.jsx)(s.code,{children:"task:get_queue_id()"})})}),(0,d.jsx)(s.td,{children:"Returns queue ID of the message being processed."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m3a6ec",children:(0,d.jsx)(s.code,{children:"task:get_uid()"})})}),(0,d.jsx)(s.td,{children:"Returns ID of the task being processed."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m43981",children:(0,d.jsx)(s.code,{children:"task:get_uuid()"})})}),(0,d.jsx)(s.td,{children:"Returns UUID v7 of the task (time-ordered, suitable for cross-system correlation)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m01f06",children:(0,d.jsx)(s.code,{children:"task:get_resolver()"})})}),(0,d.jsx)(s.td,{children:"Returns ready to use rspamd_resolver object suitable for making asynchronous DNS requests."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m39c38",children:(0,d.jsx)(s.code,{children:"task:set_resolver(resolver)"})})}),(0,d.jsx)(s.td,{children:"Sets rspamd_resolver for a specified task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m5b56a",children:(0,d.jsx)(s.code,{children:"task:inc_dns_req()"})})}),(0,d.jsx)(s.td,{children:"Increment number of DNS requests for the task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mab347",children:(0,d.jsx)(s.code,{children:"task:get_dns_req()"})})}),(0,d.jsx)(s.td,{children:"Get number of dns requests being sent in the task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m493a9",children:(0,d.jsx)(s.code,{children:"task:has_recipients([type])"})})}),(0,d.jsx)(s.td,{children:"Return true if there are SMTP or MIME recipients for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m75e80",children:(0,d.jsx)(s.code,{children:"task:get_recipients([type])"})})}),(0,d.jsx)(s.td,{children:"Return SMTP or MIME recipients for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mc5168",children:(0,d.jsx)(s.code,{children:"task:get_principal_recipient()"})})}
1),(0,d.jsxs)(s.td,{children:["Returns a single string with so called ",(0,d.jsx)(s.code,{children:"principal recipient"})," for a message."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mafd2b",children:(0,d.jsx)(s.code,{children:"task:get_reply_sender()"})})}),(0,d.jsx)(s.td,{children:"Returns a single string with address that should be used to reply on a message."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m248af",children:(0,d.jsx)(s.code,{children:"task:set_recipients([type], {rcpt1, rcpt2...}, [how='add'])"})})}),(0,d.jsx)(s.td,{children:"Sets recipients for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m03d01",children:(0,d.jsx)(s.code,{children:"task:has_from([type])"})})}),(0,d.jsx)(s.td,{children:"Return true if there is SMTP or MIME sender for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m91f50",children:(0,d.jsx)(s.code,{children:"task:get_from([type])"})})}),(0,d.jsx)(s.td,{children:"Return SMTP or MIME sender for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m91c24",children:(0,d.jsx)(s.code,{children:"task:set_from(type, addr)"})})}),(0,d.jsx)(s.td,{children:"Sets sender for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m4ecda",children:(0,d.jsx)(s.code,{children:"task:get_mail_esmtp_args()"})})}),(0,d.jsx)(s.td,{children:"Returns a table of ESMTP arguments from MAIL FROM command (milter only)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mbccdc",children:(0,d.jsx)(s.code,{children:"task:get_rcpt_esmtp_args([idx])"})})}),(0,d.jsx)(s.td,{children:"Returns a table of ESMTP arguments from RCPT TO command (milter only)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m8ae15",children:(0,d.jsx)(s.code,{children:"task:get_user()"})})}),(0,d.jsx)(s.td,{children:"Returns authenticated user name for this task if specified by an MTA."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mbe11a",children:(0,d.jsx)(s.code,{children:"task:set_user([username])"})})}),(0,d.jsx)(s.td,{children:"Sets or resets (if username is not specified) authenticated user name for this task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mea49b",children:(0,d.jsx)(s.code,{children:"task:get_from_ip()"})})}),(0,d.jsxs)(s.td,{children:["Returns ",(0,d.jsx)(s.a,{href:"/lua/rspamd_ip",children:"rspamd_ip"})," object of a sender that is provided by MTA."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#ma2e65",children:(0,d.jsx)(s.code,{children:"task:set_from_ip(str)"})})}),(0,d.jsx)(s.td,{children:"Set tasks's IP address based on the passed string."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m8cb37",children:(0,d.jsx)(s.code,{children:"task:get_client_ip()"})})}),(0,d.jsxs)(s.td,{children:["Returns ",(0,d.jsx)(s.a,{href:"/lua/rspamd_ip",children:"rspamd_ip"})," object of a client connected to rspamd (normally, it is an IP address of MTA)."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m9df17",children:(0,d.jsx)(s.code,{children:"task:get_helo()"})})}),(0,d.jsx)(s.td,{children:"Returns the value of SMTP helo provided by MTA."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m8a697",children:(0,d.jsx)(s.code,{children:"task:get_hostname()"})})}),(0,d.jsx)(s.td,{children:"Returns the value of sender's hostname provided by MTA."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m21f46",children:(0,d.jsx)(s.code,{children:"task:get_images()"})})}),(0,d.jsxs)(s.td,{children:["Returns list of all images found in a task as a table of ",(0,d.jsx)(s.code,{children:"rspamd_image"}),"."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mb868a",children:(0,d.jsx)(s.code,{children:"task:get_archives()"})})}),(0,d.jsxs)(s.td,{children:["Returns list of all archives found in a task as a table of ",(0,d.jsx)(s.code,{children:"rspamd_archive"}),"."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mee6d7",children:(0,d.jsx)(s.code,{children:"task:get_dkim_results()"})})}),(0,d.jsx)(s.td,{children:"Returns list of all dkim check results as table of maps."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mb89bf",children:(0,d.jsx)(s.code,{children:"task:get_symbol(name, [shadow_result_name])"})})}),(0,d.jsx)(s.td,{children:"@method task:get_symbol(names_table, [shadow_result_name])."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m7db46",children:(0,d.jsx)(s.code,{children:"task:get_symbol_regexp(regexp, [shadow_result_name])"})})}),(0,d.jsxs)(s.td,{children:["Returns a map ",(0,d.jsx)(s.code,{children:"{symbol_name -> info_table}"})," for every fired symbol whose."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m4de24",children:(0,d.jsx)(s.code,{children:"task:get_symbols_all
1()"})})}),(0,d.jsx)(s.td,{children:"Returns array of symbols matched in default metric with all metadata."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m6717b",children:(0,d.jsx)(s.code,{children:"task:get_symbols([shadow_result_name])"})})}),(0,d.jsx)(s.td,{children:"Returns array of all symbols matched for this task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m5d831",children:(0,d.jsx)(s.code,{children:"task:get_groups([need_private])"})})}),(0,d.jsx)(s.td,{children:"Returns a map [group -> group_score] for matched group."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mf9c5d",children:(0,d.jsx)(s.code,{children:"task:get_symbols_numeric()"})})}),(0,d.jsx)(s.td,{children:"Returns array of all symbols matched for this task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#me3b91",children:(0,d.jsx)(s.code,{children:"task:get_symbols_tokens()"})})}),(0,d.jsx)(s.td,{children:"Returns array of all symbols as statistical tokens."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m99f5c",children:(0,d.jsx)(s.code,{children:"task:process_ann_tokens(symbols, ann_tokens, offset, [min])"})})}),(0,d.jsx)(s.td,{children:"Processes ann tokens."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m824ce",children:(0,d.jsx)(s.code,{children:"task:has_symbol(name, [shadow_result_name])"})})}),(0,d.jsx)(s.td,{children:"@method task:has_symbol(names_table, [shadow_result_name])."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m54487",children:(0,d.jsx)(s.code,{children:"task:has_symbol_regexp(regexp, [shadow_result_name])"})})}),(0,d.jsx)(s.td,{children:"Checks whether any fired symbol has a name matching the supplied."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mcd676",children:(0,d.jsx)(s.code,{children:"task:enable_symbol(name)"})})}),(0,d.jsx)(s.td,{children:"Enable specified symbol for this particular task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m99a01",children:(0,d.jsx)(s.code,{children:"task:disable_symbol(name)"})})}),(0,d.jsx)(s.td,{children:"Disable specified symbol for this particular task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mb6e45",children:(0,d.jsx)(s.code,{children:"task:disable_all_symbols([skip_mask])"})})}),(0,d.jsx)(s.td,{children:"Disable execution of every symbol for this particular task except those whose."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m0693a",children:(0,d.jsx)(s.code,{children:"task:get_date(type[, gmt])"})})}),(0,d.jsx)(s.td,{children:"Returns timestamp for a connection or for a MIME message."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mbbbc7",children:(0,d.jsx)(s.code,{children:"task:get_message_id()"})})}),(0,d.jsxs)(s.td,{children:["Returns message identifier from the ",(0,d.jsx)(s.code,{children:"Message-ID"})," header."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mf77b0",children:(0,d.jsx)(s.code,{children:"task:get_timeval([raw])"})})}),(0,d.jsx)(s.td,{children:"Returns the timestamp for a task start processing time."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mfb31c",children:(0,d.jsx)(s.code,{children:"task:get_scan_time([set])"})})}),(0,d.jsx)(s.td,{children:"Returns 2 floating point numbers."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mc326f",children:(0,d.jsx)(s.code,{children:"task:get_metric_result()"})})}),(0,d.jsx)(s.td,{children:"Get full result of a metric as a table."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m5519f",children:(0,d.jsx)(s.code,{children:"task:get_metric_score(name)"})})}),(0,d.jsxs)(s.td,{children:["Get the current score of metric ",(0,d.jsx)(s.code,{children:"name"})," (must be nil or 'default') ."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m40b9d",children:(0,d.jsx)(s.code,{children:"task:get_metric_threshold(action)"})})}),(0,d.jsxs)(s.td,{children:["Get the current threshold of the action ",(0,d.jsx)(s.code,{children:"action"})," for the default metric."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m9b471",children:(0,d.jsx)(s.code,{children:"task:get_metric_action(name)"})})}),(0,d.jsxs)(s.td,{children:["Get the current action of metric ",(0,d.jsx)(s.code,{children:"name"})," (must be nil or 'default')."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#me3814",children:(0,d.jsx)(s.code,{children:"task:set_metric_score(name, score)"})})}),(0,d.jsxs)(s.td,{children:["Set the current score of metric ",(0,d.jsx)(s.code,{children:"name"}),"."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m
11bbbc",children:(0,d.jsx)(s.code,{children:"task:set_metric_subject(subject)"})})}),(0,d.jsx)(s.td,{children:"Set the subject in the default metric."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m62c3f",children:(0,d.jsx)(s.code,{children:"task:learn(is_spam[, classifier)"})})}),(0,d.jsxs)(s.td,{children:["Learn classifier ",(0,d.jsx)(s.code,{children:"classifier"})," with the task."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m0efc8",children:(0,d.jsx)(s.code,{children:"task:set_settings(obj)"})})}),(0,d.jsx)(s.td,{children:"Set users settings object for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m0ffb9",children:(0,d.jsx)(s.code,{children:"task:set_settings_id(id)"})})}),(0,d.jsx)(s.td,{children:"Set users settings id for a task (must be registered previously)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m4b954",children:(0,d.jsx)(s.code,{children:"task:merge_and_apply_settings(layers)"})})}),(0,d.jsx)(s.td,{children:"Merge multiple settings layers and apply the result."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mf449c",children:(0,d.jsx)(s.code,{children:"task:get_settings()"})})}),(0,d.jsx)(s.td,{children:"Gets users settings object for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m59a66",children:(0,d.jsx)(s.code,{children:"task:get_fuzzy_results()"})})}),(0,d.jsx)(s.td,{children:"Returns an array of fuzzy matches found during the fuzzy check."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#me8055",children:(0,d.jsx)(s.code,{children:"task:lookup_settings(key)"})})}),(0,d.jsx)(s.td,{children:"Gets users settings object with the specified key for a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m959e9",children:(0,d.jsx)(s.code,{children:"task:get_metadata()"})})}),(0,d.jsx)(s.td,{children:"Gets the custom metadata object supplied with a /checkv3 multipart request."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#maaf7a",children:(0,d.jsx)(s.code,{children:"task:get_metadata_field(key)"})})}),(0,d.jsx)(s.td,{children:"Gets a single top-level field from the /checkv3 metadata object."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m19d7f",children:(0,d.jsx)(s.code,{children:"task:get_settings_id()"})})}),(0,d.jsx)(s.td,{children:"Get numeric hash of settings id if specified for this task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m70081",children:(0,d.jsx)(s.code,{children:"task:set_milter_reply(obj)"})})}),(0,d.jsx)(s.td,{children:"Set special reply for milter."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mef9bb",children:(0,d.jsx)(s.code,{children:"task:process_re(params)"})})}),(0,d.jsx)(s.td,{children:"Processes the specified regexp and returns number of captures (cached or new)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m58b3b",children:(0,d.jsx)(s.code,{children:"task:cache_set(key, value)"})})}),(0,d.jsx)(s.td,{children:"Store some value to the task cache."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m0b56c",children:(0,d.jsx)(s.code,{children:"task:cache_get(key)"})})}),(0,d.jsx)(s.td,{children:"Returns cached value or nil if nothing is cached."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m3f5ec",children:(0,d.jsx)(s.code,{children:"task:get_size()"})})}),(0,d.jsx)(s.td,{children:"Returns size of the task in bytes (that includes headers + parts size)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m09dd4",children:(0,d.jsx)(s.code,{children:"task:set_flag(flag_name[, set])"})})}),(0,d.jsx)(s.td,{children:"Set specific flag for task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m679aa",children:(0,d.jsx)(s.code,{children:"task:has_flag(flag_name)"})})}),(0,d.jsx)(s.td,{children:"Checks for a specific flag in task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m8ab26",children:(0,d.jsx)(s.code,{children:"task:get_flags()"})})}),(0,d.jsx)(s.td,{children:"Get list of flags for task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#me8faa",children:(0,d.jsx)(s.code,{children:"task:get_digest()"})})}),(0,d.jsx)(s.td,{children:"Returns message's unique digest (32 hex symbols)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:"[`task:store_in_file([mode"}),(0,d.jsx)(s.td,{children:"table])`](#mbcdef)"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mce7a7",children:(0,d.jsx)(s.code,{children:"task:get_protocol_reply([flags])"})})}),(0,d.jsxs)(s.td,{children:["This method being called from a ",(0,d.jsx)(s.strong,{children:"postfilter"})," will return reply for a message."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m
11a53d",children:(0,d.jsx)(s.code,{children:"task:headers_foreach(callback, [params])"})})}),(0,d.jsxs)(s.td,{children:["This method calls ",(0,d.jsx)(s.code,{children:"callback"})," for each header that satisfies some condition."]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m54e2f",children:(0,d.jsx)(s.code,{children:"task:disable_action(action)"})})}),(0,d.jsx)(s.td,{children:"Disables some action for this task (e.g."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m671d9",children:(0,d.jsx)(s.code,{children:"task:get_newlines_type()"})})}),(0,d.jsx)(s.td,{children:"Returns the most frequent newlines type met in a task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mcdecd",children:(0,d.jsx)(s.code,{children:"task:get_stat_tokens()"})})}),(0,d.jsx)(s.td,{children:"Returns list of tables the statistical tokens."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mf5c96",children:(0,d.jsx)(s.code,{children:"task:lookup_words(map, function({o, n, s, f}) ... end)"})})}),(0,d.jsx)(s.td,{children:"Matches words in a task (including meta words) against some map (set, regexp and so on)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#mab347",children:(0,d.jsx)(s.code,{children:"task:get_dns_req()"})})}),(0,d.jsx)(s.td,{children:"Get number of dns requests being sent in the task."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m21222",children:(0,d.jsx)(s.code,{children:"task:add_timer(timeout, callback)"})})}),(0,d.jsx)(s.td,{children:"Creates a delayed execution task for the specific callback at given timeout (in seconds)."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m2ebd6",children:(0,d.jsx)(s.code,{children:"task:rewrite_html_urls(callback)"})})}),(0,d.jsx)(s.td,{children:"Rewrites URLs in HTML parts using the specified Lua callback function."})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.a,{href:"#m5ed23",children:(0,d.jsx)(s.code,{children:"task:get_html_urls()"})})}),(0,d.jsx)(s.td,{children:"Extracts all URLs from HTML parts without rewriting."})]})]})]}),"\n",(0,d.jsx)(s.h2,{id:"functions",children:"Functions"}),"\n",(0,d.jsxs)(s.p,{children:["The module ",(0,d.jsx)(s.code,{children:"rspamd_task"})," defines the following functions."]}),"\n",(0,d.jsxs)(s.h3,{id:"f493f2",children:["Function ",(0,d.jsx)(s.code,{children:"rspamd_task.create([cfg])"})]}),"\n",(0,d.jsx)(s.p,{children:"Create a new empty task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_task}"}),": new task"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"f993c3",children:["Function ",(0,d.jsx)(s.code,{children:"rspamd_task.load_from_file(filename[, cfg])"})]}),"\n",(0,d.jsx)(s.p,{children:"Loads a message from specific file"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean,rspamd_task|error}"}),": status + new task or error message"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"fc9459",children:["Function ",(0,d.jsx)(s.code,{children:"rspamd_task.load_from_string(message[, cfg])"})]}),"\n",(0,d.jsx)(s.p,{children:"Loads a message from specific file"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean,rspamd_task|error}"}),": status + new task or error message"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsx)(s.h2,{id:"methods",children:"Methods"}),"\n",(0,d.jsxs)(s.p,{children:["The module ",(0,d.jsx)(s.code,{children:"rspamd_task"})," defines the following methods."]}),"\n",(0,d.jsxs)(s.h3,{id:"mcea29",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_message()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns task raw message content as opaque text"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_text}"}),": task raw content"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mafbc6",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_message(msg)"})]}),"\n",(0,d.jsx)(s.p,{children:"Updates task message with another message; It also parses a message to\nfill the internal structures.\nInput might be a string, a lua_text or a table of the former stuff."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"msg {string/text/table}"}),": new message to set"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean,number}"}),": if a message has been set + its raw size"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m5ed22",children:["Method ",(0,d.jsx)(s.code,{children:"task:process_message()"})]}),"\n",(0,d.jsx)(s.p,{children:"Parses message"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m4378b",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_cfg()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get configuration object for a task."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_config}"}),": (config.md)[configuration object] for the task"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m44275",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_mempool()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns memory pool valid for a lifetime of task. It is used internally by\nmany rspamd routines."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_mempool}"}),": memory pool object"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mc3cbf",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_session()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns asynchronous session object that is used by many rspamd asynchronous\nutilities internally."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_session}"}),": session object"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m69057",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_session(session)"})]}),"\n",(0,d.jsx)(s.p,{children:"Sets new async session for a task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m3e7ef",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_ev_base()"})]}),"\n",(0,d.jsx)(s.p,{children:"Return asynchronous event base for using in callbacks and resolver."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_ev_base}"}),": event base"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"meb3ea",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_worker()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns a worker object associated with the task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_worker}"}),": worker object"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mcf9a8",children:["Method ",(0,d.jsx)(s.code,{children:"task:insert_result([enforce_symbol,]symbol, weight[, option1, ...])"})]}),"\n",(0,d.jsx)(s.p,{children:"Insert specific symbol to the tasks scanning results assigning the initial\nweight to it."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"enforce_symbol {boolean}"}),": if represented and true, then insert symbol even if it is not registered in the metric"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"symbol {string}"}),": symbol to insert"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"weight {number}"}),": initial weight (this weight is multiplied by the metric weight)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"options {string}"}),": list of optional options attached to a symbol inserted"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsx)(s.h3,{id:"example-1",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"local function cb(task)\n\tif task:get_header('Some header') then\n\t\ttask:insert_result('SOME_HEADER', 1.0, 'Got some header')\n\tend\nend\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m594e0",children:["Method ",(0,d.jsx)(s.code,{children:"task:insert_result_named(shadow_result, [enforce_symbol,]symbol, weight[, option1, ...])"})]}),"\n",(0,d.jsx)(s.p,{children:"Insert specific symbol to the tasks scanning results assigning the initial\nweight to it."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"shadow_result {string}"}),": name of shadow result"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"enforce_symbol {boolean}"}),": if represented and true, then insert symbol even if it is not registered in the metric"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"symbol {string}"}),": symbol to insert"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"weight {number}"}),": initial weight (this weight is multiplied by the metric weight)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"options {string}"}),": list of optional options attached to a symbol inserted"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m7dffd",children:["Method ",(0,d.jsx)(s.code,{children:"task:adjust_result(symbol, score[, option1, ...])"})]}),"\n",(0,d.jsx)(s.p,{children:"Alters the existing symbol's score to a new score. It is not affected by\nmetric score or grow factor. You can also add new options\nusing this method. Symbol must be already inserted into metric or an error\nwill be emitted."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"symbol {string}"}),": symbol to adjust"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"score {number}"}),": this value is NOT multiplied by the metric score"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"options {string/table}"}),": list of optional options attached to a symbol adjusted"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m0b646",children:["Method ",(0,d.jsx)(s.code,{children:"task:remove_result(symbol[, shadow_result])"})]}),"\n",(0,d.jsx)(s.p,{children:"Removes the symbol from a named or unnamed/default result"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"symbol {string}"}),": symbol to remove"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"shadow_result {string}"}),": name of shadow result"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": true if a symbol has been removed"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m0426b",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_pre_result(action, [message, [module], [score], [priority], [flags])"})]}),"\n",(0,d.jsxs)(s.p,{children:["Sets pre-result for a task. It is used in pre-filters to 
1specify early result\nof the task scanned. If a pre-filter sets some result, then further processing\nmay be skipped. For selecting action it is possible to use global table\n",(0,d.jsx)(s.code,{children:"rspamd_actions"})," or a string value:"]}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"reject"}),": reject message permanently"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"add header"}),": add spam header"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"rewrite subject"}),": rewrite subject to spam subject"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"greylist"}),": greylist message"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"accept"})," or ",(0,d.jsx)(s.code,{children:"no action"}),": whitelist message"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"quarantine"}),": quarantine the message; depending on the MTA, it can be done via HOLD.\nNote: the message parameter must be ",(0,d.jsx)(s.code,{children:"nil"})," for proper operation."]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"discard"}),": drop the message from the queue without returning an error to the sender."]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Actions should be defined in the ",(0,d.jsx)(s.code,{children:"actions.conf"})," configuration file."]}),"\n",(0,d.jsx)(s.p,{children:"This function also accepts a table from Rspamd 2.6 with the following keys:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"action: string required"}),"\n",(0,d.jsx)(s.li,{children:"message: string"}),"\n",(0,d.jsx)(s.li,{children:"module: string"}),"\n",(0,d.jsx)(s.li,{children:"score: number"}),"\n",(0,d.jsx)(s.li,{children:"priority: integer"}),"\n",(0,d.jsx)(s.li,{children:"flags: flags string"}),"\n",(0,d.jsx)(s.li,{children:"result: named result if needed"}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"action {rspamd_action or string}"}),": a numeric or string action value"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"message {string}"}),": action message"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"module {string}"}),": optional module name"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"score {number/nil}"}),": optional explicit score"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"priority {number/nil}"}),": optional explicit priority"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"flags {string/nil}"}),": optional flags (e.g. 'least' for least action)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsx)(s.h3,{id:"example-2",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"local function cb(task)\n\tlocal gr = task:get_header('Greylist')\n\tif gr and gr == 'greylist' then\n\t\ttask:set_pre_result('soft reject', 'Greylisting required')\n\tend\nend\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m0b392",children:["Method ",(0,d.jsx)(s.code,{children:"task:has_pre_result()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns true if task has some pre-result being set.\nIf result has been set this function also returns pre result action,\nmessage and module as strings in this order."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean,[string,string,string]}"}),": true if task has some pre-result being set"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mcccb2",children:["Method ",(0,d.jsx)(s.code,{children:"task:append_message(message, [category])"})]}),"\n",(0,d.jsx)(s.p,{children:"Adds a message to scanning output."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"message {string}"}),": no description"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"message {category}"}),": category"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsx)(s.h3,{id:"example-3",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"local function cb(task)\n\ttask:append_message('Example message')\nend\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m1860f",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_urls([need_emails|list_protos][, need_images])"})]}
1),"\n",(0,d.jsxs)(s.p,{children:["Get all URLs found in a message. Telephone urls and emails are not included unless explicitly asked in ",(0,d.jsx)(s.code,{children:"list_protos"}),"\nContent URLs (extracted from PDF and other content types) are included by default unless\n",(0,d.jsx)(s.code,{children:"include_content_urls"})," global option is set to false."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"need_emails {boolean}"}),": if ",(0,d.jsx)(s.code,{children:"true"})," then return also email urls, this can be a comma separated string of protocols desired or a table (e.g. ",(0,d.jsx)(s.code,{children:"mailto"})," or ",(0,d.jsx)(s.code,{children:"telephone"}),")"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"need_images {boolean}"}),": return urls from images (",(0,d.jsx)(s.img,{src:"..."}),") as well"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table rspamd_url}"}),": list of all urls found"]}),"\n"]}),"\n",(0,d.jsx)(s.h3,{id:"example-4",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"local function phishing_cb(task)\n\tlocal urls = task:get_urls({'https', 'http'});\n\n\tif urls then\n\t\tfor _,url in ipairs(urls) do\n\t\t\tif url:is_phished() then\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\tend\n\treturn false\nend\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mbf9d0",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_urls_filtered([{flags_include}, [{flags_exclude}]], [{protocols_mask}])"})]}),"\n",(0,d.jsx)(s.p,{children:"Get urls managed by either exclude or include flags list"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"If flags include are nil then all but excluded urls are returned"}),"\n",(0,d.jsx)(s.li,{children:"If flags exclude are nil then only included explicitly urls are returned"}),"\n",(0,d.jsx)(s.li,{children:"If both parameters are nil then all urls are included"}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"flags_include {table}"}),": included flags"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"flags_exclude {table}"}),": excluded flags"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"protocols_mask {table}"}),": include only specific protocols"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table rspamd_url}"}),": list of urls matching conditions"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m58ca2",children:["Method ",(0,d.jsx)(s.code,{children:"task:has_urls([need_emails])"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns 'true' if a task has urls listed"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"need_emails {boolean}"}),": if ",(0,d.jsx)(s.code,{children:"true"})," then return also email urls"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": true if a task has urls (urls or emails if ",(0,d.jsx)(s.code,{children:"need_emails"})," is true)"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m780f5",children:["Method ",(0,d.jsx)(s.code,{children:"task:inject_url(url)"})]}),"\n",(0,d.jsx)(s.p,{children:"Inserts an url into a task (useful for redirected urls)"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"url {lua_url}"}),": url to inject"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mf492f",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_content()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get raw content for the specified task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{text}"}),": the data contained in the task"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m40112",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_filename()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns filename for a specific task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string|nil}"}),": filename or nil if unknown"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m92834",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_rawbody()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get raw body for the specified task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{text}"}),": the data contained in the task"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m798cb",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_emails()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get all email addresses found in a message."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table rspamd_url}"}),": list of all email addresses found"]}
1),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m95a07",children:["Method ",(0,d.jsx)(s.code,{children:"task:inject_part(type, content[, original_part])"})]}),"\n",(0,d.jsx)(s.p,{children:"Injects a virtual mime part into the task structure"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type {string}"}),': part type: "text" for plain text, "html" for HTML that goes through the HTML parser']}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"content {string/text/table}"}),": part content (accepts string, rspamd_text, or table of rspamd_text chunks - will be efficiently concatenated in C)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"original_part {rspamd_mimepart}"}),": optional original mime part that this injected part is derived from (sets parent relationship)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": true if part was injected"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m9bf42",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_text_parts([include_virtual])"})]}),"\n",(0,d.jsx)(s.p,{children:"Get all text (and HTML) parts found in a message. By default, injected/virtual parts are excluded."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"include_virtual {boolean}"}),": if true, include injected/virtual parts (default: false)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table rspamd_text_part}"}),": list of text parts"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m2ba8a",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_parts([include_virtual])"})]}),"\n",(0,d.jsx)(s.p,{children:"Get all mime parts found in a message. By default, injected/virtual parts are excluded."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"include_virtual {boolean}"}),": if true, include injected/virtual parts (default: false)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table rspamd_mime_part}"}),": list of mime parts"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mf3554",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_meta_words([how='stem'])"})]}),"\n",(0,d.jsx)(s.p,{children:"Get meta words from task (subject and displayed names)"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"stem"}),": stemmed words (default)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"norm"}),": normalised words (utf normalised + lowercased)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"raw"}),": raw words in utf (if possible)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"full"}),": list of tables, each table has the following fields:\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"[1] - stemmed word"}),"\n",(0,d.jsx)(s.li,{children:"[2] - normalised word"}),"\n",(0,d.jsx)(s.li,{children:"[3] - raw word"}),"\n",(0,d.jsx)(s.li,{children:"[4] - flags (table of strings)"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m2af55",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_request_header(name)"})]}),"\n",(0,d.jsx)(s.p,{children:"Get value of a HTTP request header."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of header to get"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_text}"}),": value of an HTTP header"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m99831",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_request_header(name, value)"})]}),"\n",(0,d.jsx)(s.p,{children:"Set value of a HTTP request header. If value is omitted, then a header is removed"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of header to get"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"value {rspamd_text/string}"}),": new header's value"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m908c3",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_subject()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns task subject (either from the protocol override or from a header)"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": value of a subject (decoded)"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m9ce3b",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_header(name[, case_sensitive])"})]}),"\n",(0,d.jsx)(s.p,{children:"Get decoded value of a header specified with optional case_sensitive flag.\nBy default headers are searched in caseless matter."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of header to get"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"case_sensitive {boolean}"}),": case sensitiveness flag to search for a header"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": decoded value of a header"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mb152f",children:["Method ",(0,d.jsx)(s.code,{children:"task:has_header(name[, case_sensitive])"})]}),"\n",(0,d.jsx)(s.p,{children:"Get decoded value of a header specified with optional case_sensitive flag.\nBy default headers are searched in the case insensitive matter."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of header to get"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"case_sensitive {boolean}"}),": case sensitiveness flag to search for a header"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": true if header exists"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"me24f6",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_header_raw(name[, case_sensitive])"})]}),"\n",(0,d.jsx)(s.p,{children:"Get raw value of a header specified with optional case_sensitive flag.\nBy default headers are searched in caseless matter."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of header to get"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"case_sensitive {boolean}"}),": case sensitiveness flag to search for a header"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": raw value of a header"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mb4834",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_header_full(name[, case_sensitive[, need_modified]])"})]}),"\n",(0,d.jsx)(s.p,{children:"Get raw value of a header specified with optional case_sensitive flag.\nBy default headers are searched in caseless matter. This method returns more\ninformation about the header as a list of tables with the following structure:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name"})," - name of a header"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"value"})," - raw value of a header"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"decoded"})," - decoded value of a header"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"tab_separated"})," - ",(0,d.jsx)(s.code,{children:"true"})," if a header and a value are separated by ",(0,d.jsx)(s.code,{children:"tab"})," character"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"empty_separator"})," - ",(0,d.jsx)(s.code,{children:"true"})," if there are no separator between a header and a value"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of header to get"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"case_sensitive {boolean}"}),": case sensitiveness flag to search for a header"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"need_modified {boolean}"}),": return a modified value of a header if presented"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{list of tables}"}),": all values of a header as specified above"]}),"\n"]}),"\n",(0,d.jsx)(s.h3,{id:"example-5",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"function check_header_delimiter_tab(task, header_name)\n\tfor _,rh in ipairs(task:get_header_full(header_name)) do\n\t\tif rh['tab_separated'] then return true end\n\tend\n\treturn false\nend\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m3816b",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_header_count(name[, case_sensitive])"})]}),"\n",(0,d.jsx)(s.p,{children:"Lightweight version if you need just a header's count"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"By default headers are searched in caseless matter."}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of header to get"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"case_sensitive {boolean}"}),": case sensitiveness flag to search for a header"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{number}"}),": number of header's occurrences or 0 if not found"]}
1),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mb4f78",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_raw_headers()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get all undecoded headers of a message as a string"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_text}"}),": all raw headers for a message as opaque text"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mf151d",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_headers([need_modified=false])"})]}),"\n",(0,d.jsx)(s.p,{children:"Get all headers of a message in the same format as get_header_full"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table of headers data}"}),": all headers for a message"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m3b1f8",children:["Method ",(0,d.jsx)(s.code,{children:"task:modify_header(name, mods)"})]}),"\n",(0,d.jsxs)(s.p,{children:["Modify an existing or non-existing header with the name ",(0,d.jsx)(s.code,{children:"name"}),"\nMods is a table with the following structure:"]}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:'{\n"add" = { {order, value}, {order, value} },\n"remove" = {order, order, order}'}),"\n",(0,d.jsx)(s.li,{children:"}\nModifications are evaluated in order: remove, add, so headers are first\nremoved (if any) and then added\nOrder in remove starts from 1, where 0 means 'remove all', and negative value means\nremove from the end\nOrder in addition means addition from the top: 0 means the most top header, 1 one after, etc\nnegative order means addition to the end, e.g. -1 is appending header."}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{bool}"}),": true if header could be modified (always true unless we don't have an unparsed message)"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mef364",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_received_headers()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns a list of tables of parsed received headers. A tables returned have\nthe following structure:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"from_hostname"})," - string that represents hostname provided by a peer"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"from_ip"})," - string representation of sending IP address"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"real_hostname"})," - hostname as resolved by MTA"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"real_ip"})," - rspamd_ip object representing sending IP address"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"by_hostname"})," - MTA hostname"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"proto"})," - protocol, e.g. ESMTP or ESMTPS"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"timestamp"})," - received timestamp"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"for"})," - for value (unparsed mailbox)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:"Please note that in some situations rspamd cannot parse all the fields of received headers.\nIn that case you should check all strings for validity."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table of tables}"}),": list of received headers described above"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m0dee6",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_queue_id()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns queue ID of the message being processed."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m3a6ec",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_uid()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns ID of the task being processed."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m43981",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_uuid()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns UUID v7 of the task (time-ordered, suitable for cross-system correlation)."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m01f06",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_resolver()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns ready to use rspamd_resolver object suitable for making asynchronous DNS requests."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_resolver}"}),": resolver object associated with the task's session"]}),"\n"]}),"\n",(0,d.jsx)(s.h3,{id:"example-6",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"local logger = require \"rspamd_logger\"\n\nlocal function task_cb(task)\n\tlocal function dns_cb(resolver, to_resolve, results, err)\n\t\t-- task object is available due to closure\n\t\ttask:inc_dns_req()\n\t\tif results then\n\t\t\tlogger.info(string.format('<%s> [%s] resolved for symbol: %s',\n\t\t\t\ttask:get_message_id(), to_resolve, 'EXAMPLE_SYMBOL'))\n\t\t\ttask:insert_result('EXAMPLE_SYMBOL', 1)\n\t\tend\n\tend\n\tlocal r = task:get_resolver()\n\tr:resolve_a(task:get_session(), task:get_mempool(), 'example.com', dns_cb)\nend\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m39c38",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_resolver(resolver)"})]}),"\n",(0,d.jsx)(s.p,{children:"Sets rspamd_resolver for a specified task."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m5b56a",children:["Method ",(0,d.jsx)(s.code,{children:"task:inc_dns_req()"})]}),"\n",(0,d.jsx)(s.p,{children:"Increment number of DNS requests for the task. Is used just for logging purposes."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mab347",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_dns_req()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get number of dns requests being sent in the task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{number}"}),": number of DNS requests"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m493a9",children:["Method ",(0,d.jsx)(s.code,{children:"task:has_recipients([type])"})]}),"\n",(0,d.jsx)(s.p,{children:"Return true if there are SMTP or MIME recipients for a task."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type {integer|string}"}),": if specified has the following meaning: ",(0,d.jsx)(s.code,{children:"0"})," or ",(0,d.jsx)(s.code,{children:"any"})," means try SMTP recipients and fallback to MIME if failed, ",(0,d.jsx)(s.code,{children:"1"})," or ",(0,d.jsx)(s.code,{children:"smtp"})," means checking merely SMTP recipients and ",(0,d.jsx)(s.code,{children:"2"})," or ",(0,d.jsx)(s.code,{children:"mime"})," means MIME recipients only"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{bool,integer}"}),": ",(0,d.jsx)(s.code,{children:"true"})," if there are recipients of the following type and a number of such a recipients excluding artificial ones"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m75e80",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_recipients([type])"})]}),"\n",(0,d.jsx)(s.p,{children:"Return SMTP or MIME recipients for a task. This function returns list of internet addresses each one is a table with the following structure:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name"})," - name of internet address in UTF8, e.g. for ",(0,d.jsx)(s.code,{children:"Vsevolod Stakhov <[email protected]>"})," it returns ",(0,d.jsx)(s.code,{children:"Vsevolod Stakhov"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"addr"})," - address part of the address"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"user"})," - user part (if present) of the address, e.g. ",(0,d.jsx)(s.code,{children:"blah"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"domain"})," - domain part (if present), e.g. ",(0,d.jsx)(s.code,{children:"foo.com"})]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type {integer|string}"}),": if specified has the following meaning: ",(0,d.jsx)(s.code,{children:"0"})," or ",(0,d.jsx)(s.code,{children:"any"})," means try SMTP recipients and fallback to MIME if failed, ",(0,d.jsx)(s.code,{children:"1"})," or ",(0,d.jsx)(s.code,{children:"smtp"})," means checking merely SMTP recipients and ",(0,d.jsx)(s.code,{children:"2"})," or ",(0,d.jsx)(s.code,{children:"mime"})," means MIME recipients only"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{list of addresses}"}),": list of recipients or ",(0,d.jsx)(s.code,{children:"nil"})]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mc5168",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_principal_recipient()"})]}
1),"\n",(0,d.jsxs)(s.p,{children:["Returns a single string with so called ",(0,d.jsx)(s.code,{children:"principal recipient"})," for a message. The order\nof check is the following:"]}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"deliver-to request header"}),"\n",(0,d.jsx)(s.li,{children:"the first recipient (envelope)"}),"\n",(0,d.jsx)(s.li,{children:"the first recipient (mime)"}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": principal recipient"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mafd2b",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_reply_sender()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns a single string with address that should be used to reply on a message"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"reply-to header"}),"\n",(0,d.jsx)(s.li,{children:"from header"}),"\n",(0,d.jsx)(s.li,{children:"smtp from as a last resort"}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{address}"}),": email address"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m248af",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_recipients([type], {rcpt1, rcpt2...}, [how='add'])"})]}),"\n",(0,d.jsx)(s.p,{children:"Sets recipients for a task. This function accepts table that will be converted to the address.\nIf some fields are missing they are subsequently reconstructed by this function. E.g. if you\nspecify 'user' and 'domain', then address and raw string will be reconstructed"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name"})," - name of internet address in UTF8, e.g. for ",(0,d.jsx)(s.code,{children:"Vsevolod Stakhov <[email protected]>"})," it returns ",(0,d.jsx)(s.code,{children:"Vsevolod Stakhov"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"addr"})," - address part of the address"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"user"})," - user part (if present) of the address, e.g. ",(0,d.jsx)(s.code,{children:"blah"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"domain"})," - domain part (if present), e.g. ",(0,d.jsx)(s.code,{children:"foo.com"})]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type {integer|string}"}),": if specified has the following meaning: ",(0,d.jsx)(s.code,{children:"0"})," or ",(0,d.jsx)(s.code,{children:"any"})," means try SMTP recipients and fallback to MIME if failed, ",(0,d.jsx)(s.code,{children:"1"})," or ",(0,d.jsx)(s.code,{children:"smtp"})," means checking merely SMTP recipients and ",(0,d.jsx)(s.code,{children:"2"})," or ",(0,d.jsx)(s.code,{children:"mime"})," means MIME recipients only"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"recipients {list of tables}"}),": recipients to set"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"how {string}"}),": define how to set recipients: ",(0,d.jsx)(s.code,{children:"rewrite"})," - rewrite existing recipients, ",(0,d.jsx)(s.code,{children:"alias"})," - treat existing recipients as aliased recipients, ",(0,d.jsx)(s.code,{children:"add"})," - add new recipients"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": result of the operation"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m03d01",children:["Method ",(0,d.jsx)(s.code,{children:"task:has_from([type])"})]}),"\n",(0,d.jsx)(s.p,{children:"Return true if there is SMTP or MIME sender for a task."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type {integer|string}"}),": if specified has the following meaning: ",(0,d.jsx)(s.code,{children:"0"})," or ",(0,d.jsx)(s.code,{children:"any"})," means try SMTP recipients and fallback to MIME if failed, ",(0,d.jsx)(s.code,{children:"1"})," or ",(0,d.jsx)(s.code,{children:"smtp"})," means checking merely SMTP recipients and ",(0,d.jsx)(s.code,{children:"2"})," or ",(0,d.jsx)(s.code,{children:"mime"})," means MIME recipients only"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{bool}"}),": ",(0,d.jsx)(s.code,{children:"true"})," if there is sender of the following type"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m91f50",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_from([type])"})]}),"\n",(0,d.jsx)(s.p,{children:"Return SMTP or MIME sender for a task. This function returns an internet address which one is a table with the following structure:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"raw"})," - the original value without any processing"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name"})," - name of internet address in UTF8, e.g. for ",(0,d.jsx)(s.code,{children:"Vsevolod Stakhov <[email protected]>"})," it returns ",(0,d.jsx)(s.code,{children:"Vsevolod Stakhov"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"addr"})," - address part of the address"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"user"})," - user part (if present) of the address, e.g. ",(0,d.jsx)(s.code,{children:"blah"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"domain"})," - domain part (if present), e.g. ",(0,d.jsx)(s.code,{children:"foo.com"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"flags"})," - table with following keys set to true if given condition fulfilled:\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["[valid] - valid SMTP address in conformity with ",(0,d.jsx)(s.a,{href:"https://tools.ietf.org/html/rfc5321#section-4.1",children:"https://tools.ietf.org/html/rfc5321#section-4.1"}),"."]}),"\n",(0,d.jsx)(s.li,{children:"[ip] - domain is IPv4/IPv6 address"}),"\n",(0,d.jsxs)(s.li,{children:["[braced] - angled ",(0,d.jsx)(s.code,{children:"<[email protected]>"})," address"]}),"\n",(0,d.jsx)(s.li,{children:"[quoted] - quoted user part"}),"\n",(0,d.jsx)(s.li,{children:"[empty] - empty address"}),"\n",(0,d.jsx)(s.li,{children:"[backslash] - user part contains backslash"}),"\n",(0,d.jsx)(s.li,{children:"[8bit] - contains 8bit characters"}),"\n",(0,d.jsx)(s.li,{children:"[aliased] - address was rewritten by aliases resolution"}),"\n",(0,d.jsxs)(s.li,{children:["[original] - address is the pre-rewrite original preserved by ",(0,d.jsx)(s.code,{children:"task:set_from"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type {integer|string|table}"}),": if specified has the following meaning: ",(0,d.jsx)(s.code,{children:"0"})," or ",(0,d.jsx)(s.code,{children:"any"})," means try SMTP sender and fallback to MIME if failed, ",(0,d.jsx)(s.code,{children:"1"})," or ",(0,d.jsx)(s.code,{children:"smtp"})," means checking merely SMTP sender and ",(0,d.jsx)(s.code,{children:"2"})," or ",(0,d.jsx)(s.code,{children:"mime"})," means MIME ",(0,d.jsx)(s.code,{children:"From:"})," only. A table of strings may combine the type with additional flavours: ",(0,d.jsx)(s.code,{children:"orig"})," (or ",(0,d.jsx)(s.code,{children:"original"}),") returns the addresses as they were seen in the message, before any rewrite done via ",(0,d.jsx)(s.code,{children:"task:set_from"}),", e.g. ",(0,d.jsx)(s.code,{children:"task:get_from({'mime', 'orig'})"})]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{address}"}),": sender or ",(0,d.jsx)(s.code,{children:"nil"})]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m91c24",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_from(type, addr)"})]}),"\n",(0,d.jsx)(s.p,{children:"Sets sender for a task. This function accepts table that will be converted to the address.\nIf some fields are missing they are subsequently reconstructed by this function. E.g. if you\nspecify 'user' and 'domain', then address and raw string will be reconstructed"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name"})," - name of internet address in UTF8, e.g. for ",(0,d.jsx)(s.code,{children:"Vsevolod Stakhov <[email protected]>"})," it returns ",(0,d.jsx)(s.code,{children:"Vsevolod Stakhov"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"addr"})," - address part of the address"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"user"})," - user part (if present) of the address, e.g. ",(0,d.jsx)(s.code,{children:"blah"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"domain"})," - domain part (if present), e.g. ",(0,d.jsx)(s.code,{children:"foo.com"})]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type {integer|string}"}),": if specified has the following meaning: ",(0,d.jsx)(s.code,{children:"0"})," or ",(0,d.jsx)(s.code,{children:"any"})," means try SMTP sender and fallback to MIME if failed, ",(0,d.jsx)(s.code,{children:"1"})," or ",(0,d.jsx)(s.code,{children:"smtp"})," means checking merely SMTP sender and ",(0,d.jsx)(s.code,{children:"2"})," or ",(0,d.jsx)(s.code,{children:"mime"})," means MIME ",(0,d.jsx)(s.code,{children:"From:"})," only"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table {no type}"}),": no description"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": success or not"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m4ecda",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_mail_esmtp_args()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns a table of ESMTP arguments from MAIL FROM command (milter only).\nEach argument is a key-value pair where the key is the argument name and\nthe value is the argument value (or empty string if no value)."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table}"}),": ESMTP arguments or nil if not available"]}),"\n"]}),"\n",(0,d.jsx)(s.h3,{id:"example-7",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"local esmtp_args = task:get_mail_esmtp_args()\nif esmtp_args then\n  -- Check for DSN arguments\n  local ret = esmtp_args['RET']\n  local envid = esmtp_args['ENVID']\nend\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mbccdc",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_rcpt_esmtp_args([idx])"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns a table of ESMTP arguments from RCPT TO command (milter only).\nIf idx is specified, returns arguments for the recipient at that index (0-based).\nIf idx is not specified, returns an array of tables, one per recipient.\nEach argument is a key-value pair where the key is the argument name and\nthe value is the argument value (or empty string if no value)."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"idx {integer}"}),": optional index of the recipient (0-based)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table|array of tables}"}),": ESMTP arguments or nil if not available"]}),"\n"]}),"\n",(0,d.jsx)(s.h3,{id:"example-8",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"-- Get args for all recipients\nlocal rcpt_args = task:get_rcpt_esmtp_args()\nif rcpt_args then\n  for i, args in ipairs(rcpt_args) do\n    if args and args['NOTIFY'] then\n      -- Process NOTIFY argument\n    end\n  end\nend\n\n-- Get args for first recipient only\nlocal first_rcpt_args = task:get_rcpt_esmtp_args(0)\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m8ae15",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_user()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns authenticated user name for this task if specified by an MTA."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": username or nil"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mbe11a",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_user([username])"})]}),"\n",(0,d.jsx)(s.p,{children:"Sets or resets (if username is not specified) authenticated user name for this task."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": the previously set username or nil"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mea49b",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_from_ip()"})]}),"\n",(0,d.jsxs)(s.p,{children:["Returns ",(0,d.jsx)(s.a,{href:"/lua/rspamd_ip",children:"rspamd_ip"})," object of a sender that is provided by MTA"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_ip}"}),": ip address object"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"ma2e65",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_from_ip(str)"})]}),"\n",(0,d.jsx)(s.p,{children:"Set tasks's IP address based on the passed string"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"str {string}"}),": string representation of ip"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.j
1sx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m8cb37",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_client_ip()"})]}),"\n",(0,d.jsxs)(s.p,{children:["Returns ",(0,d.jsx)(s.a,{href:"/lua/rspamd_ip",children:"rspamd_ip"})," object of a client connected to rspamd (normally, it is an IP address of MTA)"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{rspamd_ip}"}),": ip address object"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m9df17",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_helo()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns the value of SMTP helo provided by MTA."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": HELO value"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m8a697",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_hostname()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns the value of sender's hostname provided by MTA"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": hostname value"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m21f46",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_images()"})]}),"\n",(0,d.jsxs)(s.p,{children:["Returns list of all images found in a task as a table of ",(0,d.jsx)(s.code,{children:"rspamd_image"}),".\nEach image has the following methods:"]}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_width"})," - return width of an image in pixels"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_height"})," - return height of an image in pixels"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_type"})," - return string representation of image's type (e.g. 'jpeg')"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_filename"})," - return string with image's file name"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_size"})," - return size in bytes"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{list of rspamd_image}"}),": images found in a message"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mb868a",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_archives()"})]}),"\n",(0,d.jsxs)(s.p,{children:["Returns list of all archives found in a task as a table of ",(0,d.jsx)(s.code,{children:"rspamd_archive"}),".\nEach archive has the following methods available:"]}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_files"})," - return list of strings with filenames inside archive"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_files_full"})," - return list of tables with all information about files"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"is_encrypted"})," - return true if an archive is encrypted"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"is_truncated"})," - return true if the archive file list hit the task limit"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_type"})," - return string representation of image's type (e.g. 'zip')"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_filename"})," - return string with archive's file name"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"get_size"})," - return size in bytes"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{list of rspamd_archive}"}),": archives found in a message"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mee6d7",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_dkim_results()"})]}),"\n",(0,d.jsxs)(s.p,{children:["Returns list of all dkim check results as table of maps. Callee must ensure that\ndkim checks have been completed by adding dependency on ",(0,d.jsx)(s.code,{children:"DKIM_TRACE"})," symbol.\nFields in map:"]}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"result"})," - string result of check:\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:(0,d.jsx)(s.code,{children:"reject"})}),"\n",(0,d.jsx)(s.li,{children:(0,d.jsx)(s.code,{children:"allow"})}),"\n",(0,d.jsx)(s.li,{children:(0,d.jsx)(s.code,{children:"tempfail"})}),"\n",(0,d.jsx)(s.li,{children:(0,d.jsx)(s.code,{children:"permfail"})}),"\n",(0,d.jsx)(s.li,{children:(0,d.jsx)(s.code,{children:"not found"})}),"\n",(0,d.jsx)(s.li,{children:(0,d.jsx)(s.code,{children:"bad record"})}),"\n"]}),"\n"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"domain"})," - dkim domain"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"selector"})," - dkim selector"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"bhash"})," - short version of b tag (8 base64 symbols)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"fail_reason"})," - reason of failure (if applicable)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{list of maps}"}),": dkim check results"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mb89bf",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_symbol(name, [shadow_result_name])"})]}),"\n",(0,d.jsx)(s.p,{children:"@method task:get_symbol(names_table, [shadow_result_name])\nSearches for a symbol or symbols in scan results and returns the matching\nsymbol descriptors. Each descriptor is a table with the fields:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"metric"})," - name of metric (only for the single-name positional form)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"score"})," - score of a symbol in that metric"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"options"})," - a table of strings representing options of a symbol"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"group"})," - a group of symbol (or 'ungrouped')"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:"Forms:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["Single positional name (legacy): ",(0,d.jsx)(s.code,{children:'get_symbol("FOO")'})," or\n",(0,d.jsx)(s.code,{children:'get_symbol("FOO", "shadow_result")'}),". Returns a list with one table or\n",(0,d.jsx)(s.code,{children:"nil"})," if not found (kept for backwards compatibility)."]}),"\n",(0,d.jsxs)(s.li,{children:["Table of names: ",(0,d.jsx)(s.code,{children:'get_symbol({"FOO", "BAR"})'})," or\n",(0,d.jsx)(s.code,{children:'get_symbol({"FOO", "BAR"}, "shadow_result")'}),". Returns a map\n",(0,d.jsx)(s.code,{children:"{name -> info}"})," for the names that have fired, or ",(0,d.jsx)(s.code,{children:"nil"})," if none did."]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Please note, that for using this function you need to ensure that the\nsymbols being queried are already checked. This is guaranteed if there is\na depen
1dency between the caller symbol and the checked symbol (either\nvirtual or real). Please check ",(0,d.jsx)(s.code,{children:"rspamd_config:register_dependency"})," method\nfor details."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table|nil}"}),": list/map of tables or nil if no symbol was found"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m7db46",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_symbol_regexp(regexp, [shadow_result_name])"})]}),"\n",(0,d.jsxs)(s.p,{children:["Returns a map ",(0,d.jsx)(s.code,{children:"{symbol_name -> info_table}"})," for every fired symbol whose\nname matches the supplied ",(0,d.jsx)(s.code,{children:"rspamd_regexp"})," userdata. Returns ",(0,d.jsx)(s.code,{children:"nil"})," when no\nsymbol matched."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"regexp {rspamd_regexp}"}),": pattern to match symbol names against"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"shadow_result_name {string}"}),": optional name of a shadow scan result"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table|nil}"}),": map of matched symbols or nil"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m4de24",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_symbols_all()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns array of symbols matched in default metric with all metadata"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table}"}),": table of tables formatted as in ",(0,d.jsx)(s.code,{children:"task:get_symbol()"})," except that ",(0,d.jsx)(s.code,{children:"metric"})," is absent and ",(0,d.jsx)(s.code,{children:"name"})," is added"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m6717b",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_symbols([shadow_result_name])"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns array of all symbols matched for this task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table, table}"}),": table of strings with symbols names + table of theirs scores"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m5d831",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_groups([need_private])"})]}),"\n",(0,d.jsxs)(s.p,{children:["Returns a map [group -> group_score] for matched group. If ",(0,d.jsx)(s.code,{children:"need_private"})," is\nunspecified, then the global option ",(0,d.jsx)(s.code,{children:"public_groups_only"})," is used for default."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table, number}"}),": a map [group -> group_score]"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mf9c5d",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_symbols_numeric()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns array of all symbols matched for this task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table|number, table|number}"}),": table of numbers with symbols ids + table of theirs scores"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"me3b91",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_symbols_tokens()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns array of all symbols as statistical tokens"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table|number}"}),": table of numbers"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m99f5c",children:["Method ",(0,d.jsx)(s.code,{children:"task:process_ann_tokens(symbol
1s, ann_tokens, offset, [min])"})]}),"\n",(0,d.jsx)(s.p,{children:"Processes ann tokens"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"symbols {table|string}"}),": list of symbols in this profile"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"ann_tokens {table|number}"}),": list of tokens (including metatokens)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"offset {integer}"}),": offset for symbols token (#metatokens)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"min {number}"}),": minimum value for symbols found (e.g. for 0 score symbols)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"nothing"}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m824ce",children:["Method ",(0,d.jsx)(s.code,{children:"task:has_symbol(name, [shadow_result_name])"})]}),"\n",(0,d.jsx)(s.p,{children:"@method task:has_symbol(names_table, [shadow_result_name])\nFast path to check if a specified symbol (or any of several symbols) is in\nthe task's results."}),"\n",(0,d.jsx)(s.p,{children:"Forms:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["Single positional name (legacy): ",(0,d.jsx)(s.code,{children:'has_symbol("FOO")'})," or\n",(0,d.jsx)(s.code,{children:'has_symbol("FOO", "shadow_result")'}),"."]}),"\n",(0,d.jsxs)(s.li,{children:["Table of names: ",(0,d.jsx)(s.code,{children:'has_symbol({"FOO", "BAR"})'})," or\n",(0,d.jsx)(s.code,{children:'has_symbol({"FOO", "BAR"}, "shadow_result")'}),". Returns ",(0,d.jsx)(s.code,{children:"true"})," if any of\nthe names is present."]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Please note, that for using this function you need to ensure that the\nsymbols being queried are already checked. This is guaranteed if there is\na dependency between the caller symbol and the checked symbol (either\nvirtual or real). Please check ",(0,d.jsx)(s.code,{children:"rspamd_config:register_dependency"})," method\nfor details."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": ",(0,d.jsx)(s.code,{children:"true"})," if (any of the) symbol(s) has been found"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m54487",children:["Method ",(0,d.jsx)(s.code,{children:"task:has_symbol_regexp(regexp, [shadow_result_name])"})]}),"\n",(0,d.jsxs)(s.p,{children:["Checks whether any fired symbol has a name matching the supplied\n",(0,d.jsx)(s.code,{children:"rspamd_regexp"})," userdata."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"regexp {rspamd_regexp}"}),": pattern to match symbol names against"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"shadow_result_name {string}"}),": optional name of a shadow scan result"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": ",(0,d.jsx)(s.code,{children:"true"})," if at least one matching symbol has been found"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mcd676",children:["Method ",(0,d.jsx)(s.code,{children:"task:enable_symbol(name)"})]}),"\n",(0,d.jsx)(s.p,{children:"Enable specified symbol for this particular task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": symbol's name"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": ",(0,d.jsx)(s.code,{children:"true"})," if symbol has been found"]}
1),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m99a01",children:["Method ",(0,d.jsx)(s.code,{children:"task:disable_symbol(name)"})]}),"\n",(0,d.jsx)(s.p,{children:"Disable specified symbol for this particular task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": symbol's name"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": ",(0,d.jsx)(s.code,{children:"true"})," if symbol has been found"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mb6e45",children:["Method ",(0,d.jsx)(s.code,{children:"task:disable_all_symbols([skip_mask])"})]}),"\n",(0,d.jsxs)(s.p,{children:["Disable execution of every symbol for this particular task except those whose\ntype/flags intersect ",(0,d.jsx)(s.code,{children:"skip_mask"}),'. This is the "process only these" primitive:\nit mirrors what the ',(0,d.jsx)(s.code,{children:"symbols_enabled"})," settings key does internally. Combine it\nwith ",(0,d.jsx)(s.code,{children:"task:enable_symbol()"})," (called afterwards) to run only a chosen subset of\nsymbols. Typically invoked from a high-priority prefilter so that the disabled\nsymbols never execute (no wasted DNS/Redis/HTTP work).\nenabled; defaults to ",(0,d.jsx)(s.code,{children:"SYMBOL_TYPE_EXPLICIT_DISABLE"})," (i.e. symbols flagged\n",(0,d.jsx)(s.code,{children:"explicit_disable"})," are left running, matching the ",(0,d.jsx)(s.code,{children:"symbols_enabled"})," default)"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"skip_mask {number}"}),": optional bitmask of SYMBOL_TYPE_* flags to keep"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m0693a",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_date(type[, gmt])"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns timestamp for a connection or for a MIME message. This function can be called with a\nsingle table arguments with the following fields:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"format"})," - a format of date returned:\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"message"})," - returns a mime date as integer (unix timestamp)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"connect"})," - returns a unix timestamp of a connection to rspamd"]}),"\n"]}),"\n"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"gmt"})," - returns date in ",(0,d.jsx)(s.code,{children:"GMT"})," timezone (normal for unix timestamps)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:"By default this function returns connection time in numeric format."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type {string}"}),": date format as described above"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"gmt {boolean}"}),": gmt flag as described above"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string/number}"}),": date representation according to format"]}),"\n"]}),"\n",(0,d.jsx)(s.h3,{id:"example-9",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"rspamd_config.DATE_IN_PAST = function(task)\n\tlocal dm = task:get_date{format = 'message', gmt = true}\n\tlocal dt = task:get_date{format = 'connect', gmt = true}\n\t-- A day\n\tif dt - dm > 86400 then\n\t\treturn true\n\tend\n\n\treturn false\nend\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mbbbc7",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_message_id()"})]}),"\n",(0,d.jsxs)(s.p,{children:["Returns message identifier from the ",(0,d.jsx)(s.code,{children:"Message-ID"})," header.  Angle brackets (",(0,d.jsx)(s.code,{children:"<>"}),")\nare stripped off if present.  If a Message-ID header is missing ",(0,d.jsx)(s.code,{children:"undef"})," is\nreturned."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": ID of the message"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mf77b0",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_timeval([raw])"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns the timestamp for a task start processing time."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"raw {boolean}"}),": if true then two float numbers are returned: task start timestamp and timeout event timestamp"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table}"}
1),": table with fields as described in ",(0,d.jsx)(s.code,{children:"struct timeval"})," in C"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mfb31c",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_scan_time([set])"})]}),"\n",(0,d.jsxs)(s.p,{children:["Returns 2 floating point numbers: scan real time and scan virtual time.\nIf ",(0,d.jsx)(s.code,{children:"set"})," is ",(0,d.jsx)(s.code,{children:"true"}),", then the finishing time is also set (enabled by default).\nThis function should be normally called on idempotent phase."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{number,number}"}),": real and virtual times in seconds with floating point"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mc326f",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_metric_result()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get full result of a metric as a table:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"score"}),": current score"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"action"}),": current action as a string"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"nnegative"}),": number of negative rules matched"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"npositive"}),": number of positive rules matched"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"positive_score"}),": total score for positive rules"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"negative_score"}),": total score for negative rules"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"passthrough"}),": set to true if message has a passthrough result"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table}"}),": metric result"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m5519f",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_metric_score(name)"})]}),"\n",(0,d.jsxs)(s.p,{children:["Get the current score of metric ",(0,d.jsx)(s.code,{children:"name"})," (must be nil or 'default') . Should be used in idempotent filters only."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of a metric"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{number,number}"}),": 2 numbers containing the current score and required score of the metric"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m40b9d",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_metric_threshold(action)"})]}),"\n",(0,d.jsxs)(s.p,{children:["Get the current threshold of the action ",(0,d.jsx)(s.code,{children:"action"})," for the default metric. Should be used after settings have been applied."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"action {string}"}),": name of a action"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{number}"}),": the current threshold of the action"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m9b471",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_metric_action(name)"})]}),"\n",(0,d.jsxs)(s.p,{children:["Get the current action of metric ",(0,d.jsx)(s.code,{children:"name"})," (must be nil or 'default'). Should be used in idempotent filters only."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of a metric"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": the current action of the metric as a string"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"me3814",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_metric_score(name, score)"})]}),"\n",(0,d.jsxs)(s.p,{children:["Set the current score of metric ",(0,d.jsx)(s.code,{children:"name"}),". Should be used in post-filters only."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"name {string}"}),": name of a metric"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"score {number}"}),": the current score of the metric"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m1bbbc",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_metric_subject(subject)"})]}),"\n",(0,d.jsx)(s.p,{children:"Set the subject in the default metric"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"subject {string}"}),": subject to set"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m62c3f",children:["Method ",(0,d.jsx)(s.code,{children:"task:learn(is_spam[, classifier)"})]}),"\n",(0,d.jsxs)(s.p,{children:["Learn classifier ",(0,d.jsx)(s.code,{children:"classifier"})," with the task. If ",(0,d.jsx)(s.code,{children:"is_spam"})," is true then message\nis learnt as spam. Otherwise HAM is learnt. By default, this function learns\n",(0,d.jsx)(s.code,{children:"bayes"})," classifier."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"is_spam {boolean}"}),": learn spam or ham"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"classifier {string}"}),": classifier's name"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": ",(0,d.jsx)(s.code,{children:"true"})," if classifier has been learnt successfully"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m0efc8",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_settings(obj)"})]}),"\n",(0,d.jsxs)(s.p,{children:["Set users settings object for a task. The format of this object is described\n",(0,d.jsx)(s.a,{href:"https://rspamd.com/doc/configuration/settings.html",children:"here"}),"."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"obj {any}"}),": any lua object that corresponds to the settings format"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m0ffb9",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_settings_id(id)"})]}),"\n",(0,d.jsx)(s.p,{children:"Set users settings id for a task (must be registered previously)"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"id {number}"}),": numeric id"]}
1),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": true if settings id has been replaced from the existing one"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:[(0,d.jsx)(s.strong,{children:"Available in:"})," 2.0+"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m4b954",children:["Method ",(0,d.jsx)(s.code,{children:"task:merge_and_apply_settings(layers)"})]}),"\n",(0,d.jsx)(s.p,{children:'Merge multiple settings layers and apply the result.\nEach layer is a table: {level=N, name="str", settings_id=N, apply={...}}\nLayers are merged according to the settings merge rules.'}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"layers {table}"}),": array of layer tables"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mf449c",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_settings()"})]}),"\n",(0,d.jsxs)(s.p,{children:["Gets users settings object for a task. The format of this object is described\n",(0,d.jsx)(s.a,{href:"https://rspamd.com/doc/configuration/settings.html",children:"here"}),"."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{lua object}"}),": lua object generated from UCL"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m59a66",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_fuzzy_results()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns an array of fuzzy matches found during the fuzzy check. Each element\nis a table with the following fields:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"rule"})," - fuzzy rule name"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"symbol"})," - symbol inserted for the match"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"server"})," - upstream that returned the match"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"found"})," - hex digest stored in the storage that matched"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"queried"})," - hex digest of the message part that was queried"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type"})," - hash type: txt, img, html, htmld, content or bin"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"prob"})," - match probability (shingle overlap ratio, 1.0 for exact matches)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"score"})," - normalized score multiplier"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"flag"})," - storage flag, ",(0,d.jsx)(s.code,{children:"value"})," - stored value, ",(0,d.jsx)(s.code,{children:"added"})," - hash timestamp"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"exact"})," - true when the found digest equals the queried one"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"confirmed"})," - true when the storage explicitly marked the digest as matched"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table}"}),": array of match tables (empty if there were no matches)"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"me8055",children:["Method ",(0,d.jsx)(s.code,{children:"task:lookup_settings(key)"})]}),"\n",(0,d.jsx)(s.p,{children:"Gets users settings object with the specified key for a task."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"key {string}"}),": key to lookup"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{lua object}"}),": lua object generated from UCL"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m959e9",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_metadata()"})]}),"\n",(0,d.jsx)(s.p,{children:"Gets the custom metadata object supplied with a /checkv3 multipart request.\nReturns nil for requests that carried no metadata part (e.g. /checkv2)."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{lua object|nil}"}),": lua object generated from the metadata UCL"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"maaf7a",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_metadata_field(key)"})]}),"\n",(0,d.jsx)(s.p,{children:"Gets a single top-level field from the /checkv3 metadata object."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"key {string}"}),": optional; if omitted the whole metadata object is returned (mirrors lookup_settings)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{lua object|nil}"}),": lua object generated from the metadata field"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m19d7f",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_settings_id()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get numeric hash of settings id if specified for this task. 0 is returned otherwise."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{number}"}),": settings-id hash"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m70081",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_milter_reply(obj)"})]}),"\n",(0,d.jsx)(s.p,{children:"Set special reply for milter"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"obj {any}"}),": any lua object that corresponds to the settings format"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsx)(s.h3,{id:"example-10",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"task:set_milter_reply({\n\tadd_headers = {['X-Lua'] = 'test'},\n\t-- 1 is the position of header to remove\n\tremove_headers = {['DKIM-Signature'] = 1},\n\t-- change smtp from\n\tchange_from = '[email protected]',\n\t-- add and/or remove smtp rcpts\n\tadd_rcpt = {'[email protected]', '[email protected]'},\n\tdel_rcpt = {'[email protected]', '[email protected]'},\n})\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mef9bb",children:["Method ",(0,d.jsx)(s.code,{children:"task:process_re(params)"})]}),"\n",(0,d.jsxs)(s.p,{children:["Processes the specified regexp and returns number of captures (cached or new)\nParams is the table with the following fields (mandatory fields are marked with ",(0,d.jsx)(s.code,{children:"*"}),"):"]}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"re"}),"* : regular expression object"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"type"}),"*: type of regular expression:\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"mime"}),": mime regexp"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"header"}),": header regexp"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"rawheader"}),": raw header expression"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"rawmime"}),": raw mime regexp"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"body"}),": raw body regexp"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"url"}),": url regexp"]}),"\n"]}),"\n"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"header"}
1),": for header and rawheader regexp means the name of header"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"strong"}),": case sensitive match for headers"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{number}"}),": number of regexp occurrences in the task (limited by 255 so far)"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m58b3b",children:["Method ",(0,d.jsx)(s.code,{children:"task:cache_set(key, value)"})]}),"\n",(0,d.jsx)(s.p,{children:"Store some value to the task cache"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"key {string}"}),": key to use"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"value {any}"}),": any value (including functions and tables)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m0b56c",children:["Method ",(0,d.jsx)(s.code,{children:"task:cache_get(key)"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns cached value or nil if nothing is cached"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"key {string}"}),": key to use"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{any}"}),": cached value"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m3f5ec",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_size()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns size of the task in bytes (that includes headers + parts size)"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{number}"}),": size in bytes"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m09dd4",children:["Method ",(0,d.jsx)(s.code,{children:"task:set_flag(flag_name[, set])"})]}),"\n",(0,d.jsx)(s.p,{children:"Set specific flag for task:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"no_log"}),": do not log task summary"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"no_stat"}),": do not include task into scanned stats"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"pass_all"}),": check all filters for task"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"extended_urls"}),": output extended info about urls"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"skip"}),": skip task processing"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"learn_spam"}),": learn message as spam"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"learn_ham"}),": learn message as ham"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"broken_headers"}),": header data is broken for a message"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"flag {string}"}),": to set"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"set {boolean}"}),": set or clear flag (default is set)"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsx)(s.h3,{id:"example-11",children:"Example:"}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-lua",children:"--[[\nFor messages with undefined queue ID (scanned with rspamc or WebUI
1)\ndo not include results into statistics and do not log task summary\n(it will not appear in the WebUI history as well).\n]]--\n\n-- Callback function to set flags\nlocal function no_log_stat_cb(task)\n  if not task:get_queue_id() then\n    task:set_flag('no_log')\n    task:set_flag('no_stat')\n  end\nend\n\nrspamd_config:register_symbol({\n  name = 'LOCAL_NO_LOG_STAT',\n  type = 'postfilter',\n  callback = no_log_stat_cb\n})\n"})}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m679aa",children:["Method ",(0,d.jsx)(s.code,{children:"task:has_flag(flag_name)"})]}),"\n",(0,d.jsx)(s.p,{children:"Checks for a specific flag in task:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"no_log"}),": do not log task summary"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"no_stat"}),": do not include task into scanned stats"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"pass_all"}),": check all filters for task"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"extended_urls"}),": output extended info about urls"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"skip"}),": skip task processing"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"learn_spam"}),": learn message as spam"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"learn_ham"}),": learn message as ham"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"broken_headers"}),": header data is broken for a message"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"flag {string}"}),": to check"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": true if flags is set"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m8ab26",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_flags()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get list of flags for task:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"no_log"}),": do not log task summary"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"no_stat"}),": do not include task into scanned stats"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"pass_all"}),": check all filters for task"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"extended_urls"}),": output extended info about urls"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"skip"}),": skip task processing"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"learn_spam"}),": learn message as spam"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"learn_ham"}),": learn message as ham"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"broken_headers"}),": header data is broken for a message"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"milter"}),": task is initiated by milter connection"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{array of strings}"}),": table with all flags as strings"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"me8faa",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_digest()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns message's unique digest (32 hex symbols)"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": hex digest"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mbcdef",children:["Method ",(0,d.jsx)(s.code,{children:"task:store_in_file([mode|table])"})]}),"\n",(0,d.jsxs)(s.p,{children:["If task was loaded using file scan, then this method just returns its name,\notherwise, a fresh temporary file is created and its name is returned. Default\nmode is 0600. To convert lua number to the octal mode you can use the following\ntrick: ",(0,d.jsx)(s.code,{children:'tonumber("0644", 8)'}),". The file is automatically removed when task is\ndestroyed."]}),"\n",(0,d.jsx)(s.p,{children:"If table argument is specified, the following extra fields are allowed:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"mode"}),": same as mode argument"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"force_new"}),": always create a new file"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"filename"}),": use specific filename instead of a temporary one"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"tmpmask"}),": use specific tempmask, e.g. '/tmp/file-XXXXX', where XXXX will be replaced by some random letters"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"keep"}),": do not remove file after task is processed"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"mode {number}"}),": mode for new file"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),": file name with task content"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mce7a7",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_protocol_reply([flags])"})]}),"\n",(0,d.jsxs)(s.p,{children:["This method being called from a ",(0,d.jsx)(s.strong,{children:"postfilter"})," will return reply for a message\nas it is returned to a client. This method returns the Lua table corresponding\nto the UCL object. Flags is a table that specify which information should be\nthere in a reply:"]}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"basic"}),": basic info, such as message-id"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"metrics"}),": metrics and symbols"]}
1),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"messages"}),": messages"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"dkim"}),": dkim signature"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"milter"}),": milter control block"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"extra"}),": extra data, such as profiling"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"urls"}),": list of all urls in a message"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"flags {table}"}),": table of flags (default is all flags but ",(0,d.jsx)(s.code,{children:"urls"}),")"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table}"}),": ucl object corresponding to the reply"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m1a53d",children:["Method ",(0,d.jsx)(s.code,{children:"task:headers_foreach(callback, [params])"})]}),"\n",(0,d.jsxs)(s.p,{children:["This method calls ",(0,d.jsx)(s.code,{children:"callback"})," for each header that satisfies some condition.\nBy default, all headers are iterated unless ",(0,d.jsx)(s.code,{children:"callback"})," returns ",(0,d.jsx)(s.code,{children:"true"}),". Nil or\nfalse means continue of iterations.\nParams could be as following:"]}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"full"}),": header value is full table of all attributes ",(0,d.jsx)(s.a,{href:"#fffda5",children:(0,d.jsx)(s.code,{children:"task:get_header_full"})})," for details"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"regexp"}),": return headers that satisfies the specified regexp"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"callback {function}"}),": function from header name and header value"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"params {table}"}),": optional parameters"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m54e2f",children:["Method ",(0,d.jsx)(s.code,{children:"task:disable_action(action)"})]}),"\n",(0,d.jsx)(s.p,{children:"Disables some action for this task (e.g. 'greylist')"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"action {string}"}),": action to disable"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{boolean}"}),": true if an action was enabled and is disabled after the method call"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m671d9",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_newlines_type()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns the most frequent newlines type met in a task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{string}"}),': "cr" for \\r, "lf" for \\n, "crlf" for \\r\\n']}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mcdecd",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_stat_tokens()"})]}),"\n",(0,d.jsx)(s.p,{children:"Returns list of tables the statistical tokens:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"data"}),": 64 bit number encoded as a string"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"t1"}),": the first token (if any)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"t2"}),": the second token (if any)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"win"}),": window index"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"flag"}),": table of strings:\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"text"}),": text token"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"meta"}),": meta token"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"lua"}),": lua meta token"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"exception"}),": exception"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"subject"}),": subject token"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"unigram"}),": unigram token"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table of tables}"}),": no description"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mf5c96",children:["Method ",(0,d.jsx)(s.code,{children:"task:lookup_words(map, function({o, n, s, f}) ... end)"})]}),"\n",(0,d.jsx)(s.p,{children:"Matches words in a task (including meta words) against some map (set, regexp and so on)\nand call the specified function with a table containing 4 values:"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"[1] - stemmed word"}),"\n",(0,d.jsx)(s.li,{children:"[2] - normalised word"}),"\n",(0,d.jsx)(s.li,{children:"[3] - raw word"}),"\n",(0,d.jsx)(s.li,{children:"[4] - flags (table of strings)"}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"mab347",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_dns_req()"})]}),"\n",(0,d.jsx)(s.p,{children:"Get number of dns requests being sent in the task"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{number}"}),": number of DNS requests"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m21222",children:["Method ",(0,d.jsx)(s.code,{children:"task:add_timer(timeout, callback)"})]}),"\n",(0,d.jsx)(s.p,{children:"Creates a delayed execution task for the specific callback at given timeout (in seconds)"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsx)(s.p,{children:"No return"}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m2ebd6",children:["Method ",(0,d.jsx)(s.code,{children:"task:rewrite_html_urls(callback)"})]}),"\n",(0,d.jsx)(s.p,{children:"Rewrites URLs in HTML parts using the specified Lua callback function.\nThe callback receives (task, url) and should return the replacement URL or nil."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"callback {function}"}),": Lua function to call for each URL"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table|nil}"}),": table of rewritten HTML parts indexed by part number, or nil on error"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.h3,{id:"m5ed23",children:["Method ",(0,d.jsx)(s.code,{children:"task:get_html_urls()"})]}),"\n",(0,d.jsx)(s.p,{children:"Extracts all URLs from HTML parts without rewriting.\nUseful for async URL checking workflows where URLs need to be batched."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(s.p,{children:"No parameters"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"{table|nil}"}),": table indexed by part number, each containing an array of URL info tables with keys: url, attr, tag"]}),"\n"]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#m0f406",children:"module description"}),"."]}),"\n",(0,d.jsxs)(s.p,{children:["Back to ",(0,d.jsx)(s.a,{href:"#",children:"top"}),"."]})]})}function o(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,d.jsx)(s,{...e,children:(0,d.jsx)(h,{...e})}):h(e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.