{"query", RSPAMD_URL_FLAG_QUERY, -1},
{"content", RSPAMD_URL_FLAG_CONTENT, -1},
{"no_tld", RSPAMD_URL_FLAG_NO_TLD, -1},
+ {"truncated", RSPAMD_URL_FLAG_TRUNCATED, -1},
};
RSPAMD_URL_FLAG_NO_TLD = 1u << 22u,
RSPAMD_URL_FLAG_TRUNCATED = 1u << 23u,
};
+#define RSPAMD_URL_MAX_FLAG_SHIFT (24u)
struct rspamd_url_tag {
const gchar *data;
return 1;
}
-
static gint
lua_load_url (lua_State * L)
{
lua_newtable (L);
luaL_register (L, NULL, urllib_f);
+ /* Push flags */
+ lua_createtable (L, 0, RSPAMD_URL_MAX_FLAG_SHIFT);
+ for (int i = 0; i < RSPAMD_URL_MAX_FLAG_SHIFT; i ++) {
+ guint flag = 1u << i;
+
+ lua_pushinteger (L, flag);
+ lua_setfield (L, -2, rspamd_url_flag_to_string (flag));
+ }
+
+ lua_setfield (L, -2, "flags");
+
return 1;
}