Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4126:63d6890803b3 HEAD
If mailbox is opened in non-readonly state and there are mails in new/, make
sure they get moved to cur/ so that their recent-state gets removed.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 02 Apr 2006 19:32:51 +0300 |
parents | 5071c561c455 |
children | 60583fb75d9e |
files | src/lib-storage/index/maildir/maildir-sync.c |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-sync.c Sun Apr 02 13:49:53 2006 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync.c Sun Apr 02 19:32:51 2006 +0300 @@ -759,6 +759,7 @@ const char *new_dir, const char *cur_dir, bool *new_changed_r, bool *cur_changed_r) { + struct index_mailbox *ibox = &mbox->ibox; struct stat st; time_t new_mtime, cur_mtime; @@ -787,16 +788,20 @@ if ((mbox->dirty_cur_time == 0 && cur_mtime != mbox->last_cur_mtime) || (new_mtime != mbox->last_new_mtime)) { /* check if the index has been updated.. */ - if (mail_index_refresh(mbox->ibox.index) < 0) { - mail_storage_set_index_error(&mbox->ibox); + if (mail_index_refresh(ibox->index) < 0) { + mail_storage_set_index_error(ibox); return -1; } maildir_sync_update_from_header(mbox); } + /* If we're removing recent flags, always sync new/ directory if + it has mails. */ if (new_mtime != mbox->last_new_mtime || - new_mtime >= mbox->last_new_sync_time - MAILDIR_SYNC_SECS) { + new_mtime >= mbox->last_new_sync_time - MAILDIR_SYNC_SECS || + (!ibox->keep_recent && + mail_index_get_header(ibox->view)->recent_messages_count > 0)) { *new_changed_r = TRUE; mbox->last_new_mtime = new_mtime; mbox->last_new_sync_time = ioloop_time;