]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Add and use client_enabled_mailbox_features()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 28 Nov 2018 10:50:51 +0000 (12:50 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 29 Nov 2018 10:58:37 +0000 (10:58 +0000)
This simplifies the following commits.

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

index 2a7c198942d164d1bcff2e858ff9dabe12d015b7..7fb2417de8ebcbbd0809398e52a33e7fe4e65d7b 100644 (file)
@@ -437,7 +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");
-       (void)mailbox_enable(box, ctx->client->enabled_features);
+       (void)mailbox_enable(box, client_enabled_mailbox_features(ctx->client));
 
        if (imap_status_get(cmd, info->ns, info->vname, &items, &result) < 0) {
                if (result.error == MAIL_ERROR_PERM)
index 98923774307ec28b1c7ca5e93330abfed0abca65..9b7c33d218a8e3203d8fd43153ffea4ad0e473dd 100644 (file)
@@ -290,7 +290,7 @@ select_open(struct imap_select_context *ctx, const char *mailbox, bool readonly)
                return -1;
        }
 
-       ret = mailbox_enable(ctx->box, client->enabled_features);
+       ret = mailbox_enable(ctx->box, client_enabled_mailbox_features(client));
        if (ret < 0 ||
            mailbox_sync(ctx->box, MAILBOX_SYNC_FLAG_FULL_READ) < 0) {
                client_send_box_error(ctx->cmd, ctx->box);
index 3006a1c588d285434bd16346ae0ee12af73233e5..6341a99efe72f56d18a8b6fc964786c1b9d0be27 100644 (file)
@@ -1491,6 +1491,11 @@ bool client_has_enabled(struct client *client, unsigned int feature_idx)
        return (client->enabled_features & features) != 0;
 }
 
+enum mailbox_feature client_enabled_mailbox_features(struct client *client)
+{
+       return client->enabled_features;
+}
+
 struct imap_search_update *
 client_search_update_lookup(struct client *client, const char *tag,
                            unsigned int *idx_r)
index 5404dc041847b56c1fdbce13ae0ccd5fada2fece..dbad74155b99c909ae13b3bfb16a68bad6956fe8 100644 (file)
@@ -308,6 +308,9 @@ bool client_handle_search_save_ambiguity(struct client_command_context *cmd);
 int client_enable(struct client *client, unsigned int feature_idx);
 /* Returns TRUE if the given feature is enabled */
 bool client_has_enabled(struct client *client, unsigned int feature_idx);
+/* Returns mailbox features that are currently enabled. */
+enum mailbox_feature client_enabled_mailbox_features(struct client *client);
+
 /* Send client processing to imap-idle process. If successful, returns TRUE
    and destroys the client. */
 bool imap_client_hibernate(struct client **client);
index 5a9fc478617b45828deaf21c9ab8835e3d85de91..d7492676ba098e52fd66e3f1b6aff387555ec588 100644 (file)
@@ -121,7 +121,7 @@ int client_open_save_dest_box(struct client_command_context *cmd,
                mailbox_free(&box);
                return -1;
        }
-       if (mailbox_enable(box, cmd->client->enabled_features) < 0) {
+       if (mailbox_enable(box, client_enabled_mailbox_features(cmd->client)) < 0) {
                client_send_box_error(cmd, box);
                mailbox_free(&box);
                return -1;
index 36d52d7884e6563593443839117c76bb15764b0c..e2c2342fe91f1a2da70f89317f67a735857651d5 100644 (file)
@@ -586,7 +586,7 @@ import_state_mailbox_open(struct client *client,
                return -1;
        }
 
-       ret = mailbox_enable(box, client->enabled_features);
+       ret = mailbox_enable(box, client_enabled_mailbox_features(client));
        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 578e483e1b39739d89fc7507ee362aa8d5ede32f..5ab3958346670c4b906eda2b33f13c2e2bfc50e3 100644 (file)
@@ -75,7 +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");
-               (void)mailbox_enable(box, client->enabled_features);
+               (void)mailbox_enable(box, client_enabled_mailbox_features(client));
        }
 
        if ((items->status & STATUS_HIGHESTMODSEQ) != 0)