Mercurial > dovecot > core-2.2
changeset 10742:1b38bf29ac40 HEAD
maildir: Always try to preserve message GUIDs when copying.
Because of this, maildir_copy_preserve_filename setting is now removed.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 18 Feb 2010 06:20:38 +0200 |
parents | 502d6048a281 |
children | 2c994f2f1ce6 |
files | doc/example-config/conf.d/mail.conf src/lib-storage/index/maildir/maildir-copy.c src/lib-storage/index/maildir/maildir-settings.c src/lib-storage/index/maildir/maildir-settings.h |
diffstat | 4 files changed, 5 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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; }
--- 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 };
--- 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; };