Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5762:9e762641180d HEAD
Handle delay-newmail workaround completely in the IMAP code.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 18 Jun 2007 00:28:07 +0300 |
parents | 8008fbb660c1 |
children | 2f0d30828c14 |
files | src/imap/imap-sync.c |
diffstat | 1 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-sync.c Sun Jun 17 22:08:50 2007 +0300 +++ b/src/imap/imap-sync.c Mon Jun 18 00:28:07 2007 +0300 @@ -26,7 +26,8 @@ unsigned int messages_count; - bool failed; + unsigned int failed:1; + unsigned int no_newmail:1; }; struct imap_sync_context * @@ -76,12 +77,12 @@ t_push(); - ctx->client->messages_count = status.messages; - if (status.messages != ctx->messages_count) { + if (status.messages != ctx->messages_count && !ctx->no_newmail) { + ctx->client->messages_count = status.messages; client_send_line(ctx->client, t_strdup_printf("* %u EXISTS", status.messages)); } - if (status.recent != ctx->client->recent_count) { + if (status.recent != ctx->client->recent_count && !ctx->no_newmail) { ctx->client->recent_count = status.recent; client_send_line(ctx->client, t_strdup_printf("* %u RECENT", status.recent)); @@ -230,6 +231,7 @@ { struct client *client = cmd->client; struct cmd_sync_context *ctx; + bool no_newmail; i_assert(client->output_lock == cmd || client->output_lock == NULL); @@ -239,20 +241,19 @@ return TRUE; } - if ((client_workarounds & WORKAROUND_DELAY_NEWMAIL) != 0 && - (flags & MAILBOX_SYNC_FLAG_FAST) != 0) { - /* expunges might break just as badly as new mail - notifications. besides, currently indexing code doesn't - handle expunges + no-newmail so this is required, unless - we did this only for no-expunges case.. */ - flags |= MAILBOX_SYNC_FLAG_NO_NEWMAIL | - MAILBOX_SYNC_FLAG_NO_EXPUNGES; + no_newmail = (client_workarounds & WORKAROUND_DELAY_NEWMAIL) != 0 && + (flags & MAILBOX_SYNC_FLAG_FAST) != 0; + if (no_newmail) { + /* expunges might break the client just as badly as new mail + notifications. */ + flags |= MAILBOX_SYNC_FLAG_NO_EXPUNGES; } ctx = p_new(cmd->pool, struct cmd_sync_context, 1); ctx->tagline = p_strdup(cmd->pool, tagline); ctx->sync_ctx = imap_sync_init(client, client->mailbox, imap_flags, flags); + ctx->sync_ctx->no_newmail = no_newmail; cmd->func = cmd_sync_continue; cmd->context = ctx;