]> granicus.if.org Git - mutt/commitdiff
Changing the index_hint handling for mh folders once again.
authorThomas Roessler <roessler@does-not-exist.org>
Sat, 26 Sep 1998 10:13:39 +0000 (10:13 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Sat, 26 Sep 1998 10:13:39 +0000 (10:13 +0000)
mh.c

diff --git a/mh.c b/mh.c
index c19173415e2451dd9a210d31edb30f656b77ee27..4e1f707f200e4e7dfbde9d2e0b95a87b3d28f574 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -581,7 +581,7 @@ int mh_check_mailbox(CONTEXT *ctx, int *index_hint)
   struct maildir *md, *p;
   struct maildir **last;
   HASH *fnames;
-  int i, idx;
+  int i, deleted;
   
   if(!option (OPTCHECKNEW))
     return 0;
@@ -660,7 +660,7 @@ int mh_check_mailbox(CONTEXT *ctx, int *index_hint)
     hash_insert(fnames, p->canon_fname, p, 0);
   }
 
-  if(index_hint) idx = *index_hint;
+  deleted = 0;
   
   for(i = 0; i < ctx->msgcount; i++)
   {
@@ -695,12 +695,14 @@ int mh_check_mailbox(CONTEXT *ctx, int *index_hint)
       /* the message has disappeared by occult forces, correct
        * the index hint. 
        */
-      
-      if(modified && index_hint && (i <= *index_hint))
-       idx--;
+      if(modified && index_hint && (i < *index_hint))
+       deleted++;
     }
+
+    if(modified && index_hint && i == *index_hint)
+      *index_hint -= deleted;
   }
-    
+
   hash_destroy(&fnames, NULL);
     
   if(modified)
@@ -708,9 +710,6 @@ int mh_check_mailbox(CONTEXT *ctx, int *index_hint)
 
   maildir_move_to_context(ctx, &md);
   
-  if(index_hint)
-    *index_hint = idx;
-  
   return modified ? M_REOPENED : have_new ? M_NEW_MAIL : 0;
 }