From: <jgr...@us...> - 2003-03-03 23:14:47
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1:/tmp/cvs-serv22945/UI Modified Files: HTML.pm Log Message: Got to the point where the absolute basics are working; i.e. if you have a POPFile setup already then you can download and get your mail classified; don't expect statistics, history or reclassification to behave yet, but we are getting closer; also MailParse and Bayes are still messing around inside each others private variables Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** HTML.pm 3 Mar 2003 22:01:36 -0000 1.100 --- HTML.pm 3 Mar 2003 23:14:44 -0000 1.101 *************** *** 59,63 **** # # The history hash contains information about ALL the files stored in the history ! # folder (by default messages/) and is updated by the load_history_cache method # # Access to the history cache is formatted $self->{history}{file}{subkey} where --- 59,63 ---- # # The history hash contains information about ALL the files stored in the history ! # folder (by default messages/) and is updated by the load_history_cache__ method # # Access to the history cache is formatted $self->{history}{file}{subkey} where *************** *** 66,70 **** # The subkeys are # ! # cull Used internally by load_history_cache (see there for details) # from The address the email was from # short_from Version of from with max 40 characters --- 66,70 ---- # The subkeys are # ! # cull Used internally by load_history_cache__ (see there for details) # from The address the email was from # short_from Version of from with max 40 characters *************** *** 81,85 **** # # history_invalid is set to cause the history cache to be reloaded by a call to ! # load_history_cache, and is set by a call to invalidate_history_cache $self->{history__} = {}; --- 81,85 ---- # # history_invalid is set to cause the history cache to be reloaded by a call to ! # load_history_cache__, and is set by a call to invalidate_history_cache $self->{history__} = {}; *************** *** 134,138 **** # The default location for the message files ! $self->config_( 'msgdir', 'messages/' ); # Use the default skin --- 134,138 ---- # The default location for the message files ! $self->global_config_( 'msgdir', 'messages/' ); # Use the default skin *************** *** 214,218 **** $self->invalidate_history_cache(); ! $self->load_history_cache(); $self->sort_filter_history( '', '', '' ); --- 214,218 ---- $self->invalidate_history_cache(); ! $self->load_history_cache__(); $self->sort_filter_history( '', '', '' ); *************** *** 2014,2022 **** my $bm; ! if ( $a =~ /popfile(.*)=(.*)\.msg/ ) { $ad = $1; $am = $2; ! if ( $b =~ /popfile(.*)=(.*)\.msg/ ) { $bd = $1; $bm = $2; --- 2014,2022 ---- my $bm; ! if ( $a =~ /popfile(.+)=(.+)\.msg/ ) { $ad = $1; $am = $2; ! if ( $b =~ /popfile(.+)=(.+)\.msg/ ) { $bd = $1; $bm = $2; *************** *** 2118,2122 **** # --------------------------------------------------------------------------------------------- # ! # load_history_cache # # Forces a reload of the history cache from disk. This works by globbing the history --- 2118,2122 ---- # --------------------------------------------------------------------------------------------- # ! # load_history_cache__ # # Forces a reload of the history cache from disk. This works by globbing the history *************** *** 2125,2129 **** # # --------------------------------------------------------------------------------------------- ! sub load_history_cache { my ( $self ) = @_; --- 2125,2129 ---- # # --------------------------------------------------------------------------------------------- ! sub load_history_cache__ { my ( $self ) = @_; *************** *** 2146,2150 **** # for non-culling and new entries that need to be added to the end ! my @history_files = sort compare_mf glob $self->config_( 'msgdir' ) . "popfile*=*.msg"; foreach my $i ( 0 .. $#history_files ) { --- 2146,2150 ---- # for non-culling and new entries that need to be added to the end ! my @history_files = sort compare_mf glob $self->global_config_( 'msgdir' ) . "popfile*=*.msg"; foreach my $i ( 0 .. $#history_files ) { *************** *** 2153,2157 **** # just get the base name of the file that we are dealing with ! $history_files[$i] =~ /(popfile.*\.msg)/; $history_files[$i] = $1; --- 2153,2157 ---- # just get the base name of the file that we are dealing with ! $history_files[$i] =~ /(popfile\d+=\d+\.msg)$/; $history_files[$i] = $1; *************** *** 2170,2174 **** my $subject = ''; ! if ( open MAIL, '<'. $self->config_( 'msgdir' ) . "$history_files[$i]" ) { while ( <MAIL> ) { last if ( /^(\r\n|\r|\n)/ ); --- 2170,2174 ---- my $subject = ''; ! if ( open MAIL, '<'. $self->global_config_( 'msgdir' ) . "$history_files[$i]" ) { while ( <MAIL> ) { last if ( /^(\r\n|\r|\n)/ ); *************** *** 2337,2341 **** $filename =~ s/msg$/cls/; ! open CLASS, '>' . $self->config_( 'msgdir' ) . $filename; if ( defined( $magnet ) && ( $magnet ne '' ) ) { --- 2337,2341 ---- $filename =~ s/msg$/cls/; ! open CLASS, '>' . $self->global_config_( 'msgdir' ) . $filename; if ( defined( $magnet ) && ( $magnet ne '' ) ) { *************** *** 2378,2382 **** my $magnet = ''; ! if ( open CLASS, '<' . $self->config_( 'msgdir' ) . $filename ) { $bucket = <CLASS>; if ( $bucket =~ /([^ ]+) MAGNET (.+)/ ) { --- 2378,2382 ---- my $magnet = ''; ! if ( open CLASS, '<' . $self->global_config_( 'msgdir' ) . $filename ) { $bucket = <CLASS>; if ( $bucket =~ /([^ ]+) MAGNET (.+)/ ) { *************** *** 2395,2399 **** $bucket =~ s/[\r\n]//g; } else { ! print "Error: " . $self->config_( 'msgdir' ) . "$filename: $!\n"; } return ( $reclassified, $bucket, $usedtobe, $magnet ); --- 2395,2399 ---- $bucket =~ s/[\r\n]//g; } else { ! print "Error: " . $self->global_config_( 'msgdir' ) . "$filename: $!\n"; } return ( $reclassified, $bucket, $usedtobe, $magnet ); *************** *** 2475,2479 **** # Parse the messages and tally the word-count ! $self->{classifier__}->{parser}->parse_stream( $self->config_( 'msgdir' ) . "$mail_file" ); foreach my $word (keys %{$self->{classifier__}->{parser}->{words}}) { --- 2475,2479 ---- # Parse the messages and tally the word-count ! $self->{classifier__}->{parser}->parse_stream( $self->global_config_( 'msgdir' ) . "$mail_file" ); foreach my $word (keys %{$self->{classifier__}->{parser}->{words}}) { *************** *** 2568,2572 **** } ! $self->{classifier__}->{parser}->parse_stream($self->config_( 'msgdir' ) . "$mail_file"); # Tally the words --- 2568,2572 ---- } ! $self->{classifier__}->{parser}->parse_stream($self->global_config_( 'msgdir' ) . "$mail_file"); # Tally the words *************** *** 2760,2764 **** # applied. The watch word here is to avoid doing work ! $self->load_history_cache() if ( $self->{history_invalid__} == 1 ); $self->sort_filter_history( $self->{form__}{filter}, $self->{form__}{search}, --- 2760,2764 ---- # applied. The watch word here is to avoid doing work ! $self->load_history_cache__() if ( $self->{history_invalid__} == 1 ); $self->sort_filter_history( $self->{form__}{filter}, $self->{form__}{search}, *************** *** 2963,2967 **** $self->{classifier__}->{parser}->{color} = 1; $self->{classifier__}->{parser}->{bayes} = $self->{classifier__}; ! $body .= $self->{classifier__}->{parser}->parse_stream($self->config_( 'msgdir' ) . "$self->{form__}{view}"); $self->{classifier__}->{parser}->{color} = 0; } else { --- 2963,2967 ---- $self->{classifier__}->{parser}->{color} = 1; $self->{classifier__}->{parser}->{bayes} = $self->{classifier__}; ! $body .= $self->{classifier__}->{parser}->parse_stream($self->global_config_( 'msgdir' ) . "$self->{form__}{view}"); $self->{classifier__}->{parser}->{color} = 0; } else { *************** *** 2971,2975 **** $body .= "<tt>"; ! open MESSAGE, "<$self->config_( 'msgdir' )$self->{form__}{view}"; my $line; # process each line of the message --- 2971,2975 ---- $body .= "<tt>"; ! open MESSAGE, '<' . $self->global_config_( 'msgdir' ) . "$self->{form__}{view}"; my $line; # process each line of the message *************** *** 3009,3013 **** $body .= "<td class=\"top20\" valign=\"top\">\n"; ! $self->{classifier__}->classify_file($self->config_( 'msgdir' ) . "$self->{form__}{view}"); $body .= $self->{classifier__}->{scores}; $body .= "</td>\n</tr>\n"; --- 3009,3013 ---- $body .= "<td class=\"top20\" valign=\"top\">\n"; ! $self->{classifier__}->classify_file($self->global_config_( 'msgdir' ) . "$self->{form__}{view}"); $body .= $self->{classifier__}->{scores}; $body .= "</td>\n</tr>\n"; *************** *** 3188,3192 **** # true if the file exists). ! $self->invalidate_history_cache() if ( !$found && ( -e ($self->config_( 'msgdir' ) . "$file") ) ); $self->http_redirect( $client, "/history?session=$self->{session_key__}&start_message=0&view=$self->{form__}{view}#$self->{form__}{view}" ); return 1; --- 3188,3192 ---- # true if the file exists). ! $self->invalidate_history_cache() if ( !$found && ( -e ($self->global_config_( 'msgdir' ) . "$file") ) ); $self->http_redirect( $client, "/history?session=$self->{session_key__}&start_message=0&view=$self->{form__}{view}#$self->{form__}{view}" ); return 1; *************** *** 3363,3367 **** if ( $self->{today} > $yesterday ) { ! my @mail_files = glob $self->config_( 'msgdir' ) . "popfile*=*.msg"; foreach my $mail_file (@mail_files) { --- 3363,3367 ---- if ( $self->{today} > $yesterday ) { ! my @mail_files = glob $self->global_config_( 'msgdir' ) . "popfile*=*.msg"; foreach my $mail_file (@mail_files) { *************** *** 3375,3379 **** # Clean up old style msg/cls files ! @mail_files = glob $self->config_( 'msgdir' ) . "popfile*_*.???"; foreach my $mail_file (@mail_files) { --- 3375,3379 ---- # Clean up old style msg/cls files ! @mail_files = glob $self->global_config_( 'msgdir' ) . "popfile*_*.???"; foreach my $mail_file (@mail_files) { *************** *** 3433,3437 **** # why this might be unsafe. What does unsafe mean in this context? ! $self->history_copy_file( $self->config_( 'msgdir' ) . "$mail_file", $path, $mail_file ); } } --- 3433,3437 ---- # why this might be unsafe. What does unsafe mean in this context? ! $self->history_copy_file( $self->global_config_( 'msgdir' ) . "$mail_file", $path, $mail_file ); } } *************** *** 3445,3451 **** # the mail message and its associated CLS file ! unlink( $self->config_( 'msgdir' ) . "$mail_file" ); $mail_file =~ s/msg$/cls/; ! unlink( $self->config_( 'msgdir' ) . "$mail_file" ); } --- 3445,3451 ---- # the mail message and its associated CLS file ! unlink( $self->global_config_( 'msgdir' ) . "$mail_file" ); $mail_file =~ s/msg$/cls/; ! unlink( $self->global_config_( 'msgdir' ) . "$mail_file" ); } |