Author: felicity
Date: Thu Feb 19 21:13:18 2004
New Revision: 6788
Modified:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgNode.pm
incubator/spamassassin/trunk/masses/mass-check
incubator/spamassassin/trunk/spamd/spamd.raw
Log:
we don't need already_parsed since we have toparse. implemented MsgNode::finish() and have things call it to be a good housekeeper.
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm Thu Feb 19 21:13:18 2004
@@ -66,7 +66,6 @@
$self->{pristine_headers} = '';
$self->{pristine_body} = '';
- $self->{already_parsed} = 0;
# # allow callers to set certain options ...
# foreach ( 'already_parsed' ) {
@@ -95,8 +94,7 @@
my($self) = @_;
# If we're called when we don't need to be, then just go ahead and return.
- return if ($self->{'already_parsed'});
-
+ return if (!exists $self->{'toparse'});
my $toparse = $self->{'toparse'};
delete $self->{'toparse'};
@@ -109,7 +107,6 @@
# Make the tree
Mail::SpamAssassin::MsgParser->parse_body( $self, $self, $boundary, $toparse, 1 );
- $self->{'already_parsed'} = 1;
dbg("---- MIME PARSER END ----");
}
@@ -126,7 +123,7 @@
my ($self, $re, $onlyleaves, $recursive) = @_;
# ok, we need to do the parsing now...
- $self->_do_parse() if (!$self->{'already_parsed'});
+ $self->_do_parse() if (exists $self->{'toparse'});
# and pass through to the MsgNode version of the method
return $self->SUPER::find_parts($re, $onlyleaves, $recursive);
@@ -278,7 +275,14 @@
sub finish {
my ($self) = @_;
+
+ # Clean ourself up
$self->finish_metadata();
+ delete $self->{pristine_headers};
+ delete $self->{pristine_body};
+
+ # Destroy the tree ...
+ $self->SUPER::finish();
}
# ---------------------------------------------------------------------------
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgNode.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgNode.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgNode.pm Thu Feb 19 21:13:18 2004
@@ -494,6 +494,24 @@
sub finish {
my ($self) = @_;
+
+ # Clean up ourself
+ undef $self->{'headers'};
+ undef $self->{'raw_headers'};
+ undef $self->{'header_order'};
+ undef $self->{'raw'};
+ undef $self->{'decoded'};
+ undef $self->{'rendered'};
+ undef $self->{'type'};
+ undef $self->{'rendered_type'};
+
+ # Clean up our kids
+ if (exists $self->{'body_parts'}) {
+ while ( my $part = shift @{$self->{'body_parts'}} ) {
+ $part->finish();
+ }
+ undef $self->{'body_parts'};
+ }
}
# ---------------------------------------------------------------------------
Modified: incubator/spamassassin/trunk/masses/mass-check
==============================================================================
--- incubator/spamassassin/trunk/masses/mass-check (original)
+++ incubator/spamassassin/trunk/masses/mass-check Thu Feb 19 21:13:18 2004
@@ -309,6 +309,7 @@
}
$status->finish();
+ $ma->finish();
undef $ma; # clean 'em up
undef $status;
Modified: incubator/spamassassin/trunk/spamd/spamd.raw
==============================================================================
--- incubator/spamassassin/trunk/spamd/spamd.raw (original)
+++ incubator/spamassassin/trunk/spamd/spamd.raw Thu Feb 19 21:13:18 2004
@@ -916,6 +916,7 @@
sprintf("%.1f", time - $start) ." seconds, $actual_length bytes.";
$status->finish(); # added by jm to allow GC'ing
+ $mail->finish();
}
###########################################################################
Date: Thu Feb 19 21:13:18 2004
New Revision: 6788
Modified:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgNode.pm
incubator/spamassassin/trunk/masses/mass-check
incubator/spamassassin/trunk/spamd/spamd.raw
Log:
we don't need already_parsed since we have toparse. implemented MsgNode::finish() and have things call it to be a good housekeeper.
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm Thu Feb 19 21:13:18 2004
@@ -66,7 +66,6 @@
$self->{pristine_headers} = '';
$self->{pristine_body} = '';
- $self->{already_parsed} = 0;
# # allow callers to set certain options ...
# foreach ( 'already_parsed' ) {
@@ -95,8 +94,7 @@
my($self) = @_;
# If we're called when we don't need to be, then just go ahead and return.
- return if ($self->{'already_parsed'});
-
+ return if (!exists $self->{'toparse'});
my $toparse = $self->{'toparse'};
delete $self->{'toparse'};
@@ -109,7 +107,6 @@
# Make the tree
Mail::SpamAssassin::MsgParser->parse_body( $self, $self, $boundary, $toparse, 1 );
- $self->{'already_parsed'} = 1;
dbg("---- MIME PARSER END ----");
}
@@ -126,7 +123,7 @@
my ($self, $re, $onlyleaves, $recursive) = @_;
# ok, we need to do the parsing now...
- $self->_do_parse() if (!$self->{'already_parsed'});
+ $self->_do_parse() if (exists $self->{'toparse'});
# and pass through to the MsgNode version of the method
return $self->SUPER::find_parts($re, $onlyleaves, $recursive);
@@ -278,7 +275,14 @@
sub finish {
my ($self) = @_;
+
+ # Clean ourself up
$self->finish_metadata();
+ delete $self->{pristine_headers};
+ delete $self->{pristine_body};
+
+ # Destroy the tree ...
+ $self->SUPER::finish();
}
# ---------------------------------------------------------------------------
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgNode.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgNode.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgNode.pm Thu Feb 19 21:13:18 2004
@@ -494,6 +494,24 @@
sub finish {
my ($self) = @_;
+
+ # Clean up ourself
+ undef $self->{'headers'};
+ undef $self->{'raw_headers'};
+ undef $self->{'header_order'};
+ undef $self->{'raw'};
+ undef $self->{'decoded'};
+ undef $self->{'rendered'};
+ undef $self->{'type'};
+ undef $self->{'rendered_type'};
+
+ # Clean up our kids
+ if (exists $self->{'body_parts'}) {
+ while ( my $part = shift @{$self->{'body_parts'}} ) {
+ $part->finish();
+ }
+ undef $self->{'body_parts'};
+ }
}
# ---------------------------------------------------------------------------
Modified: incubator/spamassassin/trunk/masses/mass-check
==============================================================================
--- incubator/spamassassin/trunk/masses/mass-check (original)
+++ incubator/spamassassin/trunk/masses/mass-check Thu Feb 19 21:13:18 2004
@@ -309,6 +309,7 @@
}
$status->finish();
+ $ma->finish();
undef $ma; # clean 'em up
undef $status;
Modified: incubator/spamassassin/trunk/spamd/spamd.raw
==============================================================================
--- incubator/spamassassin/trunk/spamd/spamd.raw (original)
+++ incubator/spamassassin/trunk/spamd/spamd.raw Thu Feb 19 21:13:18 2004
@@ -916,6 +916,7 @@
sprintf("%.1f", time - $start) ." seconds, $actual_length bytes.";
$status->finish(); # added by jm to allow GC'ing
+ $mail->finish();
}
###########################################################################