]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add public flag to the groups
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 30 Aug 2019 17:36:40 +0000 (18:36 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 30 Aug 2019 18:40:08 +0000 (19:40 +0100)
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c

index 1fd56441c2a381ee35f022cad0612048eaac1660..9573b776aeee3bbdfa31589dc481ffa83bc72c37 100644 (file)
@@ -109,6 +109,7 @@ enum rspamd_symbol_group_flags {
        RSPAMD_SYMBOL_GROUP_DISABLED = (1 << 0),
        RSPAMD_SYMBOL_GROUP_ONE_SHOT = (1 << 1),
        RSPAMD_SYMBOL_GROUP_UNGROUPED = (1 << 2),
+       RSPAMD_SYMBOL_GROUP_PUBLIC = (1 << 3),
 };
 
 /**
index 5a10a6c3e75a5bcd9d4104ba44e88fd3b1a8767c..d224b4029459224bff7c08e959fdef498885057a 100644 (file)
@@ -389,6 +389,36 @@ rspamd_rcl_group_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
                }
        }
 
+       if ((elt = ucl_object_lookup (obj, "public")) != NULL) {
+               if (ucl_object_type (elt) != UCL_BOOLEAN) {
+                       g_set_error (err,
+                                       CFG_RCL_ERROR,
+                                       EINVAL,
+                                       "public attribute is not boolean for symbol: '%s'",
+                                       key);
+
+                       return FALSE;
+               }
+               if (ucl_object_toboolean (elt)) {
+                       gr->flags |= RSPAMD_SYMBOL_GROUP_PUBLIC;
+               }
+       }
+
+       if ((elt = ucl_object_lookup (obj, "private")) != NULL) {
+               if (ucl_object_type (elt) != UCL_BOOLEAN) {
+                       g_set_error (err,
+                                       CFG_RCL_ERROR,
+                                       EINVAL,
+                                       "private attribute is not boolean for symbol: '%s'",
+                                       key);
+
+                       return FALSE;
+               }
+               if (!ucl_object_toboolean (elt)) {
+                       gr->flags |= RSPAMD_SYMBOL_GROUP_PUBLIC;
+               }
+       }
+
        elt = ucl_object_lookup (obj, "description");
        if (elt) {
                description = ucl_object_tostring (elt);