You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2004/02/03 01:30:32 UTC
svn commit: rev 6436 - incubator/spamassassin/trunk/lib/Mail/SpamAssassin
Author: felicity
Date: Mon Feb 2 16:30:30 2004
New Revision: 6436
Modified:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm
Log:
don't need MsgContainer::as_string() anymore. instead of rendering as HTML any text* attachment, only do 'text' and 'text/plain'. fixes some FPs for MPART_ALT_DIFF, etc.
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm Mon Feb 2 16:30:30 2004
@@ -3605,11 +3605,13 @@
if ( $type eq 'text/html' ) {
foreach my $w ( grep(/\w/,split(/\s+/,$rnd)) ) {
next if ( $w =~ /^URI:/ );
+ #dbg("HTML: $w");
$html{$w}++;
}
}
else {
foreach my $w ( grep(/\w/,split(/\s+/,$rnd)) ) {
+ #dbg("TEXT: $w");
$text{$w}++;
}
}
@@ -3621,6 +3623,8 @@
while( my($k,$v) = each %text ) {
delete $html{$k} if ( exists $html{$k} && $html{$k}-$text{$k} < 1 );
}
+
+ #map { dbg("LEFT: $_") } keys %html;
my $diff = scalar(keys %html)/$orig*100;
$self->{madiff} = $diff if ( $diff > $self->{madiff} );
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm Mon Feb 2 16:30:30 2004
@@ -265,10 +265,12 @@
my $text = $self->decode();
my $raw = length($text);
- # render text/html always, or any other text part as text/html based
+ # render text/html always, or any other text|text/plain part as text/html based
# on a heuristic which simulates a certain common mail client
- if ( $raw > 0 && ($self->{'type'} =~ m@^text/html\b@i ||
- ($text =~ m/^(.{0,18}?<(?:$Mail::SpamAssassin::HTML::re_start)(?:\s.{0,18}?)?>)/ois &&
+ if ( $raw > 0 && (
+ $self->{'type'} =~ m@^text/html\b@i || (
+ $self->{'type'} =~ m@^text(?:$|/plain)@i &&
+ $text =~ m/^(.{0,18}?<(?:$Mail::SpamAssassin::HTML::re_start)(?:\s.{0,18}?)?>)/ois &&
_html_near_start($1))
)
) {
@@ -491,15 +493,6 @@
sub get_pristine_body {
my ($self) = @_;
return $self->{pristine_body};
-}
-
-=item as_string()
-
-=cut
-
-sub as_string {
- my ($self) = @_;
- return $self->get_all_headers(1) . "\n" . $self->{pristine_body};
}
=item ignore()