From: Richard Russon Date: Thu, 30 Aug 2018 16:01:23 +0000 (+0100) Subject: move unread X-Git-Tag: 2019-10-25~664^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43888108f13d8ba632e4a1351f184d35054d921b;p=neomutt move unread --- diff --git a/browser.c b/browser.c index 90b69893d..9006c7202 100644 --- a/browser.c +++ b/browser.c @@ -689,7 +689,7 @@ static const char *group_index_format_str(char *buf, size_t buflen, size_t col, else if (Context && Context->data == folder->ff->nd) { snprintf(fmt, sizeof(fmt), "%%%sd", prec); - snprintf(buf, buflen, fmt, Context->unread); + snprintf(buf, buflen, fmt, Context->mailbox->msg_unread); } else { @@ -888,7 +888,7 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state, if (np && Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0)) { np->b->msg_count = Context->mailbox->msg_count; - np->b->msg_unread = Context->unread; + np->b->msg_unread = Context->mailbox->msg_unread; } add_folder(menu, state, de->d_name, NULL, &s, np ? np->b : NULL, NULL); } @@ -974,7 +974,7 @@ static int examine_mailboxes(struct Menu *menu, struct BrowserState *state) if (Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0)) { np->b->msg_count = Context->mailbox->msg_count; - np->b->msg_unread = Context->unread; + np->b->msg_unread = Context->mailbox->msg_unread; } char buffer[PATH_MAX]; diff --git a/context.h b/context.h index 284c52eb9..167d60724 100644 --- a/context.h +++ b/context.h @@ -72,7 +72,6 @@ struct Context int vcount; /**< the number of virtual messages */ int tagged; /**< how many messages are tagged? */ int new; /**< how many new messages? */ - int unread; /**< how many unread messages? */ int deleted; /**< how many deleted messages */ int flagged; /**< how many flagged messages */ int msgnotreadyet; /**< which msg "new" in pager, -1 if none */ diff --git a/flags.c b/flags.c index ed360ad38..791833fa9 100644 --- a/flags.c +++ b/flags.c @@ -152,7 +152,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool { h->read = false; if (upd_ctx) - ctx->unread++; + ctx->mailbox->msg_unread++; } h->changed = true; if (upd_ctx) @@ -167,7 +167,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool ctx->new --; h->read = true; if (upd_ctx) - ctx->unread--; + ctx->mailbox->msg_unread--; h->changed = true; if (upd_ctx) ctx->changed = true; @@ -218,7 +218,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool update = true; h->read = true; if (upd_ctx) - ctx->unread--; + ctx->mailbox->msg_unread--; if (!h->old) if (upd_ctx) ctx->new --; @@ -232,7 +232,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool update = true; h->read = false; if (upd_ctx) - ctx->unread++; + ctx->mailbox->msg_unread++; if (!h->old) if (upd_ctx) ctx->new ++; @@ -257,7 +257,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool { h->read = true; if (upd_ctx) - ctx->unread--; + ctx->mailbox->msg_unread--; if (!h->old) if (upd_ctx) ctx->new --; diff --git a/imap/browse.c b/imap/browse.c index 107d25de3..6a4f7a74e 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -125,7 +125,7 @@ static void add_folder(char delim, char *folder, bool noselect, bool noinferiors if (Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0)) { np->b->msg_count = Context->mailbox->msg_count; - np->b->msg_unread = Context->unread; + np->b->msg_unread = Context->mailbox->msg_unread; } (state->entry)[state->entrylen].has_mailbox = true; (state->entry)[state->entrylen].new = np->b->new; diff --git a/mailbox.c b/mailbox.c index 61bc8e871..dce51d7cb 100644 --- a/mailbox.c +++ b/mailbox.c @@ -374,7 +374,7 @@ static int mailbox_mbox_check(struct Mailbox *mailbox, struct stat *sb, bool che if (ctx) { mailbox->msg_count = ctx->mailbox->msg_count; - mailbox->msg_unread = ctx->unread; + mailbox->msg_unread = ctx->mailbox->msg_unread; mailbox->msg_flagged = ctx->flagged; mailbox->stats_last_checked = ctx->mtime; mx_mbox_close(&ctx, NULL); diff --git a/mbox/mbox.c b/mbox/mbox.c index 8e8d938a0..ca2641248 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -690,7 +690,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) ctx->tagged = 0; ctx->deleted = 0; ctx->new = 0; - ctx->unread = 0; + ctx->mailbox->msg_unread = 0; ctx->flagged = 0; ctx->changed = false; ctx->id_hash = NULL; diff --git a/mx.c b/mx.c index daad06996..8e694b0ad 100644 --- a/mx.c +++ b/mx.c @@ -535,7 +535,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint) } #ifdef USE_NNTP - if (ctx->unread && ctx->magic == MUTT_NNTP) + if (ctx->mailbox->msg_unread && ctx->magic == MUTT_NNTP) { struct NntpData *nntp_data = ctx->data; @@ -772,7 +772,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint) for (i = 0; i < ctx->mailbox->msg_count; i++) { if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read) - ctx->unread--; + ctx->mailbox->msg_unread--; if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged) ctx->flagged--; } @@ -803,7 +803,7 @@ void mx_update_tables(struct Context *ctx, bool committing) ctx->tagged = 0; ctx->deleted = 0; ctx->new = 0; - ctx->unread = 0; + ctx->mailbox->msg_unread = 0; ctx->changed = false; ctx->flagged = 0; padding = mx_msg_padding_size(ctx); @@ -844,7 +844,7 @@ void mx_update_tables(struct Context *ctx, bool committing) ctx->flagged++; if (!ctx->hdrs[j]->read) { - ctx->unread++; + ctx->mailbox->msg_unread++; if (!ctx->hdrs[j]->old) ctx->new ++; } @@ -1253,7 +1253,7 @@ void mx_update_context(struct Context *ctx, int new_messages) ctx->deleted++; if (!h->read) { - ctx->unread++; + ctx->mailbox->msg_unread++; if (!h->old) ctx->new ++; } diff --git a/nntp/nntp.c b/nntp/nntp.c index dc08e2c53..a088a17f6 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -2081,7 +2081,7 @@ static int check_mailbox(struct Context *ctx) ctx->vcount = 0; ctx->deleted = 0; ctx->new = 0; - ctx->unread = 0; + ctx->mailbox->msg_unread = 0; ctx->flagged = 0; ctx->changed = false; ctx->id_hash = NULL; @@ -2213,7 +2213,7 @@ static int nntp_mbox_close(struct Context *ctx) if (!nntp_data) return 0; - nntp_data->unread = ctx->unread; + nntp_data->unread = ctx->mailbox->msg_unread; nntp_acache_free(nntp_data); if (!nntp_data->nserv || !nntp_data->nserv->groups_hash || !nntp_data->group) diff --git a/sidebar.c b/sidebar.c index bbe612bc4..8193276d2 100644 --- a/sidebar.c +++ b/sidebar.c @@ -872,7 +872,7 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) else #endif { - b->msg_unread = Context->unread; + b->msg_unread = Context->mailbox->msg_unread; b->msg_count = Context->mailbox->msg_count; } b->msg_flagged = Context->flagged; @@ -1079,7 +1079,7 @@ void mutt_sb_set_mailbox_stats(const struct Context *ctx) { if (mutt_str_strcmp(np->b->realpath, ctx->mailbox->realpath) == 0) { - np->b->msg_unread = ctx->unread; + np->b->msg_unread = ctx->mailbox->msg_unread; np->b->msg_count = ctx->mailbox->msg_count; np->b->msg_flagged = ctx->flagged; break; diff --git a/status.c b/status.c index 156b566e2..0045625f9 100644 --- a/status.c +++ b/status.c @@ -220,9 +220,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->unread - Context->new : 0); + snprintf(buf, buflen, fmt, Context ? Context->mailbox->msg_unread - Context->new : 0); } - else if (!Context || !(Context->unread - Context->new)) + else if (!Context || !(Context->mailbox->msg_unread - Context->new)) optional = 0; break; @@ -285,7 +285,7 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c case 'R': { - int read = Context ? Context->mailbox->msg_count - Context->unread : 0; + int read = Context ? Context->mailbox->msg_count - Context->mailbox->msg_unread : 0; if (!optional) { @@ -321,9 +321,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->unread : 0); + snprintf(buf, buflen, fmt, Context ? Context->mailbox->msg_unread : 0); } - else if (!Context || !Context->unread) + else if (!Context || !Context->mailbox->msg_unread) optional = 0; break;