This simplifies the following commits.
str = t_str_ucase(str);
if (strcmp(str, "CONDSTORE") == 0) {
if (client_enable(cmd->client,
- MAILBOX_FEATURE_CONDSTORE) == 0)
+ imap_feature_condstore) == 0)
str_append(reply, " CONDSTORE");
} else if (strcmp(str, "QRESYNC") == 0) {
- if (client_enable(cmd->client, MAILBOX_FEATURE_QRESYNC |
- MAILBOX_FEATURE_CONDSTORE) == 0)
+ if (client_enable(cmd->client, imap_feature_qresync |
+ imap_feature_condstore) == 0)
str_append(reply, " QRESYNC");
}
}
}
if (strcmp(name, "VANISHED") == 0 && cmd->uid) {
if ((ctx->client->enabled_features &
- MAILBOX_FEATURE_QRESYNC) == 0) {
+ imap_feature_qresync) == 0) {
client_send_command_error(cmd, "QRESYNC not enabled");
return FALSE;
}
unsigned int count;
if ((ctx->cmd->client->enabled_features &
- MAILBOX_FEATURE_QRESYNC) == 0) {
+ imap_feature_qresync) == 0) {
*error_r = "QRESYNC not enabled";
return FALSE;
}
if (ctx->condstore) {
/* Enable while no mailbox is opened to avoid sending
HIGHESTMODSEQ for previously opened mailbox */
- (void)client_enable(client, MAILBOX_FEATURE_CONDSTORE);
+ (void)client_enable(client, imap_feature_condstore);
}
ret = select_open(ctx, mailbox, readonly);
return FALSE;
}
(void)client_enable(ctx->cmd->client,
- MAILBOX_FEATURE_CONDSTORE);
+ imap_feature_condstore);
} else {
client_send_command_error(ctx->cmd,
"Unknown STORE modifier");
came externally, so we'll just send the UID for all flag
changes that we see. */
if (cmd->uid && (!ctx.silent || (client->enabled_features &
- MAILBOX_FEATURE_CONDSTORE) != 0))
+ imap_feature_condstore) != 0))
imap_sync_flags |= IMAP_SYNC_FLAG_SEND_UID;
return cmd_sync(cmd, (cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
struct client *imap_clients = NULL;
unsigned int imap_client_count = 0;
+unsigned int imap_feature_condstore = MAILBOX_FEATURE_CONDSTORE;
+unsigned int imap_feature_qresync = MAILBOX_FEATURE_QRESYNC;
+
static const char *client_command_state_names[CLIENT_COMMAND_STATE_DONE+1] = {
"wait-input",
"wait-output",
return 0;
ret = mailbox_enable(client->mailbox, features);
- if ((features & MAILBOX_FEATURE_CONDSTORE) != 0 && ret == 0) {
+ if ((features & imap_feature_condstore) != 0 && ret == 0) {
/* CONDSTORE being enabled while mailbox is selected.
Notify client of the latest HIGHESTMODSEQ. */
ret = mailbox_get_status(client->mailbox,
extern struct client *imap_clients;
extern unsigned int imap_client_count;
+extern unsigned int imap_feature_condstore;
+extern unsigned int imap_feature_qresync;
+
/* Create new client with specified input/output handles. socket specifies
if the handle is a socket. */
struct client *client_create(int fd_in, int fd_out, const char *session_id,
ctx->error = "FETCH MODSEQ can't be used with non-permanent modseqs";
return FALSE;
}
- (void)client_enable(ctx->fetch_ctx->client, MAILBOX_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;
int ret = 1;
i_zero(&items);
- if ((client->enabled_features & MAILBOX_FEATURE_CONDSTORE) != 0)
+ if ((client->enabled_features & imap_feature_condstore) != 0)
items.status |= STATUS_HIGHESTMODSEQ;
box = mailbox_alloc(notify_ns->ns->list, rec->vname, 0);
if (ctx->have_modseqs) {
ctx->return_options |= SEARCH_RETURN_MODSEQ;
- (void)client_enable(cmd->client, MAILBOX_FEATURE_CONDSTORE);
+ (void)client_enable(cmd->client, imap_feature_condstore);
}
ctx->box = cmd->client->mailbox;
numpack_encode(dest, status.uidvalidity);
numpack_encode(dest, status.uidnext);
numpack_encode(dest, status.messages);
- if ((client->enabled_features & MAILBOX_FEATURE_QRESYNC) != 0 &&
+ if ((client->enabled_features & imap_feature_qresync) != 0 &&
!client->nonpermanent_modseqs)
numpack_encode(dest, client->sync_last_full_modseq);
else
/* IMAP features */
if (client->enabled_features != 0) {
- i_assert((client->enabled_features & ~(MAILBOX_FEATURE_CONDSTORE |
- MAILBOX_FEATURE_QRESYNC)) == 0);
+ i_assert((client->enabled_features & ~(imap_feature_condstore |
+ imap_feature_qresync)) == 0);
buffer_append_c(dest, IMAP_STATE_TYPE_ENABLED_FEATURES);
- if ((client->enabled_features & MAILBOX_FEATURE_CONDSTORE) != 0)
+ if ((client->enabled_features & imap_feature_condstore) != 0)
buffer_append_c(dest, IMAP_STATE_FEATURE_CONDSTORE);
- if ((client->enabled_features & MAILBOX_FEATURE_QRESYNC) != 0)
+ if ((client->enabled_features & imap_feature_qresync) != 0)
buffer_append_c(dest, IMAP_STATE_FEATURE_QRESYNC);
buffer_append_c(dest, '\0');
}
return -1;
}
- if ((client->enabled_features & MAILBOX_FEATURE_QRESYNC) == 0) {
+ if ((client->enabled_features & imap_feature_qresync) == 0) {
str = t_str_new(32);
for (i = expunge_count; i > 0; i--) {
str_truncate(str, 0);
pool_unref(&pool);
imap_fetch_init_nofail_handler(fetch_ctx, imap_fetch_flags_init);
- if ((client->enabled_features & MAILBOX_FEATURE_QRESYNC) != 0) {
+ if ((client->enabled_features & imap_feature_qresync) != 0) {
imap_fetch_init_nofail_handler(fetch_ctx, imap_fetch_uid_init);
imap_fetch_init_nofail_handler(fetch_ctx, imap_fetch_modseq_init);
}
*error_r = "Couldn't send flag changes";
return -1;
}
- if ((client->enabled_features & MAILBOX_FEATURE_QRESYNC) != 0 &&
+ if ((client->enabled_features & imap_feature_qresync) != 0 &&
!client->nonpermanent_modseqs &&
status.highest_modseq != state->highest_modseq) {
client_send_line(client, t_strdup_printf(
feature = data[i];
switch (feature) {
case IMAP_STATE_FEATURE_CONDSTORE:
- client->enabled_features |= MAILBOX_FEATURE_CONDSTORE;
+ client->enabled_features |= imap_feature_condstore;
break;
case IMAP_STATE_FEATURE_QRESYNC:
- client->enabled_features |= MAILBOX_FEATURE_QRESYNC;
+ client->enabled_features |= imap_feature_qresync;
break;
default:
*error_r = t_strdup_printf(
}
if ((items->status & STATUS_HIGHESTMODSEQ) != 0)
- (void)client_enable(client, MAILBOX_FEATURE_CONDSTORE);
+ (void)client_enable(client, imap_feature_condstore);
ret = mailbox_get_status(box, items->status, &result_r->status);
if (items->metadata != 0 && ret == 0) {
ctx->messages_count = client->messages_count;
i_array_init(&ctx->tmp_keywords, client->keywords.announce_count + 8);
- if ((client->enabled_features & MAILBOX_FEATURE_QRESYNC) != 0) {
+ if ((client->enabled_features & imap_feature_qresync) != 0) {
i_array_init(&ctx->expunges, 128);
/* always send UIDs in FETCH replies */
ctx->imap_flags |= IMAP_SYNC_FLAG_SEND_UID;
ret = imap_sync_finish(ctx, TRUE);
imap_client_notify_finished(ctx->client);
- if ((ctx->client->enabled_features & MAILBOX_FEATURE_QRESYNC) != 0 &&
+ if ((ctx->client->enabled_features & imap_feature_qresync) != 0 &&
!ctx->client->nonpermanent_modseqs)
imap_sync_send_highestmodseq(ctx, sync_cmd);
str_printfa(str, "* %u FETCH (", ctx->seq);
if ((ctx->imap_flags & IMAP_SYNC_FLAG_SEND_UID) != 0)
str_printfa(str, "UID %u ", ctx->mail->uid);
- if ((ctx->client->enabled_features & MAILBOX_FEATURE_CONDSTORE) != 0 &&
+ if ((ctx->client->enabled_features & imap_feature_condstore) != 0 &&
!ctx->client->nonpermanent_modseqs) {
imap_sync_add_modseq(ctx, str);
str_append_c(str, ' ');
break;
case MAILBOX_SYNC_TYPE_MODSEQ:
if ((ctx->client->enabled_features &
- MAILBOX_FEATURE_CONDSTORE) == 0)
+ imap_feature_condstore) == 0)
break;
if (!ctx->client->notify_flag_changes) {
/* NOTIFY: FlagChange not specified for