logo       

[SACVS] CVS: spamassassin/lib/Mail/SpamAssassin/MIME Parser.pm,1.1,1.2: msg#00112

mail.spam.spamassassin.cvs

Subject: [SACVS] CVS: spamassassin/lib/Mail/SpamAssassin/MIME Parser.pm,1.1,1.2

Update of /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/MIME
In directory sc8-pr-cvs1:/tmp/cvs-serv2876/lib/Mail/SpamAssassin/MIME

Modified Files:
Parser.pm
Log Message:
a few updates for MIME parsing


Index: Parser.pm
===================================================================
RCS file:
/cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/MIME/Parser.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -w -u -d -r1.1 -r1.2
--- Parser.pm 24 Sep 2003 06:18:38 -0000 1.1
+++ Parser.pm 24 Sep 2003 19:30:32 -0000 1.2
@@ -373,13 +373,13 @@

sub decode_attachment {
my $class = shift;
- my ( $msg, $part_msg, $boundary, $fh ) = @_;
+ my ( $msg, $part_msg, $boundary, $body ) = @_;

debug("decoding attachment\n");

- my ( $type, $content, $filename ) = $class->decode( $part_msg, $fh );
+ my ( $type, $content, $filename ) = $class->decode( $part_msg, $body );

- $msg->add_attachment( $type, $content, $filename, $boundary );
+ $msg->add_attachment( $type, $content, $filename, $body, $boundary );
}

sub decode {
@@ -405,7 +405,7 @@
if ( lc( $msg->header('content-transfer-encoding') ) eq 'quoted-printable' )
{
debug("decoding QP file\n");
my @output =
- split ( /^/m, MIME::Base64::decode_qp( join ( "", @{$body} ) ) );
+ split ( /^/m, MIME::QuotedPrint::decode_qp( join ( "", @{$body} ) ) );

my $type = $msg->header('content-type');
my ($filename) =
@@ -418,17 +418,19 @@
}
elsif ( lc( $msg->header('content-transfer-encoding') ) eq 'base64' ) {
debug("decoding B64 file\n");
- my @output =
- split ( /^/m, MIME::Base64::decode_base64( join ( "", @{$body} ) ) );
+ my $output = [ MIME::Base64::decode_base64( join ( "", @{$body} ) ) ];

my $type = $msg->header('content-type');
my ($filename) =
( $msg->header('content-disposition') =~ /name="?([^\";]+)"?/i );
if ( !$filename ) {
- ($filename) = ( $msg->header('content-type') =~ /name="?([^\";]+)"?/i );
+ ($filename) = ( $type =~ /name="?([^\";]+)"?/i );
}

- return $type, \@output, $filename;
+ # If it's a type text or message, split it into an array of lines
+ $output = [ split(/^/m, $output->[0]) ] if ( $type =~
m@^(?:text|message)/@ );
+
+ return $type, $output, $filename;
}
else {
debug("decoding other encoding\n");



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise