]> diplodocus.org Git - nmh/commitdiff
Change folder_delmsgs() to save context and sequence files (and make
authorKen Hornstein <kenh@pobox.com>
Sun, 24 Mar 2013 02:59:24 +0000 (22:59 -0400)
committerKen Hornstein <kenh@pobox.com>
Sun, 24 Mar 2013 02:59:24 +0000 (22:59 -0400)
sure those changes are before calling rmmproc().  Update programs
that use folder_delmsgs() to make all changes to sequences and
the context before calling folder_delmsgs().

sbr/folder_delmsgs.c
uip/refile.c
uip/rmm.c

index 7431b62..ee4bd9e 100644 (file)
@@ -40,6 +40,14 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
        /* Mark that the sequence information has changed */
        mp->msgflags |= SEQMOD;
 
        /* Mark that the sequence information has changed */
        mp->msgflags |= SEQMOD;
 
+       /*
+        * Write out the sequence and context files; this will release
+        * any locks before the rmmproc is called.
+        */
+
+       seq_save (mp);
+       context_save ();
+
        vec = argsplit(rmmproc, &prog, &vecp);
 
        /*
        vec = argsplit(rmmproc, &prog, &vecp);
 
        /*
@@ -132,5 +140,12 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
     /* Mark that the sequence information has changed */
     mp->msgflags |= SEQMOD;
 
     /* Mark that the sequence information has changed */
     mp->msgflags |= SEQMOD;
 
+    /*
+     * Write out sequence and context files
+     */
+
+    seq_save (mp);
+    context_save ();
+
     return retval;
 }
     return retval;
 }
index 725a7ad..8a4392b 100644 (file)
@@ -239,16 +239,19 @@ main (int argc, char **argv)
     }
 
     /*
     }
 
     /*
-     * This is a hack.  If we are using an external rmmproc,
-     * then save the current folder to the context file,
-     * so the external rmmproc will remove files from the correct
-     * directory.  This should be moved to folder_delmsgs().
+     * Update this now, since folder_delmsgs() will save the context
+     * but doesn't have access to the folder name.
      */
      */
-    if (rmmproc) {
-       context_replace (pfolder, folder);
-       context_save ();
-       fflush (stdout);
-    }
+
+    context_replace (pfolder, folder); /* update current folder   */
+
+    /*
+     * Adjust "cur" if necessary
+     */
+
+    if (mp->hghsel != mp->curmsg
+       && (mp->numsel != mp->nummsg || linkf))
+       seq_setcur (mp, mp->hghsel);
 
     /* If -nolink, then "remove" messages from source folder.
      *
 
     /* If -nolink, then "remove" messages from source folder.
      *
@@ -257,17 +260,13 @@ main (int argc, char **argv)
      */
     if (!linkf) {
        folder_delmsgs (mp, unlink_msgs, 1);
      */
     if (!linkf) {
        folder_delmsgs (mp, unlink_msgs, 1);
+    } else {
+       seq_save (mp);  /* synchronize message sequences */
+       context_save ();                        /* save the context file   */
     }
 
     clsfolds (folders, foldp);
 
     }
 
     clsfolds (folders, foldp);
 
-    if (mp->hghsel != mp->curmsg
-       && (mp->numsel != mp->nummsg || linkf))
-       seq_setcur (mp, mp->hghsel);
-    seq_save (mp);     /* synchronize message sequences */
-
-    context_replace (pfolder, folder); /* update current folder   */
-    context_save ();                   /* save the context file   */
     folder_free (mp);                  /* free folder structure   */
     done (0);
     return 1;
     folder_free (mp);                  /* free folder structure   */
     done (0);
     return 1;
index 64d85ce..ee602b4 100644 (file)
--- a/uip/rmm.c
+++ b/uip/rmm.c
@@ -118,24 +118,16 @@ main (int argc, char **argv)
     seq_setprev (mp);          /* set the previous-sequence      */
 
     /*
     seq_setprev (mp);          /* set the previous-sequence      */
 
     /*
-     * This is hackish.  If we are using a external rmmproc,
-     * then we need to update the current folder in the
-     * context so the external rmmproc will remove files
-     * from the correct directory.  This should be moved to
-     * folder_delmsgs().
+     * As part of the new world locking order, folder_delmsgs() now updates
+     * the sequence and context for us.  But since folder_delmsgs() doesn't
+     * have access to the folder name, change the context now.
      */
      */
-    if (rmmproc) {
-       context_replace (pfolder, folder);
-       context_save ();
-       fflush (stdout);
-    }
+
+    context_replace (pfolder, folder);
 
     /* "remove" the SELECTED messages */
     folder_delmsgs (mp, unlink_msgs, 0);
 
 
     /* "remove" the SELECTED messages */
     folder_delmsgs (mp, unlink_msgs, 0);
 
-    seq_save (mp);             /* synchronize message sequences  */
-    context_replace (pfolder, folder); /* update current folder   */
-    context_save ();                   /* save the context file   */
     folder_free (mp);                  /* free folder structure   */
     done (0);
     return 1;
     folder_free (mp);                  /* free folder structure   */
     done (0);
     return 1;