|
From: <ssc...@us...> - 2003-06-24 03:28:36
|
Update of /cvsroot/popfile/engine/UI
In directory sc8-pr-cvs1:/tmp/cvs-serv25497
Modified Files:
HTML.pm
Log Message:
make message downloading more efficient
by indexing files based on POP3 parameter
moved .cls file handling to Bayes.pm
Index: HTML.pm
===================================================================
RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v
retrieving revision 1.170
retrieving revision 1.171
diff -C2 -d -r1.170 -r1.171
*** HTML.pm 17 Jun 2003 17:21:38 -0000 1.170
--- HTML.pm 24 Jun 2003 03:28:33 -0000 1.171
***************
*** 2406,2410 ****
# function, and then parse the MSG file for the From and Subject information
! my ( $reclassified, $bucket, $usedtobe, $magnet ) = $self->history_load_class( $history_files[$i] );
my $from = '';
my $subject = '';
--- 2406,2410 ----
# function, and then parse the MSG file for the From and Subject information
! my ( $reclassified, $bucket, $usedtobe, $magnet ) = $self->{classifier__}->history_load_class( $history_files[$i] );
my $from = '';
my $subject = '';
***************
*** 2613,2696 ****
}
- # ---------------------------------------------------------------------------------------------
- #
- # history_write_class - write the class file for a message.
- #
- # $filename The name of the message to write the class for
- # $reclassified Boolean, true if the message has been reclassified
- # $bucket the name of the bucket the message is in
- # $usedtobe the name of the bucket the messages used to be in
- # $magnet the magnet, if any, used to reclassify the message
- #
- # ---------------------------------------------------------------------------------------------
- sub history_write_class
- {
- my ( $self, $filename, $reclassified, $bucket, $usedtobe, $magnet ) = @_;
-
- $filename =~ s/msg$/cls/;
-
- open CLASS, '>' . $self->global_config_( 'msgdir' ) . $filename;
-
- if ( defined( $magnet ) && ( $magnet ne '' ) ) {
- print CLASS "$bucket MAGNET $magnet\n";
- } elsif (defined $reclassified && $reclassified == 1) {
- print CLASS "RECLASSIFIED\n";
- print CLASS "$bucket\n";
- if ( defined( $usedtobe ) && ( $usedtobe ne '' ) ) {
- print CLASS "$usedtobe\n";
- }
- } else {
- print CLASS "$bucket\n";
- }
-
- close CLASS;
- }
-
- # ---------------------------------------------------------------------------------------------
- #
- # history_load_class - load the class file for a message.
- #
- # returns: ( reclassified, bucket, usedtobe, magnet )
- # values:
- # reclassified: boolean, true if message has been reclassified
- # bucket: string, the bucket the message is in presently, unknown class if an error occurs
- # usedtobe: string, the bucket the message used to be in (null if not reclassified)
- # magnet: string, the magnet
- #
- # $filename The name of the message to load the class for
- #
- # ---------------------------------------------------------------------------------------------
- sub history_load_class
- {
- my ( $self, $filename ) = @_;
-
- $filename =~ s/msg$/cls/;
-
- my $reclassified = 0;
- my $bucket = "unknown class";
- my $usedtobe;
- my $magnet = '';
-
- if ( open CLASS, '<' . $self->global_config_( 'msgdir' ) . $filename ) {
- $bucket = <CLASS>;
- if ( $bucket =~ /([^ ]+) MAGNET (.+)/ ) {
- $bucket = $1;
- $magnet = $2;
- }
-
- $reclassified = 0;
- if ( $bucket =~ /RECLASSIFIED/ ) {
- $bucket = <CLASS>;
- $usedtobe = <CLASS>;
- $reclassified = 1;
- $usedtobe =~ s/[\r\n]//g;
- }
- close CLASS;
- $bucket =~ s/[\r\n]//g;
- } else {
- $self->log_( "Error: " . $self->global_config_( 'msgdir' ) . "$filename: $!" );
- }
- return ( $reclassified, $bucket, $usedtobe, $magnet );
- }
# ---------------------------------------------------------------------------------------------
--- 2613,2616 ----
***************
*** 2733,2737 ****
# Get the current classification for this message
! my ( $reclassified, $bucket, $usedtobe, $magnet) = $self->history_load_class( $mail_file );
# Only reclassify messages that havn't been reclassified before
--- 2653,2657 ----
# Get the current classification for this message
! my ( $reclassified, $bucket, $usedtobe, $magnet) = $self->{classifier__}->history_load_class( $mail_file );
# Only reclassify messages that havn't been reclassified before
***************
*** 2763,2767 ****
# Update the class file
! $self->history_write_class( $mail_file, 1, $newbucket, ( $bucket || "unclassified" ) , '');
# Since we have just changed the classification of this file and it has
--- 2683,2687 ----
# Update the class file
! $self->{classifier__}->history_load_class( $mail_file, 1, $newbucket, ( $bucket || "unclassified" ) , '');
# Since we have just changed the classification of this file and it has
***************
*** 2798,2802 ****
# Load the class file
! my ( $reclassified, $bucket, $usedtobe, $magnet ) = $self->history_load_class( $mail_file );
# Only undo if the message has been classified...
--- 2718,2722 ----
# Load the class file
! my ( $reclassified, $bucket, $usedtobe, $magnet ) = $self->{classifier__}->history_load_class( $mail_file );
# Only undo if the message has been classified...
***************
*** 2837,2841 ****
# Update the class file
! $self->history_write_class( $mail_file, 0, ( $usedtobe || "unclassified" ), '', '');
# Add message feedback
--- 2757,2761 ----
# Update the class file
! $self->{classifier__}->history_load_class( $mail_file, 0, ( $usedtobe || "unclassified" ), '', '');
# Add message feedback
***************
*** 3611,3615 ****
mkdir( $path );
! my ($reclassified, $bucket, $usedtobe, $magnet) = $self->history_load_class( $mail_file );
if ( ( $bucket ne 'unclassified' ) && ( $bucket ne 'unknown class' ) ) {
--- 3531,3535 ----
mkdir( $path );
! my ($reclassified, $bucket, $usedtobe, $magnet) = $self->{classifier__}->history_load_class( $mail_file );
if ( ( $bucket ne 'unclassified' ) && ( $bucket ne 'unknown class' ) ) {
|