From: <ssc...@us...> - 2003-04-27 21:05:05
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1:/tmp/cvs-serv11074 Modified Files: Tag: v0/18/1 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 [ 694002 ] email scored as spam but classified as real Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.107.2.4 retrieving revision 1.107.2.5 diff -C2 -d -r1.107.2.4 -r1.107.2.5 *** Bayes.pm 19 Apr 2003 11:53:55 -0000 1.107.2.4 --- Bayes.pm 27 Apr 2003 21:05:00 -0000 1.107.2.5 *************** *** 754,757 **** --- 754,758 ---- # $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 *************** *** 760,764 **** sub classify_and_modify { ! my ( $self, $mail, $client, $dcount, $mcount, $nosave, $class ) = @_; my $msg_subject = ''; # The message subject --- 761,767 ---- sub classify_and_modify { ! my ( $self, $mail, $client, $dcount, $mcount, $nosave, $class, $echo ) = @_; ! ! $echo = 1 unless (defined $echo); my $msg_subject = ''; # The message subject *************** *** 829,845 **** $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; } } --- 832,852 ---- $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; ! } } } *************** *** 857,861 **** # 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; --- 864,868 ---- # 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; *************** *** 911,915 **** # 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 --- 918,922 ---- # 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 *************** *** 947,956 **** print $client $msg_head_after; print $client $msg_body; - } ! if ( $got_full_body == 0 ) { ! echo_to_dot( $self, $mail, $client ) if ( !$nosave ); ! } else { ! print $client ".$eol" if ( !$nosave ); } --- 954,963 ---- print $client $msg_head_after; print $client $msg_body; ! if ( $got_full_body == 0 ) { ! echo_to_dot( $self, $mail, $client ); ! } else { ! print $client ".$eol"; ! } } |