client_send_command_error(cmd, "Invalid arguments.");
return TRUE;
}
- if (imap_feature_lookup(str, &feature_idx)) {
- client_enable(cmd->client, feature_idx);
+ if (imap_feature_lookup(str, &feature_idx) &&
+ client_enable(cmd->client, feature_idx)) {
str_append_c(reply, ' ');
str_append(reply, t_str_ucase(str));
}
return TRUE;
}
-void client_enable(struct client *client, unsigned int feature_idx)
+bool client_enable(struct client *client, unsigned int feature_idx)
{
if (client_has_enabled(client, feature_idx))
- return;
+ return TRUE;
const struct imap_feature *feat = imap_feature_idx(feature_idx);
if ((feat->mailbox_features & MAILBOX_FEATURE_UTF8ACCEPT) != 0 &&
!client->set->mail_utf8_extensions) {
e_debug(client->event, "Client attempted to enable UTF8 when it's disabled");
- return;
+ return FALSE;
}
feat->callback(client);
previously set */
bool value = TRUE;
array_idx_set(&client->enabled_features, feature_idx, &value);
+ return TRUE;
}
bool client_has_enabled(struct client *client, unsigned int feature_idx)
have to wait for an existing SEARCH SAVE to finish. */
bool client_handle_search_save_ambiguity(struct client_command_context *cmd);
-void client_enable(struct client *client, unsigned int feature_idx);
+/* Enable an IMAP feature. Returns TRUE if the feature was actually enabled
+ (or it was already enabled before). */
+bool 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. */