From: Timo Sirainen Date: Sun, 28 Aug 2011 05:15:33 +0000 (+0300) Subject: lib-storage: Replaced MAILBOX_FLAG_KEEP_RECENT flag with reverse MAILBOX_FLAG_DROP_RE... X-Git-Tag: 2.1.alpha1~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4145cbac82bfc0c8bfeceeca0ef841700117930c;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Replaced MAILBOX_FLAG_KEEP_RECENT flag with reverse MAILBOX_FLAG_DROP_RECENT. Very few places actually want to drop recent flags, so this way is easier. --- diff --git a/src/doveadm/doveadm-mail-import.c b/src/doveadm/doveadm-mail-import.c index c83d69ac90..64205eb2ea 100644 --- a/src/doveadm/doveadm-mail-import.c +++ b/src/doveadm/doveadm-mail-import.c @@ -44,8 +44,7 @@ dest_mailbox_open_or_create(struct import_cmd_context *ctx, return -1; } - box = mailbox_alloc(ns->list, name, MAILBOX_FLAG_SAVEONLY | - MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(ns->list, name, MAILBOX_FLAG_SAVEONLY); if (mailbox_create(box, NULL, FALSE) < 0) { errstr = mailbox_get_last_error(box, &error); if (error != MAIL_ERROR_EXISTS) { diff --git a/src/doveadm/doveadm-mail-index.c b/src/doveadm/doveadm-mail-index.c index 35788b767b..6daaf2be16 100644 --- a/src/doveadm/doveadm-mail-index.c +++ b/src/doveadm/doveadm-mail-index.c @@ -31,7 +31,6 @@ cmd_index_box(struct index_cmd_context *ctx, const struct mailbox_info *info) int ret = 0; box = mailbox_alloc(info->ns->list, info->name, - MAILBOX_FLAG_KEEP_RECENT | MAILBOX_FLAG_IGNORE_ACLS); if (ctx->max_recent_msgs != 0) { /* index only if there aren't too many recent messages. diff --git a/src/doveadm/doveadm-mail-iter.c b/src/doveadm/doveadm-mail-iter.c index 4cb3811777..d50872741c 100644 --- a/src/doveadm/doveadm-mail-iter.c +++ b/src/doveadm/doveadm-mail-iter.c @@ -26,7 +26,6 @@ int doveadm_mail_iter_init(const struct mailbox_info *info, iter = i_new(struct doveadm_mail_iter, 1); iter->box = mailbox_alloc(info->ns->list, info->name, - MAILBOX_FLAG_KEEP_RECENT | MAILBOX_FLAG_IGNORE_ACLS); iter->search_args = search_args; diff --git a/src/doveadm/doveadm-mail-move.c b/src/doveadm/doveadm-mail-move.c index 6806029fe9..e2c4e295f7 100644 --- a/src/doveadm/doveadm-mail-move.c +++ b/src/doveadm/doveadm-mail-move.c @@ -82,9 +82,7 @@ cmd_move_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user) if (ns == NULL) i_fatal("Can't find namespace for: %s", ctx->destname); - destbox = mailbox_alloc(ns->list, ctx->destname, - MAILBOX_FLAG_SAVEONLY | - MAILBOX_FLAG_KEEP_RECENT); + destbox = mailbox_alloc(ns->list, ctx->destname, MAILBOX_FLAG_SAVEONLY); storage = mailbox_get_storage(destbox); if (mailbox_open(destbox) < 0) { i_error("Can't open mailbox '%s': %s", ctx->destname, diff --git a/src/doveadm/doveadm-mail.c b/src/doveadm/doveadm-mail.c index 2de28dd620..00b8c15359 100644 --- a/src/doveadm/doveadm-mail.c +++ b/src/doveadm/doveadm-mail.c @@ -83,8 +83,7 @@ doveadm_mailbox_find(struct mail_user *user, const char *mailbox) if (ns == NULL) i_fatal("Can't find namespace for mailbox %s", mailbox); - return mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_KEEP_RECENT | - MAILBOX_FLAG_IGNORE_ACLS); + return mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_IGNORE_ACLS); } static int diff --git a/src/dsync/dsync-worker-local.c b/src/dsync/dsync-worker-local.c index 1a0079fe1e..bc431dfb4b 100644 --- a/src/dsync/dsync-worker-local.c +++ b/src/dsync/dsync-worker-local.c @@ -513,8 +513,7 @@ local_worker_mailbox_iter_next(struct dsync_worker_mailbox_iter *_iter, (struct local_dsync_worker_mailbox_iter *)_iter; struct local_dsync_worker *worker = (struct local_dsync_worker *)_iter->worker; - const enum mailbox_flags flags = - MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT; + const enum mailbox_flags flags = MAILBOX_FLAG_READONLY; const enum mailbox_status_items status_items = STATUS_UIDNEXT | STATUS_UIDVALIDITY | STATUS_HIGHESTMODSEQ | STATUS_FIRST_RECENT_UID; @@ -760,7 +759,6 @@ static int local_mailbox_open(struct local_dsync_worker *worker, const mailbox_guid_t *guid, struct mailbox **box_r) { - enum mailbox_flags flags = MAILBOX_FLAG_KEEP_RECENT; struct local_dsync_mailbox *lbox; struct mailbox *box; struct mailbox_metadata metadata; @@ -776,7 +774,7 @@ static int local_mailbox_open(struct local_dsync_worker *worker, return 0; } - box = mailbox_alloc(lbox->ns->list, lbox->name, flags); + box = mailbox_alloc(lbox->ns->list, lbox->name, 0); if (mailbox_sync(box, 0) < 0 || mailbox_get_metadata(box, MAILBOX_METADATA_GUID, &metadata) < 0) { i_error("Failed to sync mailbox %s: %s", lbox->name, diff --git a/src/imap/cmd-select.c b/src/imap/cmd-select.c index aee4bb7534..27f41b1025 100644 --- a/src/imap/cmd-select.c +++ b/src/imap/cmd-select.c @@ -279,7 +279,9 @@ select_open(struct imap_select_context *ctx, const char *mailbox, bool readonly) int ret = 0; if (readonly) - flags |= MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT; + flags |= MAILBOX_FLAG_READONLY; + else + flags |= MAILBOX_FLAG_DROP_RECENT; ctx->box = mailbox_alloc(ctx->ns->list, mailbox, flags); if (mailbox_open(ctx->box) < 0) { client_send_storage_error(ctx->cmd, diff --git a/src/imap/imap-commands-util.c b/src/imap/imap-commands-util.c index 3f4c2a0198..6e8c0b248e 100644 --- a/src/imap/imap-commands-util.c +++ b/src/imap/imap-commands-util.c @@ -76,8 +76,7 @@ int client_open_save_dest_box(struct client_command_context *cmd, *destbox_r = cmd->client->mailbox; return 0; } - box = mailbox_alloc(ns->list, name, - MAILBOX_FLAG_SAVEONLY | MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(ns->list, name, MAILBOX_FLAG_SAVEONLY); if (mailbox_open(box) < 0) { error_string = mailbox_get_last_error(box, &error); if (error == MAIL_ERROR_NOTFOUND) { diff --git a/src/imap/imap-status.c b/src/imap/imap-status.c index 42751d264c..216e4dc083 100644 --- a/src/imap/imap-status.c +++ b/src/imap/imap-status.c @@ -73,9 +73,7 @@ int imap_status_get(struct client_command_context *cmd, box = client->mailbox; } else { /* open the mailbox */ - box = mailbox_alloc(ns->list, mailbox, - MAILBOX_FLAG_READONLY | - MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_READONLY); if (client->enabled_features != 0) (void)mailbox_enable(box, client->enabled_features); } diff --git a/src/indexer/master-connection.c b/src/indexer/master-connection.c index d8d24cc014..b3b0349b1b 100644 --- a/src/indexer/master-connection.c +++ b/src/indexer/master-connection.c @@ -63,7 +63,7 @@ static int index_mailbox(struct mail_user *user, const char *mailbox, /* FIXME: the current lib-storage API doesn't allow sending "n% competed" notifications */ - box = mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(ns->list, mailbox, 0); if (max_recent_msgs != 0) { /* index only if there aren't too many recent messages. don't bother syncing the mailbox, that alone can take a diff --git a/src/lib-lda/mail-deliver.c b/src/lib-lda/mail-deliver.c index 28f6a51f03..ec973bce42 100644 --- a/src/lib-lda/mail-deliver.c +++ b/src/lib-lda/mail-deliver.c @@ -145,8 +145,7 @@ int mail_deliver_save_open(struct mail_deliver_save_open_context *ctx, struct mail_namespace *ns; struct mailbox *box; enum mailbox_flags flags = - MAILBOX_FLAG_KEEP_RECENT | MAILBOX_FLAG_SAVEONLY | - MAILBOX_FLAG_POST_SESSION; + MAILBOX_FLAG_SAVEONLY | MAILBOX_FLAG_POST_SESSION; *box_r = NULL; *error_r = MAIL_ERROR_NONE; diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c index bc9975abed..649f98409f 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c @@ -479,7 +479,6 @@ rebuild_mailbox(struct mdbox_storage_rebuild_context *ctx, int ret; box = mailbox_alloc(ns->list, vname, MAILBOX_FLAG_READONLY | - MAILBOX_FLAG_KEEP_RECENT | MAILBOX_FLAG_IGNORE_ACLS); i_assert(box->storage == &ctx->storage->storage.storage); if (mailbox_open(box) < 0) { @@ -622,7 +621,6 @@ static int rebuild_restore_msg(struct mdbox_storage_rebuild_context *ctx, while (box == NULL) { box = mailbox_alloc(ctx->default_list, mailbox, MAILBOX_FLAG_READONLY | - MAILBOX_FLAG_KEEP_RECENT | MAILBOX_FLAG_IGNORE_ACLS); i_assert(box->storage == storage); if (mailbox_open(box) == 0) diff --git a/src/lib-storage/index/index-sync.c b/src/lib-storage/index/index-sync.c index 2bb2703fb0..230910285d 100644 --- a/src/lib-storage/index/index-sync.c +++ b/src/lib-storage/index/index-sync.c @@ -26,7 +26,7 @@ enum mail_index_sync_flags index_storage_get_sync_flags(struct mailbox *box) { enum mail_index_sync_flags sync_flags = 0; - if ((box->flags & MAILBOX_FLAG_KEEP_RECENT) == 0) + if ((box->flags & MAILBOX_FLAG_DROP_RECENT) != 0) sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT; if (box->deleting) sync_flags |= MAIL_INDEX_SYNC_FLAG_DELETING_INDEX; @@ -507,7 +507,7 @@ int index_mailbox_sync_deinit(struct mailbox_sync_context *_ctx, } index_mailbox_expunge_unseen_recent(ctx); - if ((_ctx->box->flags & MAILBOX_FLAG_KEEP_RECENT) != 0 && + if ((_ctx->box->flags & MAILBOX_FLAG_DROP_RECENT) == 0 && _ctx->box->opened) { /* mailbox syncing didn't necessarily update our recent state */ index_sync_update_recent_count(_ctx->box); diff --git a/src/lib-storage/index/maildir/maildir-save.c b/src/lib-storage/index/maildir/maildir-save.c index 5b746e9736..6f85c7b0aa 100644 --- a/src/lib-storage/index/maildir/maildir-save.c +++ b/src/lib-storage/index/maildir/maildir-save.c @@ -741,7 +741,7 @@ maildir_save_sync_index(struct maildir_save_context *ctx) next_uid = maildir_save_set_recent_flags(ctx); } T_END; - if ((mbox->box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0) + if ((mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) != 0) first_recent_uid = next_uid; else if (ctx->last_nonrecent_uid != 0) first_recent_uid = ctx->last_nonrecent_uid + 1; diff --git a/src/lib-storage/index/maildir/maildir-sync.c b/src/lib-storage/index/maildir/maildir-sync.c index 8080f23b29..1eb756c5d0 100644 --- a/src/lib-storage/index/maildir/maildir-sync.c +++ b/src/lib-storage/index/maildir/maildir-sync.c @@ -420,7 +420,7 @@ maildir_scan_dir(struct maildir_sync_context *ctx, bool new_dir, bool final) dest = t_str_new(1024); move_new = new_dir && !mailbox_is_readonly(&ctx->mbox->box) && - (ctx->mbox->box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0 && + (ctx->mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) != 0 && ctx->locked; errno = 0; @@ -691,7 +691,7 @@ static int maildir_sync_get_changes(struct maildir_sync_context *ctx, /* if there are files in new/, we'll need to move them. we'll check this by seeing if we have any recent messages */ - if ((mbox->box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0) { + if ((mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) != 0) { if (!*new_changed_r) *new_changed_r = have_recent_messages(ctx, FALSE); } else if (*new_changed_r) { @@ -705,7 +705,7 @@ static int maildir_sync_get_changes(struct maildir_sync_context *ctx, if (*new_changed_r || *cur_changed_r) return 1; - if ((mbox->box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0) + if ((mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) != 0) flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT; if (mbox->synced) { diff --git a/src/lib-storage/index/mbox/mbox-file.c b/src/lib-storage/index/mbox/mbox-file.c index 0e43ed8360..2fad8e2958 100644 --- a/src/lib-storage/index/mbox/mbox-file.c +++ b/src/lib-storage/index/mbox/mbox-file.c @@ -103,7 +103,7 @@ static void mbox_file_fix_atime(struct mbox_mailbox *mbox) struct stat st; if (ibox->recent_flags_count > 0 && - (mbox->box.flags & MAILBOX_FLAG_KEEP_RECENT) != 0 && + (mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) == 0 && mbox->mbox_fd != -1 && !mbox_is_backend_readonly(mbox)) { /* we've seen recent messages which we want to keep recent. keep file's atime lower than mtime so \Marked status diff --git a/src/lib-storage/index/mbox/mbox-sync.c b/src/lib-storage/index/mbox/mbox-sync.c index 58978efc03..46cca197d7 100644 --- a/src/lib-storage/index/mbox/mbox-sync.c +++ b/src/lib-storage/index/mbox/mbox-sync.c @@ -1827,7 +1827,7 @@ again: return ret; } - if ((mbox->box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0) { + if ((mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) != 0) { /* see if we need to drop recent flags */ sync_ctx.hdr = mail_index_get_header(sync_view); if (sync_ctx.hdr->first_recent_uid < sync_ctx.hdr->next_uid) @@ -1849,7 +1849,7 @@ again: memset(&sync_ctx, 0, sizeof(sync_ctx)); sync_ctx.mbox = mbox; sync_ctx.keep_recent = - (mbox->box.flags & MAILBOX_FLAG_KEEP_RECENT) != 0; + (mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) == 0; sync_ctx.hdr = mail_index_get_header(sync_view); sync_ctx.from_line = str_new(default_pool, 256); diff --git a/src/lib-storage/list/index-mailbox-list.c b/src/lib-storage/list/index-mailbox-list.c index 770741f700..b62b5362e4 100644 --- a/src/lib-storage/list/index-mailbox-list.c +++ b/src/lib-storage/list/index-mailbox-list.c @@ -603,8 +603,7 @@ index_mailbox_list_update_info(struct index_mailbox_list_iterate_context *ctx) &ctx->info.flags); } - box = mailbox_alloc(ctx->ctx.list, ctx->info.name, - MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(ctx->ctx.list, ctx->info.name, 0); index_mailbox_list_status_set_info_flags(box, node->uid, &ctx->info.flags); mailbox_free(&box); diff --git a/src/lib-storage/list/mailbox-list-fs-iter.c b/src/lib-storage/list/mailbox-list-fs-iter.c index ea4087f88f..a96ce211dd 100644 --- a/src/lib-storage/list/mailbox-list-fs-iter.c +++ b/src/lib-storage/list/mailbox-list-fs-iter.c @@ -566,8 +566,7 @@ list_file(struct fs_list_iterate_context *ctx, bool auto_boxes = (ctx->ctx.flags & MAILBOX_LIST_ITER_NO_AUTO_BOXES) == 0; - box = mailbox_alloc(ctx->ctx.list, list_path, - MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(ctx->ctx.list, list_path, 0); ret = mailbox_exists(box, auto_boxes, &existence); mailbox_free(&box); diff --git a/src/lib-storage/mail-storage.h b/src/lib-storage/mail-storage.h index 51e3b92f7b..70826ef5af 100644 --- a/src/lib-storage/mail-storage.h +++ b/src/lib-storage/mail-storage.h @@ -32,8 +32,8 @@ enum mailbox_flags { MAILBOX_FLAG_READONLY = 0x01, /* Only saving/copying mails to mailbox works. */ MAILBOX_FLAG_SAVEONLY = 0x02, - /* Don't reset MAIL_RECENT flags when syncing */ - MAILBOX_FLAG_KEEP_RECENT = 0x08, + /* Remove MAIL_RECENT flags when syncing */ + MAILBOX_FLAG_DROP_RECENT = 0x04, /* Don't create index files for the mailbox */ MAILBOX_FLAG_NO_INDEX_FILES = 0x10, /* Keep mailbox exclusively locked all the time while it's open */ diff --git a/src/lib-storage/mailbox-guid-cache.c b/src/lib-storage/mailbox-guid-cache.c index 375b2734fe..171232f338 100644 --- a/src/lib-storage/mailbox-guid-cache.c +++ b/src/lib-storage/mailbox-guid-cache.c @@ -62,7 +62,7 @@ void mailbox_guid_cache_refresh(struct mailbox_list *list) (MAILBOX_NOSELECT | MAILBOX_NONEXISTENT)) != 0) continue; - box = mailbox_alloc(list, info->name, MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(list, info->name, 0); if (mailbox_get_metadata(box, MAILBOX_METADATA_GUID, &metadata) < 0) { i_error("Couldn't get mailbox %s GUID: %s", diff --git a/src/lib-storage/mailbox-list.c b/src/lib-storage/mailbox-list.c index a3c0c3cbd5..fa6f2d1c90 100644 --- a/src/lib-storage/mailbox-list.c +++ b/src/lib-storage/mailbox-list.c @@ -1296,7 +1296,7 @@ int mailbox_list_mailbox(struct mailbox_list *list, const char *name, enum mailbox_existence existence; int ret; - box = mailbox_alloc(list, "INBOX", MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(list, "INBOX", 0); ret = mailbox_exists(box, FALSE, &existence); mailbox_free(&box); if (ret < 0) { diff --git a/src/plugins/acl/doveadm-acl.c b/src/plugins/acl/doveadm-acl.c index 63c7160bdf..16af312196 100644 --- a/src/plugins/acl/doveadm-acl.c +++ b/src/plugins/acl/doveadm-acl.c @@ -39,8 +39,7 @@ cmd_acl_mailbox_open(struct mail_user *user, const char *mailbox, return -1; } box = mailbox_alloc(ns->list, mailbox, - MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT | - MAILBOX_FLAG_IGNORE_ACLS); + MAILBOX_FLAG_READONLY | MAILBOX_FLAG_IGNORE_ACLS); if (mailbox_open(box) < 0) { i_error("Can't open mailbox %s: %s", mailbox, mailbox_get_last_error(box, NULL)); @@ -367,8 +366,7 @@ cmd_acl_debug_mailbox_open(struct mail_user *user, const char *mailbox, return -1; } box = mailbox_alloc(ns->list, mailbox, - MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT | - MAILBOX_FLAG_IGNORE_ACLS); + MAILBOX_FLAG_READONLY | MAILBOX_FLAG_IGNORE_ACLS); if (mailbox_open(box) < 0) { path = mailbox_list_get_path(ns->list, box->name, MAILBOX_LIST_PATH_TYPE_MAILBOX); diff --git a/src/plugins/fts-lucene/lucene-wrapper.cc b/src/plugins/fts-lucene/lucene-wrapper.cc index 597fd909dd..e0b1895e87 100644 --- a/src/plugins/fts-lucene/lucene-wrapper.cc +++ b/src/plugins/fts-lucene/lucene-wrapper.cc @@ -618,8 +618,8 @@ rescan_open_mailbox(struct rescan_context *ctx, Document *doc) if (ctx->box != NULL) rescan_finish(ctx); - ctx->box = mailbox_alloc_guid(ctx->index->list, - guid, MAILBOX_FLAG_KEEP_RECENT); + ctx->box = mailbox_alloc_guid(ctx->index->list, guid, + (enum mailbox_flags)0); if (mailbox_open(ctx->box) < 0) { enum mail_error error; const char *errstr; @@ -712,7 +712,7 @@ static void rescan_clear_unseen_mailboxes(struct lucene_index *index, iter = mailbox_list_iter_init(index->list, "*", iter_flags); while ((info = mailbox_list_iter_next(iter)) != NULL) { box = mailbox_alloc(index->list, info->name, - MAILBOX_FLAG_KEEP_RECENT); + (enum mailbox_flags)0); if (mailbox_get_metadata(box, MAILBOX_METADATA_GUID, &metadata) == 0 && (guids == NULL || diff --git a/src/plugins/fts/fts-api.c b/src/plugins/fts/fts-api.c index d998782179..24149eff0a 100644 --- a/src/plugins/fts/fts-api.c +++ b/src/plugins/fts/fts-api.c @@ -376,7 +376,7 @@ int fts_index_have_compatible_settings(struct mailbox_list *list, struct fts_index_header hdr; int ret; - box = mailbox_alloc(list, "INBOX", MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(list, "INBOX", 0); if (mailbox_sync(box, (enum mailbox_sync_flags)0) < 0) { i_error("lucene: Failed to sync mailbox INBOX: %s", mailbox_get_last_error(box, NULL)); diff --git a/src/plugins/imap-acl/imap-acl-plugin.c b/src/plugins/imap-acl/imap-acl-plugin.c index b1cb649027..b4c416bacf 100644 --- a/src/plugins/imap-acl/imap-acl-plugin.c +++ b/src/plugins/imap-acl/imap-acl-plugin.c @@ -17,9 +17,6 @@ #define ERROR_NOT_ADMIN "["IMAP_RESP_CODE_NOPERM"] " \ "You lack administrator privileges on this mailbox." -#define ACL_MAILBOX_FLAGS \ - (MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT) - #define IMAP_ACL_ANYONE "anyone" #define IMAP_ACL_AUTHENTICATED "authenticated" #define IMAP_ACL_OWNER "owner" @@ -70,7 +67,7 @@ acl_mailbox_open_as_admin(struct client_command_context *cmd, const char *name) /* Force opening the mailbox so that we can give a nicer error message if mailbox isn't selectable but is listable. */ - box = mailbox_alloc(ns->list, name, ACL_MAILBOX_FLAGS | + box = mailbox_alloc(ns->list, name, MAILBOX_FLAG_READONLY | MAILBOX_FLAG_IGNORE_ACLS); ret = acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_ADMIN); if (ret > 0) @@ -324,7 +321,7 @@ static bool cmd_myrights(struct client_command_context *cmd) return TRUE; box = mailbox_alloc(ns->list, mailbox, - ACL_MAILBOX_FLAGS | MAILBOX_FLAG_IGNORE_ACLS); + MAILBOX_FLAG_READONLY | MAILBOX_FLAG_IGNORE_ACLS); if (acl_object_get_my_rights(acl_mailbox_get_aclobj(box), pool_datastack_create(), &rights) < 0) { client_send_tagline(cmd, "NO "MAIL_ERRSTR_CRITICAL_MSG); diff --git a/src/plugins/imap-quota/imap-quota-plugin.c b/src/plugins/imap-quota/imap-quota-plugin.c index 8e8e3fbf6e..9d5f50d4f0 100644 --- a/src/plugins/imap-quota/imap-quota-plugin.c +++ b/src/plugins/imap-quota/imap-quota-plugin.c @@ -95,8 +95,7 @@ static bool cmd_getquotaroot(struct client_command_context *cmd) return TRUE; } - box = mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_READONLY | - MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_READONLY); /* build QUOTAROOT reply and QUOTA reply for all quota roots */ quotaroot_reply = t_str_new(128); diff --git a/src/plugins/lazy-expunge/lazy-expunge-plugin.c b/src/plugins/lazy-expunge/lazy-expunge-plugin.c index 3d46a71c52..4f470c210d 100644 --- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c +++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c @@ -90,8 +90,7 @@ mailbox_open_or_create(struct mailbox_list *list, struct mailbox *src_box, /* add expunge namespace prefix */ name = t_strconcat(list->ns->prefix, name, NULL); - box = mailbox_alloc(list, name, MAILBOX_FLAG_KEEP_RECENT | - MAILBOX_FLAG_NO_INDEX_FILES); + box = mailbox_alloc(list, name, MAILBOX_FLAG_NO_INDEX_FILES); if (mailbox_open(box) == 0) { *error_r = NULL; return box; diff --git a/src/plugins/quota/quota-count.c b/src/plugins/quota/quota-count.c index e6094e34b0..4498330998 100644 --- a/src/plugins/quota/quota-count.c +++ b/src/plugins/quota/quota-count.c @@ -27,8 +27,7 @@ quota_count_mailbox(struct quota_root *root, struct mail_namespace *ns, return 0; } - box = mailbox_alloc(ns->list, vname, - MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT); + box = mailbox_alloc(ns->list, vname, MAILBOX_FLAG_READONLY); if (mailbox_sync(box, MAILBOX_SYNC_FLAG_FULL_READ) < 0) { error = mailbox_get_last_mail_error(box); mailbox_free(&box); diff --git a/src/plugins/snarf/snarf-plugin.c b/src/plugins/snarf/snarf-plugin.c index 9847a122fa..ee5eef771b 100644 --- a/src/plugins/snarf/snarf-plugin.c +++ b/src/plugins/snarf/snarf-plugin.c @@ -160,8 +160,7 @@ static void snarf_mailbox_allocated(struct mailbox *box) sbox->module_ctx.super = *v; box->vlast = &sbox->module_ctx.super; - sbox->snarf_box = mailbox_alloc(snarf_list, snarf_name, - MAILBOX_FLAG_KEEP_RECENT); + sbox->snarf_box = mailbox_alloc(snarf_list, snarf_name, 0); v->sync_init = snarf_sync_init; v->free = snarf_mailbox_free; diff --git a/src/plugins/trash/trash-plugin.c b/src/plugins/trash/trash-plugin.c index 5de06196bc..a44dee0141 100644 --- a/src/plugins/trash/trash-plugin.c +++ b/src/plugins/trash/trash-plugin.c @@ -51,8 +51,7 @@ static int trash_clean_mailbox_open(struct trash_mailbox *trash) { struct mail_search_args *search_args; - trash->box = mailbox_alloc(trash->ns->list, trash->name, - MAILBOX_FLAG_KEEP_RECENT); + trash->box = mailbox_alloc(trash->ns->list, trash->name, 0); if (mailbox_open(trash->box) < 0) { mailbox_free(&trash->box); return 0; diff --git a/src/plugins/virtual/virtual-storage.c b/src/plugins/virtual/virtual-storage.c index 6cf3c8cdfc..d060bc1c93 100644 --- a/src/plugins/virtual/virtual-storage.c +++ b/src/plugins/virtual/virtual-storage.c @@ -165,8 +165,8 @@ static int virtual_backend_box_open(struct virtual_mailbox *mbox, i_assert(bbox->box == NULL); - if (!bbox->clear_recent) - flags |= MAILBOX_FLAG_KEEP_RECENT; + if (bbox->clear_recent) + flags |= MAILBOX_FLAG_DROP_RECENT; mailbox = bbox->name; ns = mail_namespace_find(user->namespaces, mailbox); diff --git a/src/plugins/virtual/virtual-sync.c b/src/plugins/virtual/virtual-sync.c index e53c7b7995..3abc3afcc9 100644 --- a/src/plugins/virtual/virtual-sync.c +++ b/src/plugins/virtual/virtual-sync.c @@ -1472,7 +1472,7 @@ static int virtual_sync(struct virtual_mailbox *mbox, index_sync_flags = MAIL_INDEX_SYNC_FLAG_FLUSH_DIRTY | MAIL_INDEX_SYNC_FLAG_AVOID_FLAG_UPDATES; - if ((mbox->box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0) + if ((mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) != 0) index_sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT; ret = mail_index_sync_begin(ctx->index, &ctx->index_sync_ctx, diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index c4d6d54029..dc2cf6ac0b 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -318,8 +318,8 @@ struct client *client_create(int fd_in, int fd_out, struct mail_user *user, client->inbox_ns = ns; flags = MAILBOX_FLAG_POP3_SESSION; - if (set->pop3_no_flag_updates) - flags |= MAILBOX_FLAG_KEEP_RECENT; + if (!set->pop3_no_flag_updates) + flags |= MAILBOX_FLAG_DROP_RECENT; if (set->pop3_lock_session) flags |= MAILBOX_FLAG_KEEP_LOCKED; client->mailbox = mailbox_alloc(ns->list, "INBOX", flags);