Skip to content

Commit

Permalink
[Minor] Add public flag to the groups
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Aug 30, 2019
1 parent 0c9d6fa commit d7c3fa7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libserver/cfg_file.h
Expand Up @@ -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),
};

/**
Expand Down
30 changes: 30 additions & 0 deletions src/libserver/cfg_rcl.c
Expand Up @@ -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);
Expand Down

0 comments on commit d7c3fa7

Please sign in to comment.