Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv32745
Modified Files:
readmail.pl
Log Message:
* Modified MAILdecode_1522_str() so second argument is now more than
an optional boolean flag: Defined constants JUST_DECODE and DECODE_ALL.
* MAILhead_get_disposition() fixed [Bug #511] to decode any non-ASCII
encoded data in the filename.
Index: readmail.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/readmail.pl,v
retrieving revision 2.16
retrieving revision 2.17
diff -C2 -r2.16 -r2.17
*** readmail.pl 4 Apr 2002 03:39:26 -0000 2.16
--- readmail.pl 31 May 2002 02:54:10 -0000 2.17
***************
*** 45,48 ****
--- 45,58 ----
##---------------------------------------------------------------------------##
+ ## Constants
+ ##
+
+ ## Constants for use as second argument to MAILdecode_1522_str().
+ sub JUST_DECODE() { 1; }
+ sub DECODE_ALL() { 2; }
+
+ ##---------------------------------------------------------------------------##
+
+ ##---------------------------------------------------------------------------##
## Scalar Variables
##
***************
*** 280,291 ****
## Usage:
##
! ## $ret_data = &MAILdecode_1522_str($str, $justdecode);
##
! ## If $justdecode is non-zero, $str will be decoded for only
! ## the charsets specified as "-decode-".
##
sub MAILdecode_1522_str {
my($str) = shift;
! my($justdecode) = shift;
my($charset,
$lcharset,
--- 290,302 ----
## Usage:
##
! ## $ret_data = &MAILdecode_1522_str($str, $decoding_flag);
##
! ## If $decoding_flag is JUST_DECODE, $str will be decoded for only
! ## the charsets specified as "-decode-". If it is equal to
! ## DECODE_ALL, all encoded data is decoded without any conversion.
##
sub MAILdecode_1522_str {
my($str) = shift;
! my($decoding_flag) = shift;
my($charset,
$lcharset,
***************
*** 323,327 ****
# Convert before (unencoded) text
! if ($justdecode) { # ignore if just decode
$ret .= $str_before;
} elsif (defined(&$plaincnv)) { # decode and convert
--- 334,338 ----
# Convert before (unencoded) text
! if ($decoding_flag) { # ignore if just decode
$ret .= $str_before;
} elsif (defined(&$plaincnv)) { # decode and convert
***************
*** 336,349 ****
# Convert encoded text
($lcharset = $charset) =~ tr/A-Z/a-z/;
! $charcnv = &load_charset($lcharset);
! $charcnv = $defcharcnv unless $charcnv;
# Decode only
! if ($charcnv eq "-decode-") {
$strtxt =~ s/_/ /g;
$ret .= &$dec($strtxt);
# Ignore if just decoding
! } elsif ($justdecode) {
$ret .= "=?$charset?$encoding?$strtxt?=";
--- 347,364 ----
# Convert encoded text
($lcharset = $charset) =~ tr/A-Z/a-z/;
! if ($decoding_flag == DECODE_ALL) {
! $charcnv = '-decode-';
! } else {
! $charcnv = &load_charset($lcharset);
! $charcnv = $defcharcnv unless $charcnv;
! }
# Decode only
! if ($charcnv eq '-decode-') {
$strtxt =~ s/_/ /g;
$ret .= &$dec($strtxt);
# Ignore if just decoding
! } elsif ($decoding_flag) {
$ret .= "=?$charset?$encoding?$strtxt?=";
***************
*** 365,369 ****
# Convert left-over unencoded text
! if ($justdecode) { # ignore if just decode
$ret .= $str;
} elsif (defined(&$plaincnv)) { # decode and convert
--- 380,384 ----
# Convert left-over unencoded text
! if ($decoding_flag) { # ignore if just decode
$ret .= $str;
} elsif (defined(&$plaincnv)) { # decode and convert
***************
*** 714,718 ****
## Decode text if requested
! $tmp = &MAILdecode_1522_str($tmp,1) if $DecodeHeader;
## Check for continuation of a field
--- 729,733 ----
## Decode text if requested
! $tmp = &MAILdecode_1522_str($tmp,JUST_DECODE) if $DecodeHeader;
## Check for continuation of a field
***************
*** 758,762 ****
## Decode text if requested
! $tmp = &MAILdecode_1522_str($tmp,1) if $DecodeHeader;
## Check for continuation of a field
--- 773,777 ----
## Decode text if requested
! $tmp = &MAILdecode_1522_str($tmp,JUST_DECODE) if $DecodeHeader;
## Check for continuation of a field
***************
*** 822,825 ****
--- 837,841 ----
}
}
+ $filename = MAILdecode_1522_str($filename, DECODE_ALL);
$filename =~ s%.*[/\\:]%%; # Remove any path component
$filename =~ s/^\s+//; # Remove leading whitespace
---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV