|
|
@@ -52,6 +52,7 @@ LUA_FUNCTION_DEF (url, to_table); |
|
|
|
LUA_FUNCTION_DEF (url, is_phished); |
|
|
|
LUA_FUNCTION_DEF (url, is_redirected); |
|
|
|
LUA_FUNCTION_DEF (url, is_obscured); |
|
|
|
LUA_FUNCTION_DEF (url, is_html_displayed); |
|
|
|
LUA_FUNCTION_DEF (url, get_phished); |
|
|
|
LUA_FUNCTION_DEF (url, get_tag); |
|
|
|
LUA_FUNCTION_DEF (url, get_tags); |
|
|
@@ -74,6 +75,7 @@ static const struct luaL_reg urllib_m[] = { |
|
|
|
LUA_INTERFACE_DEF (url, is_phished), |
|
|
|
LUA_INTERFACE_DEF (url, is_redirected), |
|
|
|
LUA_INTERFACE_DEF (url, is_obscured), |
|
|
|
LUA_INTERFACE_DEF (url, is_html_displayed), |
|
|
|
LUA_INTERFACE_DEF (url, get_phished), |
|
|
|
LUA_INTERFACE_DEF (url, get_tag), |
|
|
|
LUA_INTERFACE_DEF (url, get_tags), |
|
|
@@ -316,6 +318,27 @@ lua_url_is_obscured (lua_State *L) |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
* @method url:is_html_displayed() |
|
|
|
* Check whether URL is just displayed in HTML (e.g. NOT a real href) |
|
|
|
* @return {boolean} `true` if URL is displayed only |
|
|
|
*/ |
|
|
|
static gint |
|
|
|
lua_url_is_html_displayed (lua_State *L) |
|
|
|
{ |
|
|
|
struct rspamd_lua_url *url = lua_check_url (L, 1); |
|
|
|
|
|
|
|
if (url != NULL) { |
|
|
|
lua_pushboolean (L, url->url->flags & RSPAMD_URL_FLAG_HTML_DISPLAYED); |
|
|
|
} |
|
|
|
else { |
|
|
|
lua_pushnil (L); |
|
|
|
} |
|
|
|
|
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
/*** |
|
|
|
* @method url:get_tag(tag) |
|
|
|
* Returns list of string for a specific tagname for an url |