This simplifies the following commits.
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)
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);
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)
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);
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;
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));
/* 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)