]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Cleanup - don't avoid calling mailbox_enable(box, 0)
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 28 Nov 2018 10:48:47 +0000 (12:48 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 6 Feb 2019 08:09:12 +0000 (10:09 +0200)
This simplifies the following changes. mailbox_enable() is an efficient
function and it doesn't mind being called with features=0 parameter.

src/imap/cmd-notify.c
src/imap/cmd-select.c
src/imap/imap-commands-util.c
src/imap/imap-state.c
src/imap/imap-status.c

index fa4b46ad793ea9dcba0fc19efc7bd513af47e155..2a7c198942d164d1bcff2e858ff9dabe12d015b7 100644 (file)
@@ -437,8 +437,7 @@ imap_notify_box_send_status(struct client_command_context *cmd,
 
        box = mailbox_alloc(info->ns->list, info->vname, MAILBOX_FLAG_READONLY);
        mailbox_set_reason(box, "NOTIFY send STATUS");
-       if (ctx->client->enabled_features != 0)
-               (void)mailbox_enable(box, ctx->client->enabled_features);
+       (void)mailbox_enable(box, ctx->client->enabled_features);
 
        if (imap_status_get(cmd, info->ns, info->vname, &items, &result) < 0) {
                if (result.error == MAIL_ERROR_PERM)
index c6defc99a57a4fcb0b3e8ce02d0621edd4f87bae..98923774307ec28b1c7ca5e93330abfed0abca65 100644 (file)
@@ -290,8 +290,7 @@ select_open(struct imap_select_context *ctx, const char *mailbox, bool readonly)
                return -1;
        }
 
-       if (client->enabled_features != 0)
-               ret = mailbox_enable(ctx->box, client->enabled_features);
+       ret = mailbox_enable(ctx->box, client->enabled_features);
        if (ret < 0 ||
            mailbox_sync(ctx->box, MAILBOX_SYNC_FLAG_FULL_READ) < 0) {
                client_send_box_error(ctx->cmd, ctx->box);
index 95c86a9a9f1f190d1d338ad1a82acdac1940814d..5a9fc478617b45828deaf21c9ab8835e3d85de91 100644 (file)
@@ -121,12 +121,10 @@ int client_open_save_dest_box(struct client_command_context *cmd,
                mailbox_free(&box);
                return -1;
        }
-       if (cmd->client->enabled_features != 0) {
-               if (mailbox_enable(box, cmd->client->enabled_features) < 0) {
-                       client_send_box_error(cmd, box);
-                       mailbox_free(&box);
-                       return -1;
-               }
+       if (mailbox_enable(box, cmd->client->enabled_features) < 0) {
+               client_send_box_error(cmd, box);
+               mailbox_free(&box);
+               return -1;
        }
        *destbox_r = box;
        return 0;
index fa6e4246a55bf73a6d28489435447aeb1e251b09..36d52d7884e6563593443839117c76bb15764b0c 100644 (file)
@@ -586,8 +586,7 @@ import_state_mailbox_open(struct client *client,
                return -1;
        }
 
-       if (client->enabled_features != 0)
-               ret = mailbox_enable(box, client->enabled_features);
+       ret = mailbox_enable(box, client->enabled_features);
        if (ret < 0 || mailbox_sync(box, 0) < 0) {
                *error_r = t_strdup_printf("Couldn't sync mailbox: %s",
                        mailbox_get_last_internal_error(box, NULL));
index 01cb8f8883d9fa92de13662c2d5cddd5b1b60061..578e483e1b39739d89fc7507ee362aa8d5ede32f 100644 (file)
@@ -75,8 +75,7 @@ int imap_status_get(struct client_command_context *cmd,
                /* open the mailbox */
                box = mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_READONLY);
                mailbox_set_reason(box, "STATUS");
-               if (client->enabled_features != 0)
-                       (void)mailbox_enable(box, client->enabled_features);
+               (void)mailbox_enable(box, client->enabled_features);
        }
 
        if ((items->status & STATUS_HIGHESTMODSEQ) != 0)