Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2039:f0925b2271e1 HEAD
Added pop3_mails_keep_recent option. Fixed recent assert crash.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 23 May 2004 01:36:46 +0300 |
parents | df504dad3aec |
children | 6920ebecb853 |
files | dovecot-example.conf src/lib-storage/index/index-storage.c src/lib-storage/index/index-storage.h src/lib-storage/index/maildir/maildir-sync.c src/lib-storage/index/maildir/maildir-uidlist.c src/lib-storage/mail-storage.h src/master/mail-process.c src/master/master-settings.c src/master/master-settings.h src/pop3/client.c |
diffstat | 10 files changed, 29 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/dovecot-example.conf Sun May 23 01:23:29 2004 +0300 +++ b/dovecot-example.conf Sun May 23 01:36:46 2004 +0300 @@ -355,6 +355,11 @@ # POP3 executable location #mail_executable = /usr/libexec/dovecot/pop3 + # Don't try to set mails non-recent with POP3 sessions. This is mostly + # intended to reduce disk I/O. With maildir it doesn't move files from + # new/ to cur/, with mbox it doesn't write Status-header. + #pop3_mails_keep_recent = no + # Support for dynamically loadable modules. #mail_use_modules = no #mail_modules = /usr/lib/dovecot/pop3
--- a/src/lib-storage/index/index-storage.c Sun May 23 01:23:29 2004 +0300 +++ b/src/lib-storage/index/index-storage.c Sun May 23 01:36:46 2004 +0300 @@ -330,6 +330,7 @@ ibox->box.storage = &storage->storage; ibox->box.name = i_strdup(name); ibox->readonly = (flags & MAILBOX_OPEN_READONLY) != 0; + ibox->keep_recent = (flags & MAILBOX_OPEN_KEEP_RECENT) != 0; ibox->index = index;
--- a/src/lib-storage/index/index-storage.h Sun May 23 01:23:29 2004 +0300 +++ b/src/lib-storage/index/index-storage.h Sun May 23 01:36:46 2004 +0300 @@ -99,6 +99,7 @@ unsigned int private_flags_mask; unsigned int readonly:1; + unsigned int keep_recent:1; unsigned int sent_diskspace_warning:1; unsigned int sent_readonly_flags_warning:1; unsigned int autosync_pending:1;
--- a/src/lib-storage/index/maildir/maildir-sync.c Sun May 23 01:23:29 2004 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync.c Sun May 23 01:36:46 2004 +0300 @@ -434,7 +434,8 @@ return -1; } - move_new = new_dir && !mailbox_is_readonly(&ctx->ibox->box); + move_new = new_dir && !mailbox_is_readonly(&ctx->ibox->box) && + !ctx->ibox->keep_recent; while ((dp = readdir(dirp)) != NULL) { if (dp->d_name[0] == '.') continue;
--- a/src/lib-storage/index/maildir/maildir-uidlist.c Sun May 23 01:23:29 2004 +0300 +++ b/src/lib-storage/index/maildir/maildir-uidlist.c Sun May 23 01:36:46 2004 +0300 @@ -145,9 +145,9 @@ static void maildir_uidlist_mark_recent(struct maildir_uidlist *uidlist, uint32_t uid) { - if (uidlist->first_recent_uid == 0) + if (uidlist->first_recent_uid == 0 || + uid < uidlist->first_recent_uid) uidlist->first_recent_uid = uid; - i_assert(uid >= uidlist->first_recent_uid); } static int maildir_uidlist_next(struct maildir_uidlist *uidlist,
--- a/src/lib-storage/mail-storage.h Sun May 23 01:23:29 2004 +0300 +++ b/src/lib-storage/mail-storage.h Sun May 23 01:36:46 2004 +0300 @@ -7,7 +7,8 @@ enum mailbox_open_flags { MAILBOX_OPEN_READONLY = 0x01, - MAILBOX_OPEN_FAST = 0x02 + MAILBOX_OPEN_FAST = 0x02, + MAILBOX_OPEN_KEEP_RECENT = 0x04 }; enum mailbox_list_flags {
--- a/src/master/mail-process.c Sun May 23 01:23:29 2004 +0300 +++ b/src/master/mail-process.c Sun May 23 01:36:46 2004 +0300 @@ -284,6 +284,8 @@ env_put("MAILDIR_CHECK_CONTENT_CHANGES=1"); if (set->mail_full_filesystem_access) env_put("FULL_FILESYSTEM_ACCESS=1"); + if (set->pop3_mails_keep_recent) + env_put("POP3_MAILS_KEEP_RECENT=1"); (void)umask(set->umask); env_put(t_strconcat("MBOX_LOCKS=", set->mbox_locks, NULL));
--- a/src/master/master-settings.c Sun May 23 01:23:29 2004 +0300 +++ b/src/master/master-settings.c Sun May 23 01:36:46 2004 +0300 @@ -111,6 +111,9 @@ DEF(SET_INT, imap_max_line_length), DEF(SET_STR, imap_capability), + /* pop3 */ + DEF(SET_BOOL, pop3_mails_keep_recent), + { 0, NULL, 0 } }; @@ -240,6 +243,9 @@ MEMBER(imap_max_line_length) 65536, MEMBER(imap_capability) NULL, + /* pop3 */ + MEMBER(pop3_mails_keep_recent) FALSE, + /* .. */ MEMBER(login_uid) 0, MEMBER(listen_fd) -1,
--- a/src/master/master-settings.h Sun May 23 01:23:29 2004 +0300 +++ b/src/master/master-settings.h Sun May 23 01:36:46 2004 +0300 @@ -86,6 +86,9 @@ unsigned int imap_max_line_length; const char *imap_capability; + /* pop3 */ + int pop3_mails_keep_recent; + /* .. */ uid_t login_uid;
--- a/src/pop3/client.c Sun May 23 01:23:29 2004 +0300 +++ b/src/pop3/client.c Sun May 23 01:36:46 2004 +0300 @@ -118,6 +118,7 @@ struct client *client_create(int hin, int hout, struct mail_storage *storage) { struct client *client; + enum mailbox_open_flags flags; client = i_new(struct client, 1); client->input = i_stream_create_file(hin, default_pool, @@ -134,7 +135,10 @@ mail_storage_set_callbacks(storage, &mail_storage_callbacks, client); - client->mailbox = mailbox_open(storage, "INBOX", 0); + flags = 0; + if (getenv("POP3_MAILS_KEEP_RECENT") != NULL) + flags |= MAILBOX_OPEN_KEEP_RECENT; + client->mailbox = mailbox_open(storage, "INBOX", flags); if (client->mailbox == NULL) { client_send_line(client, "-ERR No INBOX for user."); client_destroy(client);