Changeset 130

Show
Ignore:
Timestamp:
27.05.2007 14:11:29 (1 year ago)
Author:
decoder
Message:

Bugfixes: Removed warnings about Exporter.pm

SA 3.2 Compatiblity for descriptions

Problems: Formatting of descriptions b0rked...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/devel/FuzzyOcr.pm

    r128 r130  
    88use strict; 
    99use warnings; 
     10use POSIX; 
     11use Fcntl ':flock'; 
    1012use Mail::SpamAssassin; 
    1113use Mail::SpamAssassin::Logger; 
     
    1719use String::Approx 'adistr'; 
    1820use FileHandle; 
    19 use Fcntl ':flock'; 
    20 use POSIX; 
    2121 
    2222use lib qw(/etc/mail/spamassassin); # Allow placing of FuzzyOcr in siteconfigdir 
     
    902902    } else { 
    903903        my $score = '0.000'; 
    904         my $debuginfo = ( 
    905               "Words found:\n" 
    906             . join( "\n", @found ) 
    907             . "\n($cnt word occurrences found)" ); 
     904        my $debuginfo = ("Words found:\n".join( "\n", @found )."\n($cnt word occurrences found)" ); 
    908905        if ($cnt >= $conf->{focr_counts_required}) { 
    909906            $score = sprintf "%0.3f", $conf->{focr_base_score} + 
     
    932929            $pms->{conf}->{scoreset}->[$set]->{"FUZZY_OCR"} = $score; 
    933930        } 
    934         $pms->_handle_hit( "FUZZY_OCR", $score, "BODY: ", 
    935             $pms->{conf}->{descriptions}->{FUZZY_OCR} . "\n$debuginfo" ); 
     931        $pms->_handle_hit( "FUZZY_OCR", $score, "BODY: ", "BODY",  
     932            $pms->{conf}->get_description_for_rule("FUZZY_OCR") . "\n$debuginfo" ); 
    936933    } 
    937934    if ($imgerr == 0 and $conf->{focr_keep_bad_images}<2) { 
  • trunk/devel/FuzzyOcr/Misc.pm

    r122 r130  
    99use FuzzyOcr::Logging qw(debuglog errorlog warnlog infolog); 
    1010use Time::HiRes qw( gettimeofday tv_interval ); 
    11 use POSIX qw(WIFEXITED WIFSIGNALED WIFSTOPPED WEXITSTATUS WTERMSIG WSTOPSIG 
    12              O_RDONLY O_WRONLY O_RDWR O_APPEND O_CREAT O_EXCL); 
     11use POSIX qw(WIFEXITED WIFSIGNALED WIFSTOPPED WEXITSTATUS WTERMSIG WSTOPSIG); 
    1312 
    1413# Provide some misc helper functions 
     
    7170  my($flags) = 0; my($mode) = 0640; 
    7271  $fname =~ s/^< *//; 
    73   $fname =~ s/^>> *// and $flags |= O_CREAT|O_WRONLY|O_APPEND; 
    74   $fname =~ s/^> *//  and $flags |= O_CREAT|O_WRONLY; 
     72  $fname =~ s/^>> *// and $flags |= POSIX::O_CREAT|POSIX::O_WRONLY|POSIX::O_APPEND; 
     73  $fname =~ s/^> *//  and $flags |= POSIX::O_CREAT|POSIX::O_WRONLY; 
    7574  POSIX::close($fd_target);  # ignore error, we may have just closed a log 
    7675  my($fd_got) = POSIX::open($fname,$flags,$mode); 
  • trunk/devel/FuzzyOcr/Scoring.pm

    r80 r130  
    2727        } 
    2828        $pms->_handle_hit( "FUZZY_OCR_WRONG_CTYPE", 
    29             $conf->{'focr_wrongctype_score'}, "BODY: ", 
    30             $pms->{conf}->{descriptions}->{FUZZY_OCR_WRONG_CTYPE} . "\n$debuginfo" ); 
     29            $conf->{'focr_wrongctype_score'}, "BODY: ", "BODY", 
     30           $pms->{conf}->get_description_for_rule("FUZZY_OCR_WRONG_CTYPE") . "\n$debuginfo" ); 
    3131    } 
    3232} 
     
    4848        } 
    4949        $pms->_handle_hit( "FUZZY_OCR_WRONG_EXTENSION", 
    50             $conf->{'focr_wrongext_score'}, "BODY: ", 
    51             $pms->{conf}->{descriptions}->{FUZZY_OCR_WRONG_EXTENSION} . "\n$debuginfo" ); 
     50            $conf->{'focr_wrongext_score'}, "BODY: ", "BODY", 
     51            $pms->{conf}->get_description_for_rule("FUZZY_OCR_WRONG_EXTENSION") . "\n$debuginfo" ); 
    5252    } 
    5353} 
     
    6868            $pms->{conf}->{scoreset}->[$set]->{"FUZZY_OCR_CORRUPT_IMG"} = $ws; 
    6969        } 
    70         $pms->_handle_hit( "FUZZY_OCR_CORRUPT_IMG", $score, "BODY: ", 
    71             $pms->{conf}->{descriptions}->{FUZZY_OCR_CORRUPT_IMG} . "\n$debuginfo" ); 
     70        $pms->_handle_hit( "FUZZY_OCR_CORRUPT_IMG", $score, "BODY: ", "BODY", 
     71            $pms->{conf}->get_description_for_rule("FUZZY_OCR_CORRUPT_IMG") . "\n$debuginfo" ); 
    7272    } 
    7373} 
     
    8282        $pms->{conf}->{scoreset}->[$set]->{"FUZZY_OCR_KNOWN_HASH"} = $ws; 
    8383    } 
    84     $pms->_handle_hit( "FUZZY_OCR_KNOWN_HASH", $score, "BODY: ", 
    85         $pms->{conf}->{descriptions}->{FUZZY_OCR_KNOWN_HASH} . $dinfo ); 
     84    $pms->_handle_hit( "FUZZY_OCR_KNOWN_HASH", $score, "BODY: ", "BODY", 
     85        $pms->{conf}->get_description_for_rule("FUZZY_OCR_KNOWN_HASH") . $dinfo ); 
    8686} 
    8787