]> granicus.if.org Git - mutt/commitdiff
Fix uses of context->changed as a counter.
authorKevin McCarthy <kevin@8t8.us>
Wed, 27 Sep 2017 02:44:11 +0000 (19:44 -0700)
committerKevin McCarthy <kevin@8t8.us>
Wed, 27 Sep 2017 02:44:11 +0000 (19:44 -0700)
The first was in mx_update_tables(), but only when "not committing".
This is used by mh/maildir during an "occult" update, and in imap when
expunging the mailbox.  It meant to simply turn on changed when a
single changed header is seen.

The second use was in imap_sync_message_for_copy().  Previously this
was used for a server side copy/save, but is now also used for
fast-trash copying.  Remove the code that was trying to decrement the
counter: this function is not capable of properly setting a status
bit.

imap/imap.c
mx.c

index 0bb2d5f8d37c84089d523408f6d474b06413a9eb..b3e780c811ffc6aefe583e06384f9f62bf0731cb 100644 (file)
@@ -1102,10 +1102,7 @@ int imap_sync_message_for_copy (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd,
   if (!compare_flags_for_copy (hdr))
   {
     if (hdr->deleted == HEADER_DATA(hdr)->deleted)
-    {
       hdr->changed = 0;
-      idata->ctx->changed--;
-    }
     return 0;
   }
 
@@ -1172,10 +1169,7 @@ int imap_sync_message_for_copy (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd,
 
   hdr->active = 1;
   if (hdr->deleted == HEADER_DATA(hdr)->deleted)
-  {
     hdr->changed = 0;
-    idata->ctx->changed--;
-  }
 
   return 0;
 }
diff --git a/mx.c b/mx.c
index 5d6782aa062c613fd12067e80a84e17a84281e8d..1f991208686a5c7f8e7de10f397d73cfd4e1c464 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -1054,7 +1054,7 @@ void mx_update_tables(CONTEXT *ctx, int committing)
       if (committing)
        ctx->hdrs[j]->changed = 0;
       else if (ctx->hdrs[j]->changed)
-       ctx->changed++;
+       ctx->changed = 1;
       
       if (!committing || (ctx->magic == MUTT_MAILDIR && option (OPTMAILDIRTRASH)))
       {