]> source.dussan.org Git - rspamd.git/commitdiff
Implement group composites.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 5 May 2015 18:07:38 +0000 (19:07 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 5 May 2015 18:07:38 +0000 (19:07 +0100)
src/libmime/filter.c

index ed5b2ec8f78ff243e3888362d6a850358158f440..e8e27d3cf2d707bd33da5216fa3f76420c450b7f 100644 (file)
@@ -32,6 +32,7 @@
 #include "expression.h"
 #include "diff.h"
 #include "libstat/stat_api.h"
+#include "utlist.h"
 
 #ifdef WITH_LUA
 #   include "lua/lua_common.h"
@@ -525,6 +526,8 @@ rspamd_composite_expr_process (gpointer input, rspamd_expression_atom_t *atom)
        const gchar *sym = atom->data;
        struct symbol_remove_data *rd;
        struct symbol *ms;
+       struct rspamd_symbols_group *gr;
+       struct rspamd_symbol_def *sdef;
        gint rc = 0;
        gchar t = '\0';
 
@@ -538,7 +541,21 @@ rspamd_composite_expr_process (gpointer input, rspamd_expression_atom_t *atom)
                t = *sym ++;
        }
 
-       rc = rspamd_composite_process_single_symbol (cd, sym, &ms);
+       if (strncmp (sym, "g:", 2) == 0) {
+               gr = g_hash_table_lookup (cd->task->cfg->symbols_groups, sym + 2);
+
+               if (gr != NULL) {
+                       LL_FOREACH (gr->symbols, sdef) {
+                               rc = rspamd_composite_process_single_symbol (cd, sdef->name, &ms);
+                               if (rc) {
+                                       break;
+                               }
+                       }
+               }
+       }
+       else {
+               rc = rspamd_composite_process_single_symbol (cd, sym, &ms);
+       }
 
        if (rc && ms) {
                /*