mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhtxtplain.pl,2.36,2.37

2003-01-17 20:17:17
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv9575

Modified Files:
	mhtxtplain.pl 
Log Message:
* If uudecode and usename specified, check if file ends in
  .s?html?, and if so, pass data to HTML filter.
* Make sure to return a non-empty string for an empty body
  when in uudecode mode.  Avoids bogus warning message that
  data could not be converted.


Index: mhtxtplain.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhtxtplain.pl,v
retrieving revision 2.36
retrieving revision 2.37
diff -C2 -r2.36 -r2.37
*** mhtxtplain.pl	31 Dec 2002 02:23:15 -0000	2.36
--- mhtxtplain.pl	18 Jan 2003 03:17:12 -0000	2.37
***************
*** 162,166 ****
  	my $usename = $args =~ /\busename\b/;
  
! 	my($pdata);	# have to use local() since typeglobs used
  	my($inext, $uddata, $file, $urlfile);
  	my @files = ( );
--- 162,166 ----
  	my $usename = $args =~ /\busename\b/;
  
! 	my($pdata);
  	my($inext, $uddata, $file, $urlfile);
  	my @files = ( );
***************
*** 188,191 ****
--- 188,197 ----
  		if (readmail::MAILis_excluded('application/octet-stream')) {
  		    $ret .= &$readmail::ExcludedPartFunc($file);
+ 
+ 		} elsif ($file =~ /\.s?html?$/i) {
+ 		    my @ha = do_html($fields, \$uddata, 1, $args);
+ 		    $ret .= shift(@ha);
+ 		    push(@files, @ha);
+ 
  		} else {
  		    push(@files,
***************
*** 209,215 ****
  		$ret .= shift @subret;
  		push(@files, @subret);
- 	    } else {
- 		# Make sure readmail thinks we processed
- 		$ret .= " ";
  	    }
  	    ++$i;
--- 215,218 ----
***************
*** 217,220 ****
--- 220,224 ----
  
  	## Done with uudecode
+ 	$ret = ' '  if $ret eq '';
  	return ($ret, @files);
      }
***************
*** 224,241 ****
      if ($args =~ s/\bhtmlcheck\b//i &&
  	    $$data =~ /\A\s*<(?:html\b|x-html\b|!doctype\s+html\s)/i) {
! 	if (readmail::MAILis_excluded('text/html')) {
! 	  return (&$readmail::ExcludedPartFunc('text/plain HTML'));
! 	}
! 	my $html_filter = readmail::load_filter('text/html');
! 	if (defined($html_filter) && defined(&$html_filter)) {
! 	    return (&$html_filter($fields, $data, $isdecode,
! 		      readmail::get_filter_args(
! 			'text/html', 'text/*', $html_filter)));
! 	} else {
! 	    require 'mhtxthtml.pl';
! 	    return (m2h_text_html::filter($fields, $data, $isdecode,
! 		      readmail::get_filter_args(
! 			'text/html', 'text/*', 'm2h_text_html::filter')));
! 	}
      }
  
--- 228,232 ----
      if ($args =~ s/\bhtmlcheck\b//i &&
  	    $$data =~ /\A\s*<(?:html\b|x-html\b|!doctype\s+html\s)/i) {
! 	return do_html($fields, $data, $isdecode, $args);
      }
  
***************
*** 538,541 ****
--- 529,553 ----
      $$data = ' '  if $$data eq '';
      ($$data);
+ }
+ 
+ ##---------------------------------------------------------------------------##
+ 
+ sub do_html {
+     my($fields, $data, $isdecode, $args) = @_;
+     if (readmail::MAILis_excluded('text/html')) {
+       return (&$readmail::ExcludedPartFunc('text/plain HTML'));
+     }
+     my $html_filter = readmail::load_filter('text/html');
+     if (defined($html_filter) && defined(&$html_filter)) {
+ 	return (&$html_filter($fields, $data, $isdecode,
+ 		  readmail::get_filter_args(
+ 		    'text/html', 'text/*', $html_filter)));
+     } else {
+ 	require 'mhtxthtml.pl';
+ 	return (m2h_text_html::filter($fields, $data, $isdecode,
+ 		  readmail::get_filter_args(
+ 		    'text/html', 'text/*', 'm2h_text_html::filter')));
+     }
+ 
  }
  

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV