dovecot-2.2: maildir: Added maildir_empty_new setting to avoid k...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 16 14:05:57 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/d7b0f653d1ba
changeset: 17227:d7b0f653d1ba
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 16 16:05:12 2014 +0200
description:
maildir: Added maildir_empty_new setting to avoid keeping mails in new/ directory.
This is useful for example when using an external MDA that calls "doveadm
index" and the user hasn't opened the mailbox for a long time.
Also this removes the delay that user may see when opening a rarely accessed
mailbox, which renames a ton of files to cur/ while the user is waiting.
diffstat:
doc/example-config/conf.d/10-mail.conf | 4 ++++
src/lib-storage/index/maildir/maildir-settings.c | 4 +++-
src/lib-storage/index/maildir/maildir-settings.h | 1 +
src/lib-storage/index/maildir/maildir-sync.c | 6 +++---
4 files changed, 11 insertions(+), 4 deletions(-)
diffs (62 lines):
diff -r 3745f5c73224 -r d7b0f653d1ba doc/example-config/conf.d/10-mail.conf
--- a/doc/example-config/conf.d/10-mail.conf Wed Apr 16 15:44:46 2014 +0200
+++ b/doc/example-config/conf.d/10-mail.conf Wed Apr 16 16:05:12 2014 +0200
@@ -266,6 +266,10 @@
# broken size. The performance hit for enabling this is very small.
#maildir_broken_filename_sizes = no
+# Always move mails from new/ directory to cur/, even when the \Recent flags
+# aren't being reset.
+#maildir_empty_new = no
+
##
## mbox-specific settings
##
diff -r 3745f5c73224 -r d7b0f653d1ba src/lib-storage/index/maildir/maildir-settings.c
--- a/src/lib-storage/index/maildir/maildir-settings.c Wed Apr 16 15:44:46 2014 +0200
+++ b/src/lib-storage/index/maildir/maildir-settings.c Wed Apr 16 16:05:12 2014 +0200
@@ -15,6 +15,7 @@
DEF(SET_BOOL, maildir_copy_with_hardlinks),
DEF(SET_BOOL, maildir_very_dirty_syncs),
DEF(SET_BOOL, maildir_broken_filename_sizes),
+ DEF(SET_BOOL, maildir_empty_new),
SETTING_DEFINE_LIST_END
};
@@ -22,7 +23,8 @@
static const struct maildir_settings maildir_default_settings = {
.maildir_copy_with_hardlinks = TRUE,
.maildir_very_dirty_syncs = FALSE,
- .maildir_broken_filename_sizes = FALSE
+ .maildir_broken_filename_sizes = FALSE,
+ .maildir_empty_new = FALSE
};
static const struct setting_parser_info maildir_setting_parser_info = {
diff -r 3745f5c73224 -r d7b0f653d1ba src/lib-storage/index/maildir/maildir-settings.h
--- a/src/lib-storage/index/maildir/maildir-settings.h Wed Apr 16 15:44:46 2014 +0200
+++ b/src/lib-storage/index/maildir/maildir-settings.h Wed Apr 16 16:05:12 2014 +0200
@@ -5,6 +5,7 @@
bool maildir_copy_with_hardlinks;
bool maildir_very_dirty_syncs;
bool maildir_broken_filename_sizes;
+ bool maildir_empty_new;
};
const struct setting_parser_info *maildir_get_setting_parser_info(void);
diff -r 3745f5c73224 -r d7b0f653d1ba src/lib-storage/index/maildir/maildir-sync.c
--- a/src/lib-storage/index/maildir/maildir-sync.c Wed Apr 16 15:44:46 2014 +0200
+++ b/src/lib-storage/index/maildir/maildir-sync.c Wed Apr 16 16:05:12 2014 +0200
@@ -469,9 +469,9 @@
src = t_str_new(1024);
dest = t_str_new(1024);
- move_new = new_dir && !mailbox_is_readonly(&ctx->mbox->box) &&
- (ctx->mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) != 0 &&
- ctx->locked;
+ move_new = new_dir && ctx->locked &&
+ ((ctx->mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) != 0 ||
+ ctx->mbox->storage->set->maildir_empty_new);
errno = 0;
for (; (dp = readdir(dirp)) != NULL; errno = 0) {
More information about the dovecot-cvs
mailing list