Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7631:5d3b6a766032 HEAD
Added MAILBOX_TRANSACTION_FLAG_REFRESH. Use it with STORE UNCHANGEDSINCE.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 16 Mar 2008 06:53:58 +0200 |
parents | 7d208a7e0cbd |
children | 6e2e4e5c52f3 |
files | src/imap/cmd-store.c src/lib-storage/index/index-transaction.c src/lib-storage/mail-storage.h |
diffstat | 3 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-store.c Sat Mar 15 17:01:33 2008 +0200 +++ b/src/imap/cmd-store.c Sun Mar 16 06:53:58 2008 +0200 @@ -127,6 +127,7 @@ struct mail *mail; struct imap_store_context ctx; ARRAY_TYPE(seq_range) modified_set = ARRAY_INIT; + enum mailbox_transaction_flags flags = 0; const char *tagged_reply; string_t *str; bool failed; @@ -146,8 +147,11 @@ if (search_arg == NULL) return TRUE; - t = mailbox_transaction_begin(client->mailbox, !ctx.silent ? 0 : - MAILBOX_TRANSACTION_FLAG_HIDE); + if (ctx.silent) + flags |= MAILBOX_TRANSACTION_FLAG_HIDE; + if (ctx.max_modseq < (uint64_t)-1) + flags |= MAILBOX_TRANSACTION_FLAG_REFRESH; + t = mailbox_transaction_begin(client->mailbox, flags); search_ctx = mailbox_search_init(t, NULL, search_arg, NULL); /* FIXME: UNCHANGEDSINCE should be atomic, but this requires support
--- a/src/lib-storage/index/index-transaction.c Sat Mar 15 17:01:33 2008 +0200 +++ b/src/lib-storage/index/index-transaction.c Sun Mar 16 06:53:58 2008 +0200 @@ -74,6 +74,8 @@ trans_flags |= MAIL_INDEX_TRANSACTION_FLAG_HIDE; if ((flags & MAILBOX_TRANSACTION_FLAG_EXTERNAL) != 0) trans_flags |= MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL; + if ((flags & MAILBOX_TRANSACTION_FLAG_REFRESH) != 0) + (void)mail_index_refresh(ibox->index); t = mail_index_transaction_begin(ibox->view, trans_flags); it = MAIL_STORAGE_CONTEXT(t);
--- a/src/lib-storage/mail-storage.h Sat Mar 15 17:01:33 2008 +0200 +++ b/src/lib-storage/mail-storage.h Sun Mar 16 06:53:58 2008 +0200 @@ -128,7 +128,9 @@ /* Always assign UIDs to messages when saving/copying. Normally this is done only if the mailbox is synced, or if dest_mail parameter was non-NULL to mailbox_save_init() or mailbox_copy() */ - MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS = 0x04 + MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS = 0x04, + /* Refresh the index so lookups return latest flags/modseqs */ + MAILBOX_TRANSACTION_FLAG_REFRESH = 0x08 }; enum mailbox_sync_flags {