aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorJan Smutny <js@excello.cz>2020-04-17 13:50:50 +0200
committerJan Smutny <js@excello.cz>2020-04-17 14:32:55 +0200
commit3e85c63f09661ab1df51a17ffffffbc4ffa6e2d1 (patch)
treeba682bd945dde42a96f88fff347490aae07baa69 /src/lua
parentb45a93a58a9467d85a385ab3ed9f57f8880dd2ee (diff)
downloadrspamd-3e85c63f09661ab1df51a17ffffffbc4ffa6e2d1.tar.gz
rspamd-3e85c63f09661ab1df51a17ffffffbc4ffa6e2d1.zip
[Rework] get rid of util:parse_addr duplicating the util:parse_mail_address, replace where used
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_util.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index f33a46d0d..d2efc9cb2 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -153,29 +153,6 @@ LUA_FUNCTION_DEF (util, parse_html);
LUA_FUNCTION_DEF (util, levenshtein_distance);
/***
- * @function util.parse_addr(str, [pool])
- * Parse rfc822 address to components. Returns a table of components:
- *
- * - `name`: name of address (e.g. Some User)
- * - `addr`: address part (e.g. user@example.com)
- * - `user` - 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:
- * - [valid] - valid SMTP address in conformity with https://tools.ietf.org/html/rfc5321#section-4.1.
- * - [ip] - domain is IPv4/IPv6 address
- * - [braced] - angled `<blah@foo.com>` address
- * - [quoted] - quoted user part
- * - [empty] - empty address
- * - [backslash] - user part contains backslash
- * - [8bit] - contains 8bit characters
- **
- * @param {string} str input string
- * @param {rspamd_mempool} pool memory pool to use
- * @return {table/tables} parsed list of mail addresses
- */
-LUA_FUNCTION_DEF (util, parse_addr);
-
-/***
* @function util.fold_header(name, value, [how, [stop_chars]])
* Fold rfc822 header according to the folding rules
*
@@ -669,7 +646,6 @@ static const struct luaL_reg utillib_f[] = {
LUA_INTERFACE_DEF (util, tanh),
LUA_INTERFACE_DEF (util, parse_html),
LUA_INTERFACE_DEF (util, levenshtein_distance),
- LUA_INTERFACE_DEF (util, parse_addr),
LUA_INTERFACE_DEF (util, fold_header),
LUA_INTERFACE_DEF (util, is_uppercase),
LUA_INTERFACE_DEF (util, humanize_number),
@@ -1488,51 +1464,6 @@ lua_util_levenshtein_distance (lua_State *L)
}
static gint
-lua_util_parse_addr (lua_State *L)
-{
- LUA_TRACE_POINT;
- GPtrArray *addrs;
- gsize len;
- const gchar *str = luaL_checklstring (L, 1, &len);
- rspamd_mempool_t *pool;
- gboolean own_pool = FALSE;
-
- if (str) {
-
- if (lua_type (L, 2) == LUA_TUSERDATA) {
- pool = rspamd_lua_check_mempool (L, 2);
-
- if (pool == NULL) {
- return luaL_error (L, "invalid arguments");
- }
- }
- else {
- pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- "lua util", 0);
- own_pool = TRUE;
- }
-
- addrs = rspamd_email_address_from_mime (pool, str, len, NULL);
-
- if (addrs == NULL) {
- lua_pushnil (L);
- }
- else {
- lua_push_emails_address_list (L, addrs, 0);
- }
-
- if (own_pool) {
- rspamd_mempool_delete (pool);
- }
- }
- else {
- lua_pushnil (L);
- }
-
- return 1;
-}
-
-static gint
lua_util_fold_header (lua_State *L)
{
LUA_TRACE_POINT;