|
From: <ssc...@us...> - 2003-07-02 09:52:10
|
Update of /cvsroot/popfile/engine/Classifier
In directory sc8-pr-cvs1:/tmp/cvs-serv29821
Modified Files:
Tag: v0/18/1
Bayes.pm
Log Message:
fix case where it was possible for messages to terminate without CRLF.CRLF (my fault)
Index: Bayes.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v
retrieving revision 1.107.2.9
retrieving revision 1.107.2.10
diff -C2 -d -r1.107.2.9 -r1.107.2.10
*** Bayes.pm 22 Jun 2003 23:15:32 -0000 1.107.2.9
--- Bayes.pm 2 Jul 2003 09:52:07 -0000 1.107.2.10
***************
*** 350,354 ****
if ( open COLOR, "<$bucket/color" ) {
$color = <COLOR>;
!
# Someone (who shall remain nameless) went in an manually created
# empty color files in their corpus directories which would cause
--- 350,354 ----
if ( open COLOR, "<$bucket/color" ) {
$color = <COLOR>;
!
# Someone (who shall remain nameless) went in an manually created
# empty color files in their corpus directories which would cause
***************
*** 357,361 ****
# with that user and to make POPFile a little safer which is always
# a good thing
!
if ( !defined( $color ) ) {
$color = '';
--- 357,361 ----
# with that user and to make POPFile a little safer which is always
# a good thing
!
if ( !defined( $color ) ) {
$color = '';
***************
*** 387,392 ****
# unclassified will always have the color black, note that unclassified is not
! # actually a bucket
!
$self->{colors}{unclassified} = 'black';
--- 387,392 ----
# unclassified will always have the color black, note that unclassified is not
! # actually a bucket
!
$self->{colors}{unclassified} = 'black';
***************
*** 398,402 ****
$self->{parameters}{unclassified}{quarantine} = 0;
!
print "Corpus loaded with $self->{full_total} entries\n" if $self->{debug};
}
--- 398,402 ----
$self->{parameters}{unclassified}{quarantine} = 0;
!
print "Corpus loaded with $self->{full_total} entries\n" if $self->{debug};
}
***************
*** 440,444 ****
$self->write_parameters();
}
!
# See if there are magnets defined
--- 440,444 ----
$self->write_parameters();
}
!
# See if there are magnets defined
***************
*** 764,768 ****
$echo = 1 unless (defined $echo);
!
my $msg_subject = ''; # The message subject
my $msg_head_before = ''; # Store the message headers that come before Subject here
--- 764,768 ----
$echo = 1 unless (defined $echo);
!
my $msg_subject = ''; # The message subject
my $msg_head_before = ''; # Store the message headers that come before Subject here
***************
*** 804,811 ****
$line = $_;
! # This is done so that we remove the network style end of line CR LF
# and allow Perl to decide on the local system EOL which it will expand
# out of \n when this gets written to the temp file
!
$fileline = $line;
$fileline =~ s/[\r\n]//g;
--- 804,811 ----
$line = $_;
! # This is done so that we remove the network style end of line CR LF
# and allow Perl to decide on the local system EOL which it will expand
# out of \n when this gets written to the temp file
!
$fileline = $line;
$fileline =~ s/[\r\n]//g;
***************
*** 828,840 ****
# Kill header lines containing only whitespace (Exim does this)
! next if ( $line =~ /^[ \t]+(\r\n|\r|\n)$/i );
if ( !( $line =~ /^(\r\n|\r|\n)$/i ) ) {
$message_size += length $line;
print TEMP $fileline;
-
- # If there is no echoing occuring, it doesn't matter what we do to these
! if ($echo) {
if ( $line =~ /^Subject:(.*)/i ) {
$msg_subject = $1;
--- 828,840 ----
# Kill header lines containing only whitespace (Exim does this)
! next if ( $line =~ /^[ \t]+(\r\n|\r|\n)$/i );
if ( !( $line =~ /^(\r\n|\r|\n)$/i ) ) {
$message_size += length $line;
print TEMP $fileline;
! # If there is no echoing occuring, it doesn't matter what we do to these
!
! if ($echo) {
if ( $line =~ /^Subject:(.*)/i ) {
$msg_subject = $1;
***************
*** 845,849 ****
# Strip out the X-Text-Classification header that is in an incoming message
next if ( $line =~ /^X-Text-Classification:/i );
!
if ( $line =~ /(^[ \t])|([:])/ ) {
if ( $msg_subject eq '' ) {
--- 845,849 ----
# Strip out the X-Text-Classification header that is in an incoming message
next if ( $line =~ /^X-Text-Classification:/i );
!
if ( $line =~ /(^[ \t])|([:])/ ) {
if ( $msg_subject eq '' ) {
***************
*** 857,861 ****
$msg_head_q .= $line;
! }
}
} else {
--- 857,861 ----
$msg_head_q .= $line;
! }
}
} else {
***************
*** 885,894 ****
# an email of that type
$classification = ($class ne '')?$class:$self->classify_file($temp_file);
!
# Add the Subject line modification or the original line back again
if ( $classification ne 'unclassified' ) {
if ( $self->{configuration}->{configuration}{subject} ) {
# Don't add the classification unless it is not present
! if ( !( $msg_subject =~ /\[\Q$classification\E\]/ ) &&
( $self->{parameters}{$classification}{subject} == 1 ) &&
( $self->{parameters}{$classification}{quarantine} == 0 ) ) {
--- 885,894 ----
# an email of that type
$classification = ($class ne '')?$class:$self->classify_file($temp_file);
!
# Add the Subject line modification or the original line back again
if ( $classification ne 'unclassified' ) {
if ( $self->{configuration}->{configuration}{subject} ) {
# Don't add the classification unless it is not present
! if ( !( $msg_subject =~ /\[\Q$classification\E\]/ ) &&
( $self->{parameters}{$classification}{subject} == 1 ) &&
( $self->{parameters}{$classification}{quarantine} == 0 ) ) {
***************
*** 938,942 ****
if ( $self->{configuration}->{configuration}{subject} ) {
# Don't add the classification unless it is not present
! if ( !( $msg_subject =~ /\[\Q$classification\E\]/ ) &&
( $self->{parameters}{$classification}{subject} == 1 ) ) {
$msg_subject = " [$classification]$msg_subject";
--- 938,942 ----
if ( $self->{configuration}->{configuration}{subject} ) {
# Don't add the classification unless it is not present
! if ( !( $msg_subject =~ /\[\Q$classification\E\]/ ) &&
( $self->{parameters}{$classification}{subject} == 1 ) ) {
$msg_subject = " [$classification]$msg_subject";
***************
*** 961,965 ****
print $client $msg_head_before;
print $client $msg_head_after;
! print $client $msg_body;
}
--- 961,965 ----
print $client $msg_head_before;
print $client $msg_head_after;
! print $client $msg_body;
}
***************
*** 967,977 ****
if ($echo) {
$self->echo_to_dot( $mail, $client );
! } else {
$self->echo_to_dot( $mail, undef);
}
} else {
! print $client ".$eol" if ( $echo );
}
!
if ( !$nosave ) {
--- 967,977 ----
if ($echo) {
$self->echo_to_dot( $mail, $client );
! } else {
$self->echo_to_dot( $mail, undef);
}
} else {
! print $client "$eol.$eol" if ( $echo );
}
!
if ( !$nosave ) {
|