]> granicus.if.org Git - neomutt/commitdiff
move flagged
authorRichard Russon <rich@flatcap.org>
Thu, 30 Aug 2018 16:09:19 +0000 (17:09 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 4 Sep 2018 00:24:58 +0000 (01:24 +0100)
context.h
flags.c
mailbox.c
mbox/mbox.c
mx.c
nntp/nntp.c
sidebar.c
status.c

index 167d6072487371cdfd5f13f610dd4f002f73270c..10d8d788c9f83cbc52d5020b5d4471ba7693254b 100644 (file)
--- 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 791833fa92ad7b1441468d99f1997b13e63c1560..4242cf5b23ae228f11126f905da81cb77b1552fc 100644 (file)
--- 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;
   }
index dce51d7cbe7a014dc86e58de1e6a60bc39361193..9cc45e1855033ebb155d11c236d42de3226b5471 100644 (file)
--- 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);
     }
index ca26412489a4a3371d2e22f8ee644150f3bed611..97bb06d6731f1b3bc8f104704f4c7e5ccb08be5c 100644 (file)
@@ -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 8e694b0ad354630a9ba5136ef008ee66e11609fc..09335e2d349e1e965721befe2e31798d1313716f 100644 (file)
--- 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)
index a088a17f6f4897e3fe458dec5c4322bc1bffec67..d108c2bb4fc73183b7d9de8c43575d330407ecd9 100644 (file)
@@ -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;
index 8193276d2f634625ca3730b3f11979bf2a13a52b..2e7120c9474bfb0192fc871af3b9b9f55887f207 100644 (file)
--- 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;
     }
   }
index 0045625f937e52d111e9148d204788cef267b189..88d5d9e0bd9a2593b5b0100a12ce1485ae295a65 100644 (file)
--- 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;