dovecot-2.0: maildir: Always try to preserve message GUIDs when ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Feb 18 06:21:23 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/1b38bf29ac40
changeset: 10742:1b38bf29ac40
user: Timo Sirainen <tss at iki.fi>
date: Thu Feb 18 06:20:38 2010 +0200
description:
maildir: Always try to preserve message GUIDs when copying.
Because of this, maildir_copy_preserve_filename setting is now removed.
diffstat:
doc/example-config/conf.d/mail.conf | 8 --------
src/lib-storage/index/maildir/maildir-copy.c | 29 +++++------------------------
src/lib-storage/index/maildir/maildir-settings.c | 2 --
src/lib-storage/index/maildir/maildir-settings.h | 1 -
4 files changed, 5 insertions(+), 35 deletions(-)
diffs (105 lines):
diff -r 502d6048a281 -r 1b38bf29ac40 doc/example-config/conf.d/mail.conf
--- a/doc/example-config/conf.d/mail.conf Thu Feb 18 06:15:47 2010 +0200
+++ b/doc/example-config/conf.d/mail.conf Thu Feb 18 06:20:38 2010 +0200
@@ -235,14 +235,6 @@
# the performance much better, and it's unlikely to have any side effects.
#maildir_copy_with_hardlinks = yes
-# When copying a message, try to preserve the base filename. Only if the
-# destination mailbox already contains the same name (ie. the mail is being
-# copied there twice), a new name is given. The destination filename check is
-# done only by looking at dovecot-uidlist file, so if something outside
-# Dovecot does similar filename preserving copies, you may run into problems.
-# NOTE: This setting requires maildir_copy_with_hardlinks = yes to work.
-#maildir_copy_preserve_filename = no
-
# Assume Dovecot is the only MUA accessing Maildir: Scan cur/ directory only
# when its mtime changes unexpectedly or when we can't find the mail otherwise.
#maildir_very_dirty_syncs = no
diff -r 502d6048a281 -r 1b38bf29ac40 src/lib-storage/index/maildir/maildir-copy.c
--- a/src/lib-storage/index/maildir/maildir-copy.c Thu Feb 18 06:15:47 2010 +0200
+++ b/src/lib-storage/index/maildir/maildir-copy.c Thu Feb 18 06:20:38 2010 +0200
@@ -123,22 +123,6 @@
return 1;
}
-static const char *
-maildir_copy_get_preserved_fname(struct maildir_mailbox *src_mbox,
- uint32_t uid)
-{
- enum maildir_uidlist_rec_flag flags;
- const char *fname;
-
- if (maildir_uidlist_lookup(src_mbox->uidlist, uid, &flags,
- &fname) <= 0)
- return NULL;
-
- /* fname may be freed by a later uidlist sync. make sure it gets
- strduped. */
- return t_strcut(t_strdup(fname), ':');
-}
-
static int
maildir_copy_hardlink(struct mail_save_context *ctx, struct mail *mail)
{
@@ -146,7 +130,7 @@
(struct maildir_mailbox *)ctx->transaction->box;
struct maildir_mailbox *src_mbox;
struct hardlink_ctx do_ctx;
- const char *path, *filename = NULL;
+ const char *path, *guid;
if (strcmp(mail->box->storage->name, MAILDIR_STORAGE_NAME) == 0)
src_mbox = (struct maildir_mailbox *)mail->box;
@@ -161,17 +145,14 @@
memset(&do_ctx, 0, sizeof(do_ctx));
do_ctx.dest_path = str_new(default_pool, 512);
- if (dest_mbox->storage->set->maildir_copy_preserve_filename &&
- src_mbox != NULL) {
- filename = maildir_copy_get_preserved_fname(src_mbox,
- mail->uid);
- }
- if (filename == NULL) {
+ if (mail_get_special(mail, MAIL_FETCH_GUID, &guid) < 0)
+ guid = "";
+ if (*guid == '\0') {
/* the generated filename is _always_ unique, so we don't
bother trying to check if it already exists */
do_ctx.dest_fname = maildir_filename_generate();
} else {
- do_ctx.dest_fname = filename;
+ do_ctx.dest_fname = guid;
do_ctx.preserve_filename = TRUE;
}
diff -r 502d6048a281 -r 1b38bf29ac40 src/lib-storage/index/maildir/maildir-settings.c
--- a/src/lib-storage/index/maildir/maildir-settings.c Thu Feb 18 06:15:47 2010 +0200
+++ b/src/lib-storage/index/maildir/maildir-settings.c Thu Feb 18 06:20:38 2010 +0200
@@ -13,7 +13,6 @@
static const struct setting_define maildir_setting_defines[] = {
DEF(SET_BOOL, maildir_copy_with_hardlinks),
- DEF(SET_BOOL, maildir_copy_preserve_filename),
DEF(SET_BOOL, maildir_very_dirty_syncs),
SETTING_DEFINE_LIST_END
@@ -21,7 +20,6 @@
static const struct maildir_settings maildir_default_settings = {
.maildir_copy_with_hardlinks = TRUE,
- .maildir_copy_preserve_filename = FALSE,
.maildir_very_dirty_syncs = FALSE
};
diff -r 502d6048a281 -r 1b38bf29ac40 src/lib-storage/index/maildir/maildir-settings.h
--- a/src/lib-storage/index/maildir/maildir-settings.h Thu Feb 18 06:15:47 2010 +0200
+++ b/src/lib-storage/index/maildir/maildir-settings.h Thu Feb 18 06:20:38 2010 +0200
@@ -3,7 +3,6 @@
struct maildir_settings {
bool maildir_copy_with_hardlinks;
- bool maildir_copy_preserve_filename;
bool maildir_very_dirty_syncs;
};
More information about the dovecot-cvs
mailing list