if (ctx->condstore) {
/* Enable while no mailbox is opened to avoid sending
HIGHESTMODSEQ for previously opened mailbox */
- client_enable(client, imap_feature_condstore);
+ (void)client_enable(client, imap_feature_condstore);
}
ret = select_open(ctx, mailbox, readonly);
"Invalid modseq");
return FALSE;
}
- client_enable(ctx->cmd->client, imap_feature_condstore);
+ (void)client_enable(ctx->cmd->client, imap_feature_condstore);
} else {
client_send_command_error(ctx->cmd,
"Unknown STORE modifier");
return FALSE;
}
- feat->callback(client);
+ if (!feat->callback(client))
+ return FALSE;
+
/* set after the callback, so the callback can see what features were
previously set */
bool value = TRUE;
return *featurep;
}
-static void imap_client_enable_condstore(struct client *client)
+static bool imap_client_enable_condstore(struct client *client)
{
struct mailbox_status status;
int ret;
if (client->mailbox == NULL)
- return;
+ return TRUE;
if ((client_enabled_mailbox_features(client) & MAILBOX_FEATURE_CONDSTORE) != 0)
- return;
+ return TRUE;
ret = mailbox_enable(client->mailbox, MAILBOX_FEATURE_CONDSTORE);
if (ret == 0) {
client_send_untagged_storage_error(client,
mailbox_get_storage(client->mailbox));
}
+ return TRUE;
}
-static void imap_client_enable_qresync(struct client *client)
+static bool imap_client_enable_qresync(struct client *client)
{
/* enable also CONDSTORE */
- client_enable(client, imap_feature_condstore);
+ return client_enable(client, imap_feature_condstore);
}
#ifdef EXPERIMENTAL_MAIL_UTF8
-static void imap_client_enable_utf8accept(struct client *client)
+static bool imap_client_enable_utf8accept(struct client *client)
{
if (client->mailbox != NULL)
mailbox_enable(client->mailbox, MAILBOX_FEATURE_UTF8ACCEPT);
+ return TRUE;
}
#endif
#ifndef IMAP_FEATURE_H
#define IMAP_FEATURE_H
-typedef void imap_client_enable_callback_t(struct client *);
+/* Returns TRUE if the ENABLE was accepted. */
+typedef bool imap_client_enable_callback_t(struct client *);
struct imap_feature {
const char *feature;
ctx->error = "FETCH MODSEQ can't be used with non-permanent modseqs";
return FALSE;
}
- client_enable(ctx->fetch_ctx->client, imap_feature_condstore);
+ (void)client_enable(ctx->fetch_ctx->client, imap_feature_condstore);
imap_fetch_add_handler(ctx, IMAP_FETCH_HANDLER_FLAG_BUFFERED,
NULL, fetch_modseq, NULL);
return TRUE;
if (ctx->have_modseqs) {
ctx->return_options |= SEARCH_RETURN_MODSEQ;
- client_enable(cmd->client, imap_feature_condstore);
+ (void)client_enable(cmd->client, imap_feature_condstore);
}
ctx->box = cmd->client->mailbox;
*error_r = t_strdup_printf("Unknown feature '%s'", name);
return 0;
}
- client_enable(client, feature_idx);
+ if (!client_enable(client, feature_idx)) {
+ *error_r = t_strdup_printf("Feature '%s' couldn't be enabled",
+ name);
+ return 0;
+ }
return p - data;
}
if (HAS_ALL_BITS(items->flags, IMAP_STATUS_ITEM_UNSEEN))
status |= STATUS_UNSEEN;
if (HAS_ALL_BITS(items->flags, IMAP_STATUS_ITEM_HIGHESTMODSEQ)) {
- client_enable(client, imap_feature_condstore);
+ (void)client_enable(client, imap_feature_condstore);
status |= STATUS_HIGHESTMODSEQ;
}
if (HAS_ANY_BITS(items->flags, IMAP_STATUS_ITEM_SIZE |