]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Add description to the groups
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Aug 2019 12:48:33 +0000 (13:48 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Aug 2019 12:48:33 +0000 (13:48 +0100)
Issue: #2985

src/libserver/cfg_file.h
src/libserver/cfg_rcl.c
src/libserver/protocol.c

index 3c0df031932789c251e21626d1646e1aa38b2a2a..d4855e032d1963384cdeac72073b6794369a5fbd 100644 (file)
@@ -117,6 +117,7 @@ enum rspamd_symbol_group_flags {
 struct rspamd_symbol;
 struct rspamd_symbols_group {
        gchar *name;
+       gchar *description;
        GHashTable *symbols;
        gdouble max_score;
        enum rspamd_symbol_group_flags flags;
index 5b67a5f61ca09a3b1c391b2b130507195d732d04..ba1b614a0f1e0c08f66261d045c5521e668daf2b 100644 (file)
@@ -329,6 +329,7 @@ rspamd_rcl_group_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
        const ucl_object_t *val, *elt;
        struct rspamd_rcl_section *subsection;
        struct rspamd_rcl_symbol_data sd;
+       const gchar *description = NULL;
 
        g_assert (key != NULL);
 
@@ -388,6 +389,14 @@ rspamd_rcl_group_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
                }
        }
 
+       elt = ucl_object_lookup (obj, "description");
+       if (elt) {
+               description = ucl_object_tostring (elt);
+
+               gr->description = rspamd_mempool_strdup (cfg->cfg_pool,
+                               description);
+       }
+
        sd.gr = gr;
        sd.cfg = cfg;
 
index a51cbf17fa81356d0a844bfd17f7bd4e737161bb..3f07926be15ad53113166289a6a4723dc77513bf 100644 (file)
@@ -1136,6 +1136,11 @@ rspamd_metric_group_ucl (struct rspamd_task *task,
        ucl_object_insert_key (obj, ucl_object_fromdouble (score),
                        "score", 0, false);
 
+       if (gr->description) {
+               ucl_object_insert_key (obj, ucl_object_fromstring (gr->description),
+                               "description", 0, false);
+       }
+
        return obj;
 }