# 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
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;
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;
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;
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,
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 {
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));
DEF(SET_INT, imap_max_line_length),
DEF(SET_STR, imap_capability),
+ /* pop3 */
+ DEF(SET_BOOL, pop3_mails_keep_recent),
+
{ 0, NULL, 0 }
};
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,
unsigned int imap_max_line_length;
const char *imap_capability;
+ /* pop3 */
+ int pop3_mails_keep_recent;
+
/* .. */
uid_t login_uid;
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,
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);