You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2004/10/29 00:03:01 UTC
svn commit: rev 55898 - spamassassin/trunk/lib/Mail/SpamAssassin
Author: felicity
Date: Thu Oct 28 15:03:00 2004
New Revision: 55898
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm
spamassassin/trunk/lib/Mail/SpamAssassin/Constants.pm
Log:
in ArchiveIterator, don't pass around -1 as the 'time unknown' flag, use a constant (actually -1) instead for ease of reading, etc.
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm Thu Oct 28 15:03:00 2004
@@ -531,7 +531,9 @@
my($class, $format, $date, $where, $result) = $self->run_message($line);
$result ||= '';
- # If opt_n is set, the input date was -1, so reset it if possible
+ # If opt_n is set, the original input date wasn't known,
+ # but run_message would have calculated it, so reset the packed
+ # version if possible ...
if ($self->{opt_n} && $class && $format && defined $date && $where) {
$line = index_pack($class, $format, $date, $where);
}
@@ -635,7 +637,7 @@
foreach my $mail (@files) {
if ($self->{opt_n}) {
- $self->{$class}->{index_pack($class, "f", -1, $mail)} = $no++;
+ $self->{$class}->{index_pack($class, "f", AI_TIME_UNKNOWN, $mail)} = $no++;
next;
}
my $header;
@@ -655,7 +657,7 @@
my ($self, $class, $mail) = @_;
if ($self->{opt_n}) {
- $self->{$class}->{index_pack($class, "f", -1, $mail)} = $no++;
+ $self->{$class}->{index_pack($class, "f", AI_TIME_UNKNOWN, $mail)} = $no++;
return;
}
my $header;
@@ -725,7 +727,7 @@
if ($header) {
my $t;
if ($self->{opt_n}) {
- $self->{$class}->{index_pack($class, "m", -1, "$file.$offset")} = $no++;
+ $self->{$class}->{index_pack($class, "m", AI_TIME_UNKNOWN, "$file.$offset")} = $no++;
}
else {
$t = Mail::SpamAssassin::Util::receive_date($header);
@@ -787,7 +789,7 @@
my $t;
if ($self->{opt_n}) {
- $self->{$class}->{index_pack($class, "b", -1, "$file.$offset")} = $no++;
+ $self->{$class}->{index_pack($class, "b", AI_TIME_UNKNOWN, "$file.$offset")} = $no++;
} else {
$t = Mail::SpamAssassin::Util::receive_date($header);
next if !$self->message_is_useful_by_date($t);
@@ -840,7 +842,7 @@
}
close INPUT;
- if ($date == -1) {
+ if ($date == AI_TIME_UNKNOWN) {
$date = Mail::SpamAssassin::Util::receive_date($header);
}
@@ -878,7 +880,7 @@
}
close INPUT;
- if ($date == -1) {
+ if ($date == AI_TIME_UNKNOWN) {
$date = Mail::SpamAssassin::Util::receive_date($header);
}
@@ -912,7 +914,7 @@
}
close INPUT;
- if ($date == -1) {
+ if ($date == AI_TIME_UNKNOWN) {
$date = Mail::SpamAssassin::Util::receive_date($header);
}
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Constants.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Constants.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Constants.pm Thu Oct 28 15:03:00 2004
@@ -36,7 +36,7 @@
@SA_VARS = qw(
META_TEST_MIN_PRIORITY HARVEST_DNSBL_PRIORITY MBX_SEPARATOR
MAX_BODY_LINE_LENGTH MAX_HEADER_KEY_LENGTH MAX_HEADER_VALUE_LENGTH
- MAX_HEADER_LENGTH ARITH_EXPRESSION_LEXER
+ MAX_HEADER_LENGTH ARITH_EXPRESSION_LEXER AI_TIME_UNKNOWN
);
%EXPORT_TAGS = (
@@ -210,5 +210,13 @@
[\+\-\*\/]| # Mathematical Operator
[\?:] # ? : Operator
)/ox;
+
+# ArchiveIterator
+
+# if AI doesn't read in the message in the first pass to see if the received
+# date makes the message useful or not, we need to mark it so that in the
+# second pass (when the message is actually read + processed) the received
+# date is calculated. this value signifies "unknown" from the first pass.
+use constant AI_TIME_UNKNOWN => -1;
1;