- * 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().
- */
- if (rmmproc) {
- context_replace (pfolder, folder);
- context_save ();
- fflush (stdout);
+ ** This is hackish. If we don't unlink, but refile,
+ ** then we need to update the current folder in the
+ ** context so the external program will refile files
+ ** from the correct directory.
+ */
+ context_replace(curfolder, folder);
+ context_save();
+ fflush(stdout);
+
+ /* remove by refiling. */
+ /* Unset the EXISTS flag for each message to be removed */
+ for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
+ if (is_selected(mp, msgnum))
+ unset_exists(mp, msgnum);
+ }
+
+ /* Mark that the sequence information has changed */
+ mp->msgflags |= SEQMOD;
+
+ if (mp->numsel+4 > MAXARGS)
+ adios(NULL, "more than %d messages for refile exec",
+ MAXARGS - 4);
+ vec = (char **)mh_xmalloc((size_t)(mp->numsel + 4) * sizeof(*vec));
+ vec[vecp++] = "refile";
+ vec[vecp++] = "-nolink";
+ vec[vecp++] = concat("+", trashfolder, NULL);
+ for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
+ if (!is_selected(mp, msgnum)) {
+ continue;
+ }
+ if (!(vec[vecp++] = strdup(m_name(msgnum)))) {
+ adios(NULL, "strdup failed");
+ }