err(&EX_TEMPFAIL, "Failed rename($msg, $mhmsg)");
}
- # XXX: Lame! Instead, keep a hash of arrays. Keys are folder
- # names, array elements are message numbers in that list.
- # Then after all the messages have been sorted, run one mark
- # command per folder, marking all messages for that folder in
- # one sweep.
+ # Mark each message as soon as we store it and bomb if that
+ # fails. While it is slow, it is not safe to store multiple
+ # messages and then have a failure before marking some (or
+ # all).
if ($mhfolder ne 'SPAM') {
$status = system("mark +$mhfolder $msgnum -sequence unseen -add");
if (not (WIFEXITED($status) and WEXITSTATUS($status) == 0)) {