From: Richard Russon Date: Thu, 30 Aug 2018 16:09:19 +0000 (+0100) Subject: move flagged X-Git-Tag: 2019-10-25~664^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de93abc3a3dabe9c90e6ff611a3b0907fefeff79;p=neomutt move flagged --- diff --git a/context.h b/context.h index 167d60724..10d8d788c 100644 --- a/context.h +++ b/context.h @@ -73,7 +73,6 @@ struct Context int tagged; /**< how many messages are tagged? */ int new; /**< how many new messages? */ int deleted; /**< how many deleted messages */ - int flagged; /**< how many flagged messages */ int msgnotreadyet; /**< which msg "new" in pager, -1 if none */ struct Menu *menu; /**< needed for pattern compilation */ diff --git a/flags.c b/flags.c index 791833fa9..4242cf5b2 100644 --- a/flags.c +++ b/flags.c @@ -61,7 +61,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool bool changed = h->changed; int deleted = ctx->deleted; int tagged = ctx->tagged; - int flagged = ctx->flagged; + int mailbox = ctx->mailbox->msg_flagged; int update = false; if (ctx->readonly && flag != MUTT_TAG) @@ -289,7 +289,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool update = true; h->flagged = bf; if (upd_ctx) - ctx->flagged++; + ctx->mailbox->msg_flagged++; h->changed = true; if (upd_ctx) ctx->changed = true; @@ -300,7 +300,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool update = true; h->flagged = false; if (upd_ctx) - ctx->flagged--; + ctx->mailbox->msg_flagged--; h->changed = true; if (upd_ctx) ctx->changed = true; @@ -341,7 +341,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool * of this message and not what it was at the time it was last searched. */ if (h->searched && (changed != h->changed || deleted != ctx->deleted || - tagged != ctx->tagged || flagged != ctx->flagged)) + tagged != ctx->tagged || mailbox != ctx->mailbox->msg_flagged)) { h->searched = false; } diff --git a/mailbox.c b/mailbox.c index dce51d7cb..9cc45e185 100644 --- a/mailbox.c +++ b/mailbox.c @@ -375,7 +375,7 @@ static int mailbox_mbox_check(struct Mailbox *mailbox, struct stat *sb, bool che { mailbox->msg_count = ctx->mailbox->msg_count; mailbox->msg_unread = ctx->mailbox->msg_unread; - mailbox->msg_flagged = ctx->flagged; + mailbox->msg_flagged = ctx->mailbox->msg_flagged; mailbox->stats_last_checked = ctx->mtime; mx_mbox_close(&ctx, NULL); } diff --git a/mbox/mbox.c b/mbox/mbox.c index ca2641248..97bb06d67 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -691,7 +691,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) ctx->deleted = 0; ctx->new = 0; ctx->mailbox->msg_unread = 0; - ctx->flagged = 0; + ctx->mailbox->msg_flagged = 0; ctx->changed = false; ctx->id_hash = NULL; ctx->subj_hash = NULL; diff --git a/mx.c b/mx.c index 8e694b0ad..09335e2d3 100644 --- a/mx.c +++ b/mx.c @@ -774,7 +774,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint) if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read) ctx->mailbox->msg_unread--; if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged) - ctx->flagged--; + ctx->mailbox->msg_flagged--; } ctx->mailbox->msg_count -= ctx->deleted; mutt_sb_set_mailbox_stats(ctx); @@ -805,7 +805,7 @@ void mx_update_tables(struct Context *ctx, bool committing) ctx->new = 0; ctx->mailbox->msg_unread = 0; ctx->changed = false; - ctx->flagged = 0; + ctx->mailbox->msg_flagged = 0; padding = mx_msg_padding_size(ctx); for (i = 0, j = 0; i < ctx->mailbox->msg_count; i++) { @@ -841,7 +841,7 @@ void mx_update_tables(struct Context *ctx, bool committing) if (ctx->hdrs[j]->tagged) ctx->tagged++; if (ctx->hdrs[j]->flagged) - ctx->flagged++; + ctx->mailbox->msg_flagged++; if (!ctx->hdrs[j]->read) { ctx->mailbox->msg_unread++; @@ -1248,7 +1248,7 @@ void mx_update_context(struct Context *ctx, int new_messages) if (h->changed) ctx->changed = true; if (h->flagged) - ctx->flagged++; + ctx->mailbox->msg_flagged++; if (h->deleted) ctx->deleted++; if (!h->read) diff --git a/nntp/nntp.c b/nntp/nntp.c index a088a17f6..d108c2bb4 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -2082,7 +2082,7 @@ static int check_mailbox(struct Context *ctx) ctx->deleted = 0; ctx->new = 0; ctx->mailbox->msg_unread = 0; - ctx->flagged = 0; + ctx->mailbox->msg_flagged = 0; ctx->changed = false; ctx->id_hash = NULL; ctx->subj_hash = NULL; diff --git a/sidebar.c b/sidebar.c index 8193276d2..2e7120c94 100644 --- a/sidebar.c +++ b/sidebar.c @@ -875,7 +875,7 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) b->msg_unread = Context->mailbox->msg_unread; b->msg_count = Context->mailbox->msg_count; } - b->msg_flagged = Context->flagged; + b->msg_flagged = Context->mailbox->msg_flagged; } /* compute length of Folder without trailing separator */ @@ -1081,7 +1081,7 @@ void mutt_sb_set_mailbox_stats(const struct Context *ctx) { np->b->msg_unread = ctx->mailbox->msg_unread; np->b->msg_count = ctx->mailbox->msg_count; - np->b->msg_flagged = ctx->flagged; + np->b->msg_flagged = ctx->mailbox->msg_flagged; break; } } diff --git a/status.c b/status.c index 0045625f9..88d5d9e0b 100644 --- a/status.c +++ b/status.c @@ -153,9 +153,9 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c if (!optional) { snprintf(fmt, sizeof(fmt), "%%%sd", prec); - snprintf(buf, buflen, fmt, Context ? Context->flagged : 0); + snprintf(buf, buflen, fmt, Context ? Context->mailbox->msg_flagged : 0); } - else if (!Context || !Context->flagged) + else if (!Context || !Context->mailbox->msg_flagged) optional = 0; break;