]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Remove quota_root_settings.have_reverse_warnings
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 15 Aug 2024 10:07:29 +0000 (13:07 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:13 +0000 (12:34 +0200)
Look it up on-demand instead.

src/plugins/quota/quota-private.h
src/plugins/quota/quota-util.c
src/plugins/quota/quota.c

index e0a43755ae124530c39dabfd51070fb0304f1690..b9c32ab59296531f40505963c70aee8e9ecbac1f 100644 (file)
@@ -98,9 +98,6 @@ struct quota_root_settings {
        /* If user is under quota before saving a mail, allow the last mail to
           bring the user over quota by this many bytes. */
        uint64_t quota_storage_grace;
-
-       /* TRUE if any of the warning_rules have reverse==TRUE */
-       bool have_reverse_warnings:1;
 };
 
 struct quota_root {
index 4290aafaf1bafad582a15aab8e4f62270ee95ac1..c4803efa29dfeb0425905996106bbabb79fa5325 100644 (file)
@@ -318,8 +318,6 @@ int quota_root_add_warning_rule(struct event *event, pool_t pool,
        warning->command = p_strdup(pool, p+1);
        warning->rule = rule;
        warning->reverse = reverse;
-       if (reverse)
-               root_set->have_reverse_warnings = TRUE;
 
        quota_root_recalculate_relative_rules(event, root_set,
                                              root_set->default_rule.bytes_limit,
index 68ffcb32b802f6191f9b4a2e2feee824cf33d1dc..fa5776fb9c95c7a5c0965a541eda00442adc7a1e 100644 (file)
@@ -756,6 +756,16 @@ quota_get_resource(struct quota_root *root, const char *mailbox_name,
        return *limit_r == 0 ? QUOTA_GET_RESULT_UNLIMITED : QUOTA_GET_RESULT_LIMITED;
 }
 
+static bool quota_root_have_reverse_warnings(struct quota_root *root)
+{
+       const struct quota_warning_rule *warn;
+       array_foreach(&root->set->warning_rules, warn) {
+               if (warn->reverse)
+                       return TRUE;
+       }
+       return FALSE;
+}
+
 struct quota_transaction_context *quota_transaction_begin(struct mailbox *box)
 {
        struct quota_transaction_context *ctx;
@@ -797,7 +807,7 @@ struct quota_transaction_context *quota_transaction_begin(struct mailbox *box)
                   before and after the expunges, but that's more complicated
                   and probably isn't any better.) */
                if (!(*rootp)->auto_updating ||
-                   (*rootp)->set->have_reverse_warnings)
+                   quota_root_have_reverse_warnings(*rootp))
                        ctx->auto_updating = FALSE;
        }