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/02/10 18:37:08 UTC

svn commit: rev 6603 - incubator/spamassassin/trunk/lib/Mail/SpamAssassin

Author: felicity
Date: Tue Feb 10 09:37:06 2004
New Revision: 6603

Modified:
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
Log:
PerMsgStatus shouldn't go digging into the internal message format.  bayes wants the mbox seperator if it exists.  and let's not use future atimes in the bayes db since that should never happen.

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm	Tue Feb 10 09:37:06 2004
@@ -715,7 +715,13 @@
   my ($wc, @tokens) = $self->tokenize ($msg, $body);
   my %seen = ();
 
-  my $msgatime = $self->receive_date(scalar $msg->get_all_headers());
+  my $msgatime = $self->receive_date(scalar $msg->get_all_headers(0,1));
+
+  # If the message atime comes back as being more than 1 day in the
+  # future, something's messed up and we should revert to current time as
+  # a safety measure.
+  #
+  $msgatime = time if ( $msgatime - time > 86400 );
 
   for (@tokens) {
     if ($seen{$_}) { next; } else { $seen{$_} = 1; }
@@ -997,7 +1003,13 @@
   my %seen = ();
   my $pw;
 
-  my $msgatime = $self->receive_date(scalar $msg->get_all_headers());
+  my $msgatime = $self->receive_date(scalar $msg->get_all_headers(0,1));
+
+  # If the message atime comes back as being more than 1 day in the
+  # future, something's messed up and we should revert to current time as
+  # a safety measure.
+  #
+  $msgatime = time if ( $msgatime - time > 86400 );
 
   my %pw = map {
     if ($seen{$_}) {

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm	Tue Feb 10 09:37:06 2004
@@ -471,8 +471,9 @@
 =cut
 
 sub get_all_headers {
-  my ($self, $raw) = @_;
+  my ($self, $raw, $include_mbox) = @_;
   $raw ||= 0;
+  $include_mbox ||= 0;
 
   my %cache = ();
   my @lines = ();
@@ -481,11 +482,17 @@
     push(@lines, "$_: ".($self->get_header($_,$raw))[$cache{$_}++]);
   }
 
+  splice @lines, 0, 0, $self->{mbox_sep} if ( $include_mbox && exists $self->{mbox_sep} );
+
   if (wantarray) {
     return @lines;
   } else {
     return join ('', @lines);
   }
+}
+
+sub get_mbox_seperator {
+  return $_[0]->{mbox_sep};
 }
 
 =item get_body()

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm	Tue Feb 10 09:37:06 2004
@@ -745,7 +745,8 @@
 
 EOM
   
-  $newmsg = $self->{msg}->{'mbox_sep'} . $newmsg if ( exists $self->{msg}->{'mbox_sep'} );
+  my $mbox = $self->{msg}->get_mbox_seperator();
+  $newmsg = $mbox . $newmsg if ( defined $mbox );
   my @lines = split (/^/m,  $newmsg);
   return Mail::SpamAssassin::MsgParser->parse(\@lines);
 }
@@ -788,7 +789,8 @@
     push(@pristine_headers, "X-Spam-$header: $line\n");
   }
 
-  splice @pristine_headers, 0, 0, $self->{msg}->{'mbox_sep'} if ( exists $self->{msg}->{'mbox_sep'} );
+  my $mbox = $self->{msg}->get_mbox_seperator();
+  splice @pristine_headers, 0, 0, $mbox if ( defined $mbox );
   push(@pristine_headers, "\n", split (/^/m, $self->{msg}->get_pristine_body()));
   return Mail::SpamAssassin::MsgParser->parse(\@pristine_headers);
 }