|
From: <jgr...@us...> - 2003-07-26 22:53:27
|
Update of /cvsroot/popfile/engine/Classifier
In directory sc8-pr-cvs1:/tmp/cvs-serv29488/Classifier
Modified Files:
MailParse.pm
Log Message:
Completed test suite for MailParse, now have 100% coverage; fixed some bugs and removed dead code
Index: MailParse.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/MailParse.pm,v
retrieving revision 1.152
retrieving revision 1.153
diff -C2 -d -r1.152 -r1.153
*** MailParse.pm 26 Jul 2003 21:46:59 -0000 1.152
--- MailParse.pm 26 Jul 2003 22:53:24 -0000 1.153
***************
*** 1122,1126 ****
}
! $self->{ut__} .= splitline($line, $self->{encoding__});
}
--- 1122,1126 ----
}
! $self->{ut__} .= $self->splitline($line, $self->{encoding__});
}
***************
*** 1142,1146 ****
$self->{argument__} = '';
! $self->{ut__} .= splitline( "\015\012", 0 );
$self->{in_headers__} = 0;
--- 1142,1146 ----
$self->{argument__} = '';
! $self->{ut__} .= $self->splitline( "\015\012", 0 );
$self->{in_headers__} = 0;
***************
*** 1150,1154 ****
}
-
# If we have an email header then just keep the part after the :
--- 1150,1153 ----
***************
*** 1182,1190 ****
$self->{encoding__} = '';
! if (!defined $2) {
print "Hit MIME boundary --$1\n" if $self->{debug__};
$self->{in_headers__} = 1;
} else {
$self->{in_headers__} = 0;
--- 1181,1197 ----
$self->{encoding__} = '';
! if ( !defined( $2 ) ) {
!
! # This means there was no trailing -- on the mime boundary (which would
! # have indicated the end of a boundary, so now we have a new part of the
! # document, hence we need to look for new headers
!
print "Hit MIME boundary --$1\n" if $self->{debug__};
+
$self->{in_headers__} = 1;
} else {
+ # A boundary was just terminated
+
$self->{in_headers__} = 0;
***************
*** 1193,1205 ****
print "Hit MIME boundary terminator --$1--\n" if $self->{debug__};
! # escape to match escaped boundary characters
$boundary =~ s/(.*)/\Q$1\E/g;
! my $temp_mime;
foreach my $aboundary (split(/\|/,$self->{mime__})) {
if ($boundary ne $aboundary) {
! if (defined $temp_mime) {
$temp_mime = join('|', $temp_mime, $aboundary);
} else {
--- 1200,1216 ----
print "Hit MIME boundary terminator --$1--\n" if $self->{debug__};
! # Escape to match escaped boundary characters
$boundary =~ s/(.*)/\Q$1\E/g;
! # Remove the boundary we just found from the boundary list. The list
! # is stored in $self->{mime__} and consists of mime boundaries separated
! # by the alternation characters | for use within a regexp
!
! my $temp_mime = '';
foreach my $aboundary (split(/\|/,$self->{mime__})) {
if ($boundary ne $aboundary) {
! if ( $temp_mime ne '' ) {
$temp_mime = join('|', $temp_mime, $aboundary);
} else {
***************
*** 1209,1216 ****
}
! $self->{mime__} = ($temp_mime || '');
print "MIME boundary list now $self->{mime__}\n" if $self->{debug__};
- $self->{in_headers__} = 0;
}
--- 1220,1226 ----
}
! $self->{mime__} = $temp_mime;
print "MIME boundary list now $self->{mime__}\n" if $self->{debug__};
}
***************
*** 1218,1230 ****
}
- # If we are still in the headers then make sure that we are on a line with whitespace
- # at the start
-
- if ( $self->{in_headers__} ) {
- if ( $line =~ /^[ \t\r\n]/ ) {
- next;
- }
- }
-
# If we are doing base64 decoding then look for suitable lines and remove them
# for decoding
--- 1228,1231 ----
***************
*** 1240,1249 ****
next if ( !defined($line) );
- # Look for =?foo? syntax that identifies a charset
-
- if ( $line =~ /=\?([^ ]{1,40})\?/ ) {
- update_word( $self, $1, 0, '', '', 'charset' );
- }
-
# Decode quoted-printable
--- 1241,1244 ----
***************
*** 1414,1421 ****
$argument = $self->decode_string( $argument );
- if ( $argument =~ /=\?([^ ]{1,40})\?/ ) {
- update_word( $self, $1, 0, '', '', 'charset' );
- }
-
if ( $header =~ /^From$/i ) {
$self->{from__} = $argument if ( $self->{from__} eq '' ) ;
--- 1409,1412 ----
***************
*** 1528,1532 ****
sub splitline
{
! my ($line, $encoding) = @_;
$line =~ s/([^\r\n]{100,120} )/$1\r\n/g;
--- 1519,1523 ----
sub splitline
{
! my ( $self, $line, $encoding) = @_;
$line =~ s/([^\r\n]{100,120} )/$1\r\n/g;
|