Changeset 3627


Ignore:
Timestamp:
2002-12-09T14:52:41+13:00 (21 years ago)
Author:
jrm21
Message:

added less-obfuscated quote-printable parsing in qp_decode()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/EMAILPlug.pm

    r3540 r3627  
    669669        # the RFC also mentions "parallel".
    670670    }
    671     } # end of ($mimetype !~ multipart)
     671    } # end of ($mimetype =~ multipart)
    672672    elsif ($mimetype =~ m@message/rfc822@) {
    673673    my $msg_header = $text;
     
    769769    my $text=shift;
    770770
    771     my @lines=split('\n', $text);
    772 
    773771    # if a line ends with "=\s*", it is a soft line break, otherwise
    774772    # keep in any newline characters.
    775     foreach my $line (@lines) {
    776     if ($line !~ s/=\s*$//) {$line.="\n";}
    777 
    778     if ($line =~ /=[0-9A-Fa-f]{2}/) { # it contains an escaped char
    779         my @hexcode_segments=split('=',$line);
    780         shift @hexcode_segments;
    781         my @hexcodes;
    782         foreach my $hexcode (@hexcode_segments) {
    783         $hexcode =~ s/^(..).*$/$1/;  # only need first 2 chars
    784         chomp($hexcode); # just in case...
    785         my $char=chr (hex "0x$hexcode");
    786         $line =~ s/=$hexcode/$char/g;
    787         }
    788     }
    789     }
    790     $text= join('', @lines);
     773
     774    $text =~ s/=\s*\r?\n//mg;
     775    $text =~ s/=([0-9A-Fa-f]{2})/chr (hex "0x$1")/eg;
    791776    return $text;
    792777}
Note: See TracChangeset for help on using the changeset viewer.