summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
cdef2c7)
Rename store_message variables so this actually makes sense.
my @filtered;
sub store_message {
my $inbox = shift;
my @filtered;
sub store_message {
my $inbox = shift;
- my $msg = shift; # rename $src_msg
+ my $src_msgpath = shift;
- my ($msgnum, $mhmsg); # rename $dst_msg and $dst_msgpath
+ my ($dst_msgnum, $dst_msgpath);
# We must do this even in -n mode because later steps fail without
# it. This should be harmless.
# We must do this even in -n mode because later steps fail without
# it. This should be harmless.
if ("+$mhfolder" eq $inbox) {
# If @filtered is empty, this message already has the right number.
if ("+$mhfolder" eq $inbox) {
# If @filtered is empty, this message already has the right number.
- if (!($msgnum = shift(@filtered))) {
- $msg =~ m|.*/(\d+)$|;
+ if (!($dst_msgpath = shift(@filtered))) {
+ $src_msgpath =~ m|.*/(\d+)$|;
- $mhmsg = "$mh/$mhfolder/$msgnum";
+ $dst_msgpath =~ m|.*/(\d+)$|;
+ $dst_msgnum = $1;
} else {
# This loop is a modified version of the maildir delivery algorithm.
} else {
# This loop is a modified version of the maildir delivery algorithm.
- $msgnum = get_highest_msgnum($mhfolder);
+ $dst_msgnum = get_highest_msgnum($mhfolder);
my $try;
for ($try = 0; ; $try++) {
my $try;
for ($try = 0; ; $try++) {
- $msgnum++;
- $mhmsg = "$mh/$mhfolder/$msgnum";
+ $dst_msgnum++;
+ $dst_msgpath = "$mh/$mhfolder/$dst_msgnum";
- if (not stat($mhmsg)) {
+ if (not stat($dst_msgpath)) {
if ($!{ENOENT}) {
# Now we have a non-existent file, let's try to create
# it. We must create a zero-byte file first because a
if ($!{ENOENT}) {
# Now we have a non-existent file, let's try to create
# it. We must create a zero-byte file first because a
# file is left behind as opposed to a duplicate
# message. This is more easily detected by the user.
if ($run) {
# file is left behind as opposed to a duplicate
# message. This is more easily detected by the user.
if ($run) {
- if (sysopen(MSG, $mhmsg,
+ if (sysopen(MSG, $dst_msgpath,
O_WRONLY | O_EXCL | O_CREAT, 0600)) {
close(MSG);
last;
O_WRONLY | O_EXCL | O_CREAT, 0600)) {
close(MSG);
last;
# This algorithm is different from the maildir one; let's make
# 10 tries instead of 3.
if ($try == 9) {
# This algorithm is different from the maildir one; let's make
# 10 tries instead of 3.
if ($try == 9) {
- die("Attempted filename $mhmsg exists.");
+ die("Attempted filename $dst_msgpath exists.");
}
# This algorithm is different; i don't think we need to sleep.
}
# This algorithm is different; i don't think we need to sleep.
# messages and then have a failure before marking some (or
# all).
if ($mhfolder ne 'SPAM') {
# messages and then have a failure before marking some (or
# all).
if ($mhfolder ne 'SPAM') {
- mark($mhfolder, $msgnum, 'unseen');
+ mark($mhfolder, $dst_msgnum, 'unseen');
+ push(@filtered, $src_msgpath);
- if (not rename($msg, $mhmsg)) {
- die("rename($msg, $mhmsg): $!");
+ if (not rename($src_msgpath, $dst_msgpath)) {
+ die("rename($src_msgpath, $dst_msgpath): $!");
}
# Parse a message file into a structure describing the headers. The
}
# Parse a message file into a structure describing the headers. The