From: Mehdi Abaakouk Date: Fri, 9 Nov 2018 12:33:10 +0000 (+0100) Subject: move Context.new X-Git-Tag: 2019-10-25~555 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=188a52b51358ac124848d0f171313518b92f2b42;p=neomutt move Context.new --- diff --git a/flags.c b/flags.c index d94dc1c03..4a79ee94a 100644 --- a/flags.c +++ b/flags.c @@ -147,7 +147,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Email *e, int flag, bool b update = true; e->old = false; if (upd_ctx) - ctx->new ++; + ctx->mailbox->msg_new ++; if (e->read) { e->read = false; @@ -164,7 +164,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Email *e, int flag, bool b update = true; if (!e->old) if (upd_ctx) - ctx->new --; + ctx->mailbox->msg_new --; e->read = true; if (upd_ctx) ctx->mailbox->msg_unread--; @@ -187,7 +187,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Email *e, int flag, bool b e->old = true; if (!e->read) if (upd_ctx) - ctx->new --; + ctx->mailbox->msg_new --; e->changed = true; if (upd_ctx) ctx->mailbox->changed = true; @@ -199,7 +199,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Email *e, int flag, bool b e->old = false; if (!e->read) if (upd_ctx) - ctx->new ++; + ctx->mailbox->msg_new ++; e->changed = true; if (upd_ctx) ctx->mailbox->changed = true; @@ -221,7 +221,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Email *e, int flag, bool b ctx->mailbox->msg_unread--; if (!e->old) if (upd_ctx) - ctx->new --; + ctx->mailbox->msg_new --; e->changed = true; if (upd_ctx) ctx->mailbox->changed = true; @@ -235,7 +235,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Email *e, int flag, bool b ctx->mailbox->msg_unread++; if (!e->old) if (upd_ctx) - ctx->new ++; + ctx->mailbox->msg_new ++; e->changed = true; if (upd_ctx) ctx->mailbox->changed = true; @@ -260,7 +260,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Email *e, int flag, bool b ctx->mailbox->msg_unread--; if (!e->old) if (upd_ctx) - ctx->new --; + ctx->mailbox->msg_new --; } e->changed = true; if (upd_ctx) diff --git a/mailbox.c b/mailbox.c index f00ca0030..38b2f3a74 100644 --- a/mailbox.c +++ b/mailbox.c @@ -223,6 +223,7 @@ static int mailbox_maildir_check(struct Mailbox *m, bool check_stats) m->msg_count = 0; m->msg_unread = 0; m->msg_flagged = 0; + m->msg_new = 0; } rc = mailbox_maildir_check_dir(m, "new", check_new, check_stats); diff --git a/mailbox.h b/mailbox.h index 92ef85b2a..65507c168 100644 --- a/mailbox.h +++ b/mailbox.h @@ -87,6 +87,7 @@ struct Mailbox int msg_count; /**< total number of messages */ int msg_unread; /**< number of unread messages */ int msg_flagged; /**< number of flagged messages */ + int msg_new; /**< number of new messages */ struct Email **hdrs; int hdrmax; /**< number of pointers in hdrs */ diff --git a/mbox/mbox.c b/mbox/mbox.c index bc74cad8c..03b920456 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -614,7 +614,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) ctx->vsize = 0; ctx->tagged = 0; ctx->deleted = 0; - ctx->new = 0; + ctx->mailbox->msg_new = 0; ctx->mailbox->msg_unread = 0; ctx->mailbox->msg_flagged = 0; ctx->mailbox->changed = false; diff --git a/mx.c b/mx.c index d6d94f04d..a3c7e8875 100644 --- a/mx.c +++ b/mx.c @@ -832,7 +832,7 @@ void mx_update_tables(struct Context *ctx, bool committing) ctx->vsize = 0; ctx->tagged = 0; ctx->deleted = 0; - ctx->new = 0; + ctx->mailbox->msg_new = 0; ctx->mailbox->msg_unread = 0; ctx->mailbox->changed = false; ctx->mailbox->msg_flagged = 0; @@ -877,7 +877,7 @@ void mx_update_tables(struct Context *ctx, bool committing) { ctx->mailbox->msg_unread++; if (!ctx->mailbox->hdrs[j]->old) - ctx->new ++; + ctx->mailbox->msg_new ++; } j++; @@ -1294,7 +1294,7 @@ void mx_update_context(struct Context *ctx, int new_messages) { ctx->mailbox->msg_unread++; if (!e->old) - ctx->new ++; + ctx->mailbox->msg_new ++; } } } diff --git a/nntp/nntp.c b/nntp/nntp.c index 5f12eb48d..946cd1300 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -1691,7 +1691,7 @@ static int check_mailbox(struct Context *ctx) ctx->mailbox->vcount = 0; ctx->deleted = 0; - ctx->new = 0; + ctx->mailbox->msg_new = 0; ctx->mailbox->msg_unread = 0; ctx->mailbox->msg_flagged = 0; ctx->mailbox->changed = false;