#include "filter.h"
#include "composites.h"
+#include <math.h>
+
#define msg_err_composites(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \
"composites", task->task_pool->tag.uid, \
G_STRFUNC, \
{
gchar t;
struct symbol_remove_data *rd, *nrd;
+ struct rspamd_task *task = cd->task;
if (ms == NULL) {
return;
if (rd == NULL) {
DL_APPEND (rd, nrd);
g_hash_table_insert (cd->symbols_to_remove, (gpointer)ms->name, rd);
+ msg_debug_composites ("added symbol %s to removal: %d policy, from composite %s",
+ ms->name, nrd->action, cd->composite->sym);
}
else {
DL_APPEND (rd, nrd);
+ msg_debug_composites ("append symbol %s to removal: %d policy, from composite %s",
+ ms->name, nrd->action, cd->composite->sym);
}
}
struct rspamd_task *task = cd->task;
GHashTableIter it;
gpointer k, v;
- gdouble rc = 0;
+ gdouble rc = 0, max = 0;
if (isset (cd->checked, cd->composite->id * 2)) {
/* We have already checked this composite, so just return its value */
cd,
ms,
beg);
+
+ if (fabs (rc) > max) {
+ max = fabs (rc);
+ }
}
}
}
+
+ rc = max;
}
else if (strncmp (sym, "g+:", 3) == 0) {
/* Group, positive symbols only */
cd,
ms,
beg);
+
+ if (fabs (rc) > max) {
+ max = fabs (rc);
+ }
}
}
}
+
+ rc = max;
}
}
else if (strncmp (sym, "g-:", 3) == 0) {
- /* Group, positive symbols only */
+ /* Group, negative symbols only */
gr = g_hash_table_lookup (cd->task->cfg->groups, sym + 3);
if (gr != NULL) {
cd,
ms,
beg);
+
+ if (fabs (rc) > max) {
+ max = fabs (rc);
+ }
}
}
}
+
+ rc = max;
}
}
else {
}
}
+ msg_debug_composites ("final result for composite %s is %.2f",
+ cd->composite->sym, rc);
+
return rc;
}