Mercurial > dovecot > core-2.2
changeset 12765:b36c14a5d680
imapc: Don't try to wait for FETCH to return messages that are known to be expunged.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 24 Feb 2011 17:06:41 +0200 |
parents | 0c1e221fc140 |
children | c23cd8a92661 |
files | src/lib-storage/index/imapc/imapc-search.c |
diffstat | 1 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-search.c Thu Feb 24 15:37:22 2011 +0200 +++ b/src/lib-storage/index/imapc/imapc-search.c Thu Feb 24 17:06:41 2011 +0200 @@ -12,6 +12,7 @@ #include "index-search-private.h" #include "imapc-mail.h" #include "imapc-client.h" +#include "imapc-seqmap.h" #include "imapc-storage.h" struct imapc_search_context { @@ -150,10 +151,24 @@ if (!ret) return FALSE; - if (ctx->fetching) { - mbox->cur_fetch_mail = mail; - imapc_client_run(mbox->storage->client); - mbox->cur_fetch_mail = NULL; + if (!ctx->fetching) { + /* no need to fetch anything from remote */ + } else if (mail_index_is_expunged(mbox->box.view, mail->seq)) { + /* already synced this message as expunged. + remote server won't have it. */ + } else { + struct imapc_seqmap *seqmap; + uint32_t rseq; + + seqmap = imapc_client_mailbox_get_seqmap(mbox->client_box); + rseq = imapc_seqmap_lseq_to_rseq(seqmap, mail->seq); + if (rseq == 0) { + /* expunged from remote already. */ + } else { + mbox->cur_fetch_mail = mail; + imapc_client_run(mbox->storage->client); + mbox->cur_fetch_mail = NULL; + } } return TRUE; }