static gboolean
inject_url_query_callback(struct rspamd_url *url, gsize start_offset,
- gsize end_offset, gpointer ud)
+ gsize end_offset, gpointer ud)
{
struct rspamd_url_query_to_inject_cbd *cbd =
(struct rspamd_url_query_to_inject_cbd *) ud;
static void
inject_url_query(struct rspamd_task *task, struct rspamd_url *url,
- GPtrArray *part_urls)
+ GPtrArray *part_urls)
{
if (url->querylen > 0) {
struct rspamd_url_query_to_inject_cbd cbd;
if (lua_isuserdata(L, 3)) {
/* We also have a mime part there */
mpart = *((struct rspamd_mime_part **)
- rspamd_lua_check_udata_maybe(L, 3, rspamd_mimepart_classname));
+ rspamd_lua_check_udata_maybe(L, 3, rspamd_mimepart_classname));
}
if (task && task->message && url && url->url) {
if (rspamd_url_set_add_or_increase(MESSAGE_FIELD(task, urls), url->url, false)) {
- if(mpart && mpart->urls) {
+ if (mpart && mpart->urls) {
inject_url_query(task, url->url, mpart->urls);
}
}
struct rspamd_symbol_option *opt;
struct rspamd_symbols_group *sym_group;
unsigned int i;
- int j = 1, table_fields_cnt = 4;
+ int j = 1, table_fields_cnt = 5;
if (!metric_res) {
metric_res = task->result;
lua_pushstring(L, symbol);
lua_settable(L, -3);
}
+
lua_pushstring(L, "score");
lua_pushnumber(L, s->score);
lua_settable(L, -3);
+ /* Dynamic weight of the symbol */
+ if (s->sym->score != 0) {
+ lua_pushstring(L, "weight");
+ lua_pushnumber(L, s->score / s->sym->score);
+ }
+ else {
+ lua_pushstring(L, "weight");
+ lua_pushnumber(L, 0.0);
+ }
+ lua_settable(L, -3);
+
if (s->sym && s->sym->gr) {
lua_pushstring(L, "group");
lua_pushstring(L, s->sym->gr->name);