ctx->mbox = mbox;
sync_flags = MAIL_INDEX_SYNC_FLAG_FLUSH_DIRTY;
- if (!mbox->ibox.keep_recent)
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0)
sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
if (!force)
sync_flags |= MAIL_INDEX_SYNC_FLAG_REQUIRE_CHANGES;
ctx->mbox = mbox;
ctx->flags = flags;
- if (!mbox->ibox.keep_recent)
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0)
sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
if (!rebuild && (flags & DBOX_SYNC_FLAG_FORCE) == 0)
sync_flags |= MAIL_INDEX_SYNC_FLAG_REQUIRE_CHANGES;
ibox->index_flags = MAIL_INDEX_OPEN_FLAG_CREATE |
mail_storage_settings_to_index_flags(box->storage->set);
- ibox->keep_recent = (flags & MAILBOX_FLAG_KEEP_RECENT) != 0;
- ibox->keep_locked = (flags & MAILBOX_FLAG_KEEP_LOCKED) != 0;
ibox->next_lock_notify = time(NULL) + LOCK_NOTIFY_INTERVAL;
ibox->commit_log_file_seq = 0;
/* we've discovered there aren't enough permissions to modify mailbox */
unsigned int backend_readonly:1;
- unsigned int keep_recent:1;
- unsigned int keep_locked:1;
unsigned int sent_diskspace_warning:1;
unsigned int sent_readonly_flags_warning:1;
unsigned int notify_pending:1;
}
index_mailbox_expunge_unseen_recent(ctx);
- if (ibox->keep_recent && ibox->box.opened) {
+ if ((ibox->box.flags & MAILBOX_FLAG_KEEP_RECENT) != 0 &&
+ ibox->box.opened) {
/* mailbox syncing didn't necessarily update our recent state */
hdr = mail_index_get_header(ibox->view);
if (hdr->first_recent_uid > ibox->recent_flags_prev_uid) {
index_mailbox_set_recent_uid(&mbox->ibox, uid);
}
- if (!mbox->ibox.keep_recent) {
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0) {
/* maildir_sync_index() dropped recent flags from
existing messages. we'll still need to drop recent
flags from these newly added messages. */
sync_flags = 0;
/* don't drop recent messages if we're saving messages */
- if (!mbox->ibox.keep_recent && maildir_sync_ctx != NULL)
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0 &&
+ maildir_sync_ctx != NULL)
sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
if (mail_index_sync_begin(mbox->ibox.index, &sync_ctx, &view, &trans,
dest = t_str_new(1024);
move_new = new_dir && !mailbox_is_readonly(&ctx->mbox->ibox.box) &&
- !ctx->mbox->ibox.keep_recent && ctx->locked;
+ (ctx->mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0 &&
+ ctx->locked;
errno = 0;
for (; (dp = readdir(dirp)) != NULL; errno = 0) {
static int maildir_sync_get_changes(struct maildir_sync_context *ctx,
bool *new_changed_r, bool *cur_changed_r)
{
+ struct maildir_mailbox *mbox = ctx->mbox;
enum mail_index_sync_flags flags = 0;
bool undirty = (ctx->flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0;
- if (maildir_sync_quick_check(ctx->mbox, undirty,
- ctx->new_dir, ctx->cur_dir,
+ if (maildir_sync_quick_check(mbox, undirty, ctx->new_dir, ctx->cur_dir,
new_changed_r, cur_changed_r) < 0)
return -1;
return 1;
if (have_recent_messages(ctx)) {
- if (!ctx->mbox->ibox.keep_recent) {
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0) {
*new_changed_r = TRUE;
return 1;
} else if (*new_changed_r) {
}
}
- if (!ctx->mbox->ibox.keep_recent)
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0)
flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
- return mail_index_sync_have_any(ctx->mbox->ibox.index, flags) ? 1 : 0;
+ return mail_index_sync_have_any(mbox->ibox.index, flags) ? 1 : 0;
}
static int maildir_sync_context(struct maildir_sync_context *ctx, bool forced,
} T_END;
i_assert(!maildir_uidlist_is_locked(mbox->uidlist) ||
- mbox->ibox.keep_locked);
+ (box->flags & MAILBOX_FLAG_KEEP_LOCKED) != 0);
if (lost_files) {
/* lost some files from new/, see if thery're in cur/ */
struct utimbuf buf;
struct stat st;
- if (mbox->ibox.recent_flags_count > 0 && mbox->ibox.keep_recent &&
+ if (mbox->ibox.recent_flags_count > 0 &&
+ (mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) != 0 &&
mbox->mbox_fd != -1 && !mbox->ibox.backend_readonly) {
/* we've seen recent messages which we want to keep recent.
keep file's atime lower than mtime so \Marked status
unsigned int first_mail_crlf_expunged:1;
/* global flags: */
+ unsigned int keep_recent:1;
unsigned int delay_writes:1;
unsigned int renumber_uids:1;
unsigned int moved_offsets:1;
{
i_assert(ctx->mail.uid != 0 || ctx->mail.pseudo);
- if (!ctx->sync_ctx->mbox->ibox.keep_recent)
+ if (!ctx->sync_ctx->keep_recent)
ctx->mail.flags &= ~MAIL_RECENT;
mbox_sync_update_status(ctx);
(ctx->mail.flags & MAIL_RECENT) != 0) {
ctx->mail.flags = (ctx->mail.flags & ~STATUS_FLAGS_MASK) |
(mail->flags & STATUS_FLAGS_MASK);
- if (!ctx->sync_ctx->mbox->ibox.keep_recent)
+ if (!ctx->sync_ctx->keep_recent)
ctx->mail.flags &= ~MAIL_RECENT;
mbox_sync_update_status(ctx);
}
if ((mail_ctx->mail.flags & MAIL_RECENT) != 0 &&
!mail_ctx->mail.pseudo) {
- if (!sync_ctx->mbox->ibox.keep_recent) {
+ if (!sync_ctx->keep_recent) {
/* need to add 'O' flag to Status-header */
mail_ctx->need_rewrite = TRUE;
}
return 1;
if (sync_ctx->hdr->first_recent_uid <= next_uid &&
- !sync_ctx->mbox->ibox.keep_recent) {
+ !sync_ctx->keep_recent) {
/* we'll need to rewrite Status: O headers */
return 1;
}
if (sync_ctx->hdr->first_recent_uid < sync_ctx->hdr->next_uid &&
(uid > sync_ctx->hdr->first_recent_uid || uid == 0) &&
- !sync_ctx->mbox->ibox.keep_recent) {
+ !sync_ctx->keep_recent) {
/* we'll need to rewrite Status: O headers */
uid = sync_ctx->hdr->first_recent_uid;
}
}
mail_index_view_close(&view);
- first_recent_uid = !sync_ctx->mbox->ibox.keep_recent ?
+ first_recent_uid = !sync_ctx->keep_recent ?
sync_ctx->next_uid : sync_ctx->last_nonrecent_uid + 1;
if (sync_ctx->hdr->first_recent_uid < first_recent_uid) {
mail_index_update_header(sync_ctx->t,
}
sync_flags = 0;
- if (!mbox->ibox.keep_recent)
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0)
sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
if ((flags & MBOX_SYNC_REWRITE) != 0)
sync_flags |= MAIL_INDEX_SYNC_FLAG_FLUSH_DIRTY;
return ret;
}
- if (!mbox->ibox.keep_recent) {
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_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)
memset(&sync_ctx, 0, sizeof(sync_ctx));
sync_ctx.mbox = mbox;
+ sync_ctx.keep_recent =
+ (mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) != 0;
sync_ctx.hdr = mail_index_get_header(sync_view);
sync_ctx.from_line = str_new(default_pool, 256);
sync_ctx.t = NULL;
sync_ctx.index_sync_ctx = NULL;
- if (ret == 0 && mbox->mbox_fd != -1 && mbox->ibox.keep_recent &&
+ if (ret == 0 && mbox->mbox_fd != -1 && sync_ctx.keep_recent &&
!sync_ctx.mbox->ibox.backend_readonly) {
/* try to set atime back to its original value */
struct utimbuf buf;
sync_flags = MAIL_INDEX_SYNC_FLAG_FLUSH_DIRTY |
MAIL_INDEX_SYNC_FLAG_REQUIRE_CHANGES;
- if (!mbox->ibox.keep_recent)
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0)
sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
ret = mail_index_sync_begin(mbox->ibox.index, &index_sync_ctx,
index_sync_flags = MAIL_INDEX_SYNC_FLAG_FLUSH_DIRTY |
MAIL_INDEX_SYNC_FLAG_AVOID_FLAG_UPDATES;
- if (!mbox->ibox.keep_recent)
+ if ((mbox->ibox.box.flags & MAILBOX_FLAG_KEEP_RECENT) == 0)
index_sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
ret = mail_index_sync_begin(ctx->index, &ctx->index_sync_ctx,