autotest: re-organize mailbox storage by UID
an effect of 7ce658d
is that we can index messages by UID rather than
content (or more specifically, subject). apart from being cleaner, it
allows duplicated subjects.
This commit is contained in:
parent
b59ee239a4
commit
f3629c69e1
|
@ -344,7 +344,7 @@ sub readbox($)
|
||||||
print STDERR "message '$f' in '$bn' has no identifier.\n";
|
print STDERR "message '$f' in '$bn' has no identifier.\n";
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
@{ $ms{$num} } = ($uid, $flg.($sz>1000?"*":""));
|
@{ $ms{$uid} } = ($num, $flg.($sz>1000?"*":""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ($mu, %ms);
|
return ($mu, %ms);
|
||||||
|
@ -360,8 +360,8 @@ sub showbox($)
|
||||||
|
|
||||||
my ($mu, %ms) = readbox($bn);
|
my ($mu, %ms) = readbox($bn);
|
||||||
my @MS = ($mu);
|
my @MS = ($mu);
|
||||||
for my $num (sort { $a <=> $b } keys %ms) {
|
for my $uid (sort { $ms{$a}[0] <=> $ms{$b}[0] } keys %ms) {
|
||||||
push @MS, $num, $ms{$num}[0], $ms{$num}[1];
|
push @MS, $ms{$uid}[0], $uid, $ms{$uid}[1];
|
||||||
}
|
}
|
||||||
printbox($bn, @MS);
|
printbox($bn, @MS);
|
||||||
}
|
}
|
||||||
|
@ -487,19 +487,19 @@ sub ckbox($$@)
|
||||||
}
|
}
|
||||||
while (@MS) {
|
while (@MS) {
|
||||||
my ($num, $uid, $flg) = (shift @MS, shift @MS, shift @MS);
|
my ($num, $uid, $flg) = (shift @MS, shift @MS, shift @MS);
|
||||||
if (!defined $ms{$num}) {
|
my $m = delete $ms{$uid};
|
||||||
print STDERR "No message $bn:$num.\n";
|
if (!defined $m) {
|
||||||
|
print STDERR "No message $bn:$uid.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ($ms{$num}[0] ne $uid) {
|
if ($$m[0] ne $num) {
|
||||||
print STDERR "UID mismatch for $bn:$num.\n";
|
print STDERR "Subject mismatch for $bn:$uid.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ($ms{$num}[1] ne $flg) {
|
if ($$m[1] ne $flg) {
|
||||||
print STDERR "Flag mismatch for $bn:$num.\n";
|
print STDERR "Flag mismatch for $bn:$uid.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
delete $ms{$num};
|
|
||||||
}
|
}
|
||||||
if (%ms) {
|
if (%ms) {
|
||||||
print STDERR "Excess messages in '$bn': ".join(", ", sort({$a <=> $b } keys(%ms))).".\n";
|
print STDERR "Excess messages in '$bn': ".join(", ", sort({$a <=> $b } keys(%ms))).".\n";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user