dovecot-2.1: mbox: Make sure each mailbox creation generates a d...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 11 15:03:09 EEST 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/85966c47f172
changeset: 14413:85966c47f172
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 11 15:02:53 2012 +0300
description:
mbox: Make sure each mailbox creation generates a different UIDVALIDITY.
diffstat:
src/lib-storage/index/mbox/mbox-storage.h | 1 +
src/lib-storage/index/mbox/mbox-sync.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 1 deletions(-)
diffs (48 lines):
diff -r c67ea0d68b77 -r 85966c47f172 src/lib-storage/index/mbox/mbox-storage.h
--- a/src/lib-storage/index/mbox/mbox-storage.h Wed Apr 11 14:44:45 2012 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.h Wed Apr 11 15:02:53 2012 +0300
@@ -14,6 +14,7 @@
#define MBOX_SUBSCRIPTION_FILE_NAME ".subscriptions"
#define MBOX_INDEX_PREFIX "dovecot.index"
#define MBOX_INDEX_DIR_NAME ".imap"
+#define MBOX_UIDVALIDITY_FNAME "dovecot-uidvalidity"
struct mbox_index_header {
uint64_t sync_size;
diff -r c67ea0d68b77 -r 85966c47f172 src/lib-storage/index/mbox/mbox-sync.c
--- a/src/lib-storage/index/mbox/mbox-sync.c Wed Apr 11 14:44:45 2012 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c Wed Apr 11 15:02:53 2012 +0300
@@ -45,6 +45,7 @@
#include "istream-raw-mbox.h"
#include "mbox-storage.h"
#include "index-sync-changes.h"
+#include "mailbox-uidvalidity.h"
#include "mbox-from.h"
#include "mbox-file.h"
#include "mbox-lock.h"
@@ -1407,6 +1408,16 @@
}
}
+static uint32_t mbox_get_uidvalidity_next(struct mailbox_list *list)
+{
+ const char *path;
+
+ path = mailbox_list_get_path(list, NULL,
+ MAILBOX_LIST_PATH_TYPE_CONTROL);
+ path = t_strconcat(path, "/"MBOX_UIDVALIDITY_FNAME, NULL);
+ return mailbox_uidvalidity_next(list, path);
+}
+
static int mbox_sync_update_index_header(struct mbox_sync_context *sync_ctx)
{
struct mail_index_view *view;
@@ -1462,7 +1473,7 @@
if (sync_ctx->base_uid_validity == 0) {
sync_ctx->base_uid_validity = sync_ctx->hdr->uid_validity != 0 ?
sync_ctx->hdr->uid_validity :
- I_MAX((unsigned int)ioloop_time, 1);
+ mbox_get_uidvalidity_next(sync_ctx->mbox->box.list);
}
if (sync_ctx->base_uid_validity != sync_ctx->hdr->uid_validity) {
mail_index_update_header(sync_ctx->t,
More information about the dovecot-cvs
mailing list