rspamd_parsers
This module contains Lua-C interfaces to Rspamd parsers of different kind.
Functions:
Function | Description |
---|---|
parsers.tokenize_text(input[, exceptions]) |
Create tokens from a text using optional exceptions list. |
parsers.parse_html(input) |
Parses HTML and returns the according text. |
parsers.parse_mail_address(str, [pool]) |
Parses email address and returns a table of tables in the following format. |
parsers.parse_content_type(ct_string, mempool) |
Parses content-type string to a table. |
parsers.parse_smtp_date(str[, local_tz]) |
Converts an SMTP date string to unix timestamp. |
The module rspamd_parsers
defines the following functions.
parsers.tokenize_text(input[, exceptions])
Create tokens from a text using optional exceptions list
Parameters:
input {text/string}
: input dataexceptions, {table}
: a table of pairs containing <start_pos,length> of exceptions in the inputReturns:
{table/strings}
: list of strings representing words in the textBack to module description.
parsers.parse_html(input)
Parses HTML and returns the according text
Parameters:
in {string|text}
: input HTMLReturns:
{rspamd_text}
: processed text with no HTML tagsBack to module description.
parsers.parse_mail_address(str, [pool])
Parses email address and returns a table of tables in the following format:
raw
- the original value without any processingname
- name of internet address in UTF8, e.g. for Vsevolod Stakhov <blah@foo.com>
it returns Vsevolod Stakhov
addr
- address part of the addressuser
- user part (if present) of the address, e.g. blah
domain
- domain part (if present), e.g. foo.com
flags
- table with following keys set to true if given condition fulfilled:
<blah@foo.com>
addressParameters:
str {string}
: input stringpool {rspamd_mempool}
: memory pool to useReturns:
{table/tables}
: parsed list of mail addressesBack to module description.
parsers.parse_content_type(ct_string, mempool)
Parses content-type string to a table:
type
subtype
charset
boundary
Parameters:
ct_string {string}
: content type as stringmempool {rspamd_mempool}
: needed to store temporary data (e.g. task pool)Returns:
Back to module description.
parsers.parse_smtp_date(str[, local_tz])
Converts an SMTP date string to unix timestamp
Parameters:
str {string}
: input stringlocal_tz {boolean}
: convert to local tz if true
Returns:
{number}
: time as unix timestamp (converted to float)Back to module description.
Back to top.