]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Remove mail_user.have_special_use_mailboxes
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 6 Mar 2025 12:30:58 +0000 (14:30 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Mar 2025 13:01:57 +0000 (13:01 +0000)
This avoids having to go through all mailbox settings in all namespaces when
initializing user.

src/lib-storage/mail-storage-settings.c
src/lib-storage/mail-storage-settings.h
src/lib-storage/mail-user.c
src/lib-storage/mail-user.h

index 2dcba3dc47dc81a4827e43e78106e44f2c99366f..666af31255644f30eaf588405b6a8e51bb120629 100644 (file)
@@ -458,46 +458,7 @@ static bool mail_cache_fields_parse(const char *key,
        }
        return TRUE;
 }
-/* </settings checks> */
-
-bool mail_user_settings_update_special_use(struct mail_user *user,
-                                          const struct mail_storage_settings *set,
-                                          const char **error_r)
-{
-       const struct mail_namespace_settings *ns;
-       const char *ns_name, *error;
-
-       /* Check if there are any global mailbox { .. } settings */
-       if (settings_get(user->event, &mail_namespace_setting_parser_info,
-                        SETTINGS_GET_FLAG_FAKE_EXPAND, &ns, error_r) < 0)
-               return FALSE;
-       if (ns->parsed_have_special_use_mailboxes && !ns->disabled)
-               user->have_special_use_mailboxes = TRUE;
-       settings_free(ns);
-
-       /* Check mailbox { .. } settings inside namespace { .. } */
-       if (!array_is_created(&set->namespaces) || user->have_special_use_mailboxes)
-               return TRUE;
-
-       array_foreach_elem(&set->namespaces, ns_name) {
-               if (settings_get_filter(user->event, "namespace", ns_name,
-                                       &mail_namespace_setting_parser_info,
-                                       SETTINGS_GET_FLAG_FAKE_EXPAND,
-                                       &ns, &error) < 0) {
-                       *error_r = t_strdup_printf(
-                               "Failed to get namespace %s: %s",
-                               ns_name, error);
-                       return FALSE;
-               }
-
-               if (ns->parsed_have_special_use_mailboxes && !ns->disabled)
-                       user->have_special_use_mailboxes = TRUE;
-               settings_free(ns);
-       }
-       return TRUE;
-}
 
-/* <settings checks> */
 static bool
 mailbox_list_get_path_setting(const char *key, const char **value,
                              pool_t pool, enum mailbox_list_path_type *type_r)
index 919320792055aa42ce3802fbe8bed40170c1aa26..b212fdfbe53280748a1800b121d6b54b146ab5c5 100644 (file)
@@ -218,8 +218,4 @@ const char *
 mailbox_settings_get_vname(pool_t pool, const struct mail_namespace *ns,
                           const struct mailbox_settings *set);
 
-bool mail_user_settings_update_special_use(struct mail_user *user,
-                                          const struct mail_storage_settings *set,
-                                          const char **error_r);
-
 #endif
index 30f19320c5af2b93f43e80d9283b8916f59fe7e8..b6735b8bb520b240543c629b619dec03a6a3b84d 100644 (file)
@@ -112,8 +112,7 @@ int mail_user_init(struct mail_user *user, const char **error_r)
        i_assert(!user->initialized);
 
        if (settings_get(user->event, &mail_storage_setting_parser_info, 0,
-                        &user->_mail_set, &error) < 0 ||
-           !mail_user_settings_update_special_use(user, user->_mail_set, &error))
+                        &user->_mail_set, &error) < 0)
                user->error = p_strdup(user->pool, error);
 
        if (user->error == NULL) {
index 13955076c397c6c00da08d0016402e8ed106432d..06fe118f4889afb04a1e2e89476cdc1715f208c1 100644 (file)
@@ -109,8 +109,6 @@ struct mail_user {
        bool stats_enabled:1;
        /* This session was restored (e.g. IMAP unhibernation) */
        bool session_restored:1;
-       /* TRUE if any mailboxes have special_use flags */
-       bool have_special_use_mailboxes;
 };
 
 struct mail_user_module_register {