From: <ssc...@us...> - 2003-04-26 09:43:26
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1:/tmp/cvs-serv32380 Modified Files: Bayes.pm Log Message: prevent duplicates, header saving and message over-writing when toptoo is enabled [ 701390 ] -toptoo 1 results in duplicates in history [ 705448 ] Right Classification, Wrong Headers Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** Bayes.pm 26 Apr 2003 04:22:54 -0000 1.137 --- Bayes.pm 26 Apr 2003 09:43:20 -0000 1.138 *************** *** 772,775 **** --- 772,776 ---- # $nosave - indicates that the message downloaded should not be saved in the history # $class - if we already know the classification + # $echo - 1 to echo to the client, 0 to supress, defaults to 1 # # Returns a classification if it worked, otherwise returns an empty string *************** *** 778,782 **** sub classify_and_modify { ! my ( $self, $mail, $client, $dcount, $mcount, $nosave, $class ) = @_; my $msg_subject = ''; # The message subject --- 779,785 ---- sub classify_and_modify { ! my ( $self, $mail, $client, $dcount, $mcount, $nosave, $class, $echo ) = @_; ! ! $echo = 1 unless (defined $echo); my $msg_subject = ''; # The message subject *************** *** 843,859 **** $message_size += length $line; print TEMP $fileline; ! ! if ( $line =~ /^Subject:(.*)/i ) { ! $msg_subject = $1; ! $msg_subject =~ s/(\012|\015)//g; ! next; ! } ! ! # Strip out the X-Text-Classification header that is in an incoming message ! if ( ( $line =~ /^X-Text-Classification:/i ) == 0 ) { ! if ( $msg_subject eq '' ) { ! $msg_head_before .= $line; ! } else { ! $msg_head_after .= $line; } } --- 846,867 ---- $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; ! $msg_subject =~ s/(\012|\015)//g; ! next; ! } ! ! # Strip out the X-Text-Classification header that is in an incoming message ! if ( ( $line =~ /^X-Text-Classification:/i ) == 0 ) { ! if ( $msg_subject eq '' ) { ! $msg_head_before .= $line; ! } else { ! $msg_head_after .= $line; ! } } } *************** *** 871,875 **** # Check to see if too much time has passed and we need to keep the mail client happy if ( time > ( $last_timeout + 2 ) ) { ! print $client "X-POPFile-TimeoutPrevention: $timeout_count$eol" if ( !$nosave ); $timeout_count += 1; $last_timeout = time; --- 879,883 ---- # Check to see if too much time has passed and we need to keep the mail client happy if ( time > ( $last_timeout + 2 ) ) { ! print $client "X-POPFile-TimeoutPrevention: $timeout_count$eol" if ( $echo ); $timeout_count += 1; $last_timeout = time; *************** *** 925,929 **** # Echo the text of the message to the client ! if ( !$nosave ) { # If the bucket is quarantined then we'll treat it specially by changing the message header to contain --- 933,937 ---- # Echo the text of the message to the client ! if ( $echo ) { # If the bucket is quarantined then we'll treat it specially by changing the message header to contain *************** *** 967,979 **** if ( $got_full_body == 0 ) { ! $self->echo_to_dot_( $mail, $client ) if ( !$nosave ); } else { if ( $classification ne 'unclassified' ) { ! if ( $self->{parameters__}{$classification}{quarantine} == 1 ) { print $client "$eol--$temp_file$eol"; ! } } ! print $client ".$eol" if ( !$nosave ); } --- 975,987 ---- if ( $got_full_body == 0 ) { ! $self->echo_to_dot_( $mail, $client ) if ( $echo ); } else { if ( $classification ne 'unclassified' ) { ! if ( ( $self->{parameters__}{$classification}{quarantine} == 1 ) && $echo ) { print $client "$eol--$temp_file$eol"; ! } } ! print $client ".$eol" if ( $echo ); } |