]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Move quota_args=hidden to quota_hidden setting
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 22 Aug 2024 08:08:53 +0000 (11:08 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:00 +0000 (10:40 +0200)
src/plugins/quota/quota-private.h
src/plugins/quota/quota-settings.c
src/plugins/quota/quota-settings.h
src/plugins/quota/quota.c

index 80cf943eefd3dc840e86eba61b04bb89141ec1ba..bff01a4d8422bcd60acfefcf51b21d4af1699a5a 100644 (file)
@@ -93,8 +93,6 @@ struct quota_root {
        bool disable_unlimited_tracking:1;
        /* Set while quota is being recalculated to avoid recursion. */
        bool recounting:1;
-       /* Quota root is hidden (to e.g. IMAP GETQUOTAROOT) */
-       bool hidden:1;
        /* Did we already check quota_over_status correctness? */
        bool quota_over_status_checked:1;
        /* Are there any quota warnings with threshold=under? */
index 699c176fd89aac61c09eb95e4c40f089c982db97..330cf4932cf6886e482611f9282ae1ebf1853615 100644 (file)
@@ -28,6 +28,7 @@ static const struct setting_define quota_setting_defines[] = {
        DEF(STR, quota_driver),
        DEF(STR, quota_args),
        DEF(BOOL, quota_ignore),
+       DEF(BOOL, quota_hidden),
        DEF(SIZE, quota_storage_size),
        DEF(UINT, quota_storage_percentage),
        DEF(SIZE, quota_storage_extra),
@@ -61,6 +62,7 @@ static const struct quota_settings quota_default_settings = {
        .quota_driver = "count",
        .quota_args = "",
        .quota_ignore = FALSE,
+       .quota_hidden = FALSE,
        .quota_storage_size = SET_SIZE_UNLIMITED,
        .quota_storage_percentage = 100,
        .quota_storage_extra = 0,
index dd740d41805044487b5783a019d2e195f4c9bd55..2e83c9448f29271e031c4005d3b5e7aabccb21ed 100644 (file)
@@ -26,6 +26,8 @@ struct quota_settings {
           this differs from unlimited quota, which still tracks the quota,
           even if it is not enforced. */
        bool quota_ignore;
+       /* Quota root is hidden (to e.g. IMAP GETQUOTAROOT) */
+       bool quota_hidden;
        /* Quota storage size is counted as:
           quota_storage_size * quota_storage_percentage / 100 +
           quota_storage_extra. */
index 5cb1218928d7644491d3231ae6ea289191bf89e0..8f911d9384feb8ee34d6cbc581430607f3d1052d 100644 (file)
@@ -49,11 +49,9 @@ static const struct quota_backend *quota_internal_backends[] = {
 
 static ARRAY(const struct quota_backend*) quota_backends;
 
-static void hidden_param_handler(struct quota_root *_root, const char *param_value);
 static void ignoreunlim_param_handler(struct quota_root *_root, const char *param_value);
 static void noenforcing_param_handler(struct quota_root *_root, const char *param_value);
 
-struct quota_param_parser quota_param_hidden = {.param_name = "hidden", .param_handler = hidden_param_handler};
 struct quota_param_parser quota_param_ignoreunlimited = {.param_name = "ignoreunlimited", .param_handler = ignoreunlim_param_handler};
 struct quota_param_parser quota_param_noenforcing = {.param_name = "noenforcing", .param_handler = noenforcing_param_handler};
 
@@ -153,7 +151,6 @@ int quota_root_default_init(struct quota_root *root, const char *args,
                            const char **error_r)
 {
        const struct quota_param_parser default_params[] = {
-               quota_param_hidden,
                quota_param_ignoreunlimited,
                quota_param_noenforcing,
                {.param_name = NULL}
@@ -637,7 +634,7 @@ const char *const *quota_root_get_resources(struct quota_root *root)
 
 bool quota_root_is_hidden(struct quota_root *root)
 {
-       return root->hidden;
+       return root->set->quota_hidden;
 }
 
 enum quota_get_result
@@ -1290,11 +1287,6 @@ void quota_recalculate(struct quota_transaction_context *ctx,
        ctx->recalculate = recalculate;
 }
 
-static void hidden_param_handler(struct quota_root *_root, const char *param_value ATTR_UNUSED)
-{
-       _root->hidden = TRUE;
-}
-
 static void ignoreunlim_param_handler(struct quota_root *_root, const char *param_value ATTR_UNUSED)
 {
        _root->disable_unlimited_tracking = TRUE;