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 2005/05/06 21:07:45 UTC
svn commit: r168638 - in /spamassassin/trunk:
lib/Mail/SpamAssassin/Message.pm lib/Mail/SpamAssassin/Message/Node.pm
t/mimeparse.t
Author: felicity
Date: Fri May 6 12:07:44 2005
New Revision: 168638
URL: http://svn.apache.org/viewcvs?rev=168638&view=rev
Log:
bug 4103: more work on multi-level message/* attachments
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm
spamassassin/trunk/t/mimeparse.t
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm?rev=168638&r1=168637&r2=168638&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm Fri May 6 12:07:44 2005
@@ -78,6 +78,9 @@
C<spamassassin -d>, which only needs the pristine header and body which
is always handled when the object is created.
+C<subparse> specifies how many levels of message/* attachment should be parsed
+into a subtree. Defaults to 1.
+
=cut
# month mappings (ripped from Util.pm)
@@ -109,7 +112,7 @@
# Specifies whether or not to parse message/rfc822 parts into its own tree.
# If the # > 0, it'll subparse, otherwise it won't. By default, do one
# level deep.
- my $subparse = defined $opts->{'subparse'} ? $opts->{'subparse'} : 1;
+ $self->{subparse} = defined $opts->{'subparse'} ? $opts->{'subparse'} : 1;
# protect it from abuse ...
local $_;
@@ -616,7 +619,8 @@
# Else, there's no boundary, so leave the whole part...
}
- my $part_msg = Mail::SpamAssassin::Message::Node->new(); # prepare a new tree node
+ # prepare a new tree node
+ my $part_msg = Mail::SpamAssassin::Message::Node->new({ subparse=>$msg->{subparse} });
my $in_body = 0;
my $header;
my $part_array;
@@ -663,7 +667,7 @@
# make sure we start with a new clean node
$in_body = 0;
- $part_msg = Mail::SpamAssassin::Message::Node->new();
+ $part_msg = Mail::SpamAssassin::Message::Node->new({ subparse=>$msg->{subparse} });
undef $part_array;
undef $header;
@@ -750,7 +754,11 @@
my $message = $part_msg->decode();
if ($message) {
- my $msg_obj = Mail::SpamAssassin::Message->new({message=>$message, parsenow=>1, subparse=>$msg->{subparse}-1});
+ my $msg_obj = Mail::SpamAssassin::Message->new({
+ message => $message,
+ parsenow => 1,
+ subparse => $msg->{subparse}-1,
+ });
# main message is a message/* part ...
if ($msg == $part_msg) {
@@ -767,6 +775,10 @@
return;
}
+ }
+ else {
+ # leaves don't need the subparse value, so get rid of it
+ delete $part_msg->{subparse};
}
# Add the new part as a child to the parent
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm?rev=168638&r1=168637&r2=168638&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm Fri May 6 12:07:44 2005
@@ -60,6 +60,12 @@
header_order => []
};
+ # deal with any parameters
+ my($opts) = @_;
+ if (defined $opts->{'subparse'}) {
+ $self->{subparse} = $opts->{'subparse'};
+ }
+
bless($self,$class);
$self;
}
Modified: spamassassin/trunk/t/mimeparse.t
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/t/mimeparse.t?rev=168638&r1=168637&r2=168638&view=diff
==============================================================================
--- spamassassin/trunk/t/mimeparse.t (original)
+++ spamassassin/trunk/t/mimeparse.t Fri May 6 12:07:44 2005
@@ -55,7 +55,7 @@
],
"$prefix/t/data/nice/mime8" => [
- join("\n",'multipart/mixed','application/postscript','binary','message/rfc822,multipart/mixed,text/plain,multipart/parallel,image/gif,audio/basic,application/atomicmail,message/rfc822,audio/x-sun'),
+ join("\n",'multipart/mixed','application/postscript','binary','message/rfc822,multipart/mixed,text/plain,multipart/parallel,image/gif,audio/basic,application/atomicmail,message/rfc822'),
'07fdde1c24f216b05813f6a1ae0c7c1c0f84c42b',
'03e5acb518e8aca0b3a7b18f2d94b5efe73495b2'
],
@@ -79,11 +79,8 @@
],
"$prefix/t/data/nice/mime9" => [
- join("\n",'multipart/mixed','text/plain','message/rfc822,message/rfc822,multipart/mixed,multipart/alternative,text/plain,text/html,image/jpeg'),
+ join("\n",'multipart/mixed','text/plain','message/rfc822,message/rfc822'),
'5cdcabdb89c5fbb3a5e0c0473599668927045d9c',
- 'f80584aff917e03d54663422918b58e4689cf993',
- '0228600472b0820b3b326d9d7842eef3af811cb2',
- '0b9fb462ad496d926ef65db0da8da451d7815ab6',
],
);