mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhtxthtml.pl,2.26,2.27

2002-12-13 00:19:08
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv25191

Modified Files:
	mhtxthtml.pl 
Log Message:
* Added disablerelated option to disable MHTML processing.


Index: mhtxthtml.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhtxthtml.pl,v
retrieving revision 2.26
retrieving revision 2.27
diff -C2 -r2.26 -r2.27
*** mhtxthtml.pl	24 Nov 2002 04:15:40 -0000	2.26
--- mhtxthtml.pl	13 Dec 2002 07:19:01 -0000	2.27
***************
*** 87,90 ****
--- 87,92 ----
  ##			with a link to it from the message page.
  ##
+ ##	disablerelated	Disable MHTML processing.
+ ##
  ##	nofont  	Remove <FONT> tags.
  ##
***************
*** 117,120 ****
--- 119,123 ----
      my $onlycid  = $args !~ /\ballownoncidurls\b/i;
      my $subdir   = $args =~ /\bsubdir\b/i;
+     my $norelate = $args =~ /\bdisablerelated\b/i;
      my $atdir    = $subdir ? $mhonarc::MsgPrefix.$mhonarc::MHAmsgnum : "";
      my $tmp;
***************
*** 289,298 ****
      ## Check for CID URLs (multipart/related HTML).  Multiple expressions
      ## exist to handle variations in how attribute values are delimited.
!     $$data =~ s/($UAttr\s*=\s*["])([^"]+)(["])
! 	       /join("",$1,&resolve_cid($onlycid, $2, $atdir),$3)/geoix;
!     $$data =~ s/($UAttr\s*=\s*['])([^']+)(['])
! 	       /join("",$1,&resolve_cid($onlycid, $2, $atdir),$3)/geoix;
!     $$data =~ s/($UAttr\s*=\s*)([^\s'">][^\s>]+)
!                /join("",$1,'"',&resolve_cid($onlycid, $2, $atdir),'"')/geoix;
  
      if ($onlycid) {
--- 292,310 ----
      ## Check for CID URLs (multipart/related HTML).  Multiple expressions
      ## exist to handle variations in how attribute values are delimited.
!     if ($norelate) {
! 	if ($onlycid) {
! 	    $$data =~ s/($UAttr\s*=\s*["])[^"]+(["])/$1$2/goi;
! 	    $$data =~ s/($UAttr\s*=\s*['])[^']+(['])/$1$2/goi;
! 	    $$data =~ s/($UAttr\s*=\s*[^\s'">][^\s>]+)/ /goi;
! 	}
!     } else {
! 	$$data =~ s/($UAttr\s*=\s*["])([^"]+)(["])
! 		   /join("",$1,&resolve_cid($onlycid, $2, $atdir),$3)/geoix;
! 	$$data =~ s/($UAttr\s*=\s*['])([^']+)(['])
! 		   /join("",$1,&resolve_cid($onlycid, $2, $atdir),$3)/geoix;
! 	$$data =~ s/($UAttr\s*=\s*)([^\s'">][^\s>]+)
! 		   /join("",$1,'"',&resolve_cid($onlycid, $2, $atdir),'"')
! 		   /geoix;
!     }
  
      if ($onlycid) {
***************
*** 359,362 ****
--- 371,379 ----
      }
  
+     # Get content-type of data and return if type is excluded
+     my $ctype = $href->{'fields'}{'content-type'}[0];
+       ($ctype) = $ctype =~ m{^\s*([\w\-\./]+)};
+     return ""  if readmail::MAILis_excluded($ctype);
+ 
      require 'mhmimetypes.pl';
      my $filename;
***************
*** 367,376 ****
  	my $data = &$decodefunc(${$href->{'body'}});
  	$filename = mhonarc::write_attachment(
! 			    $href->{'fields'}{'content-type'}[0],
  			    \$data,
  			    $attachdir);
      } else {
  	$filename = mhonarc::write_attachment(
! 			    $href->{'fields'}{'content-type'}[0],
  			    $href->{'body'},
  			    $attachdir);
--- 384,393 ----
  	my $data = &$decodefunc(${$href->{'body'}});
  	$filename = mhonarc::write_attachment(
! 			    $ctype,
  			    \$data,
  			    $attachdir);
      } else {
  	$filename = mhonarc::write_attachment(
! 			    $ctype,
  			    $href->{'body'},
  			    $attachdir);

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