Ticket #143: 0001-Add-configuration-parameter-xtc_header-which-specifi.patch

File 0001-Add-configuration-parameter-xtc_header-which-specifi.patch, 2.5 kB (added by saragus, 2 years ago)

Patch implementing the discussed feature (against SVN of the day)

  • a/Classifier/Bayes.pm

    old new  
    271271 
    272272    $self->config_( 'subject_mod_pos',  1 ); 
    273273 
     274    # Sets the string used as a key for the added text classification header 
     275 
     276    $self->config_( 'xtc_header', 'X-Text-Classification'); 
     277 
    274278    # Get the hostname for use in the X-POPFile-Link header 
    275279 
    276280    $self->{hostname__} = hostname; 
     
    29252929                    # Strip out the X-Text-Classification header that 
    29262930                    # is in an incoming message 
    29272931 
    2928                     next if ( $line =~ /^X-Text-Classification:/i ); 
     2932                    my $xtc_header = $self->config_("xtc_header"); 
     2933                    next if ( $line =~ /^$xtc_header:/i ); 
    29292934                    next if ( $line =~ /^X-POPFile-Link:/i ); 
    29302935 
    29312936                    # Store any lines that appear as though they may 
     
    30373042    $msg_head_after =~ s/\015\z/$crlf/; 
    30383043 
    30393044    # Add the XTC header 
    3040  
     3045    my $xtc_header = $self->config_("xtc_header"); 
    30413046    if ( ( $xtc_insertion ) && ( !$quarantine ) ) { 
    3042         $msg_head_after .= "X-Text-Classification: $classification$crlf"; 
     3047        $msg_head_after .= "$xtc_header: $classification$crlf"; 
    30433048    } 
    30443049 
    30453050    # Add the XPL header 
     
    30883093           print $client "To: $encoded_to$crlf"; 
    30893094           print $client "Date: " . $self->{parser__}->get_header( 'date' ) . "$crlf"; 
    30903095           print $client "Subject:$msg_subject$crlf" if ( defined( $msg_subject ) ); 
    3091            print $client "X-Text-Classification: $classification$crlf" if ( $xtc_insertion ); 
     3096           print $client "$xtc_header: $classification$crlf" if ( $xtc_insertion ); 
    30923097           print $client "X-POPFile-Link: $xpl$crlf" if ( $xpl_insertion ); 
    30933098           print $client "MIME-Version: 1.0$crlf"; 
    30943099           print $client "Content-Type: multipart/report; boundary=\"$slot\"$crlf$crlf--$slot$crlf";