mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhamain.pl,2.80,2.81 mhdb.pl,2.37,2.38 mhopt.pl,2....

2005-06-01 22:50:35
Update of mhonarc/MHonArc/lib
Modified Files:
	mhamain.pl mhdb.pl mhopt.pl mhrcfile.pl readmail.pl 
Log Message:
Added MIMEINCS resource: Content-types to allow.


======================================================================
FILE: mhonarc/MHonArc/lib/mhamain.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/mhamain.pl?rev=2.81>

<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/mhamain.pl.diff?r1=2.80&r2=2.81&diff_format=h>
--- mhamain.pl	2 Jun 2005 02:12:30 -0000	2.80
+++ mhamain.pl	2 Jun 2005 05:50:27 -0000	2.81
@@ -1037,5 +1037,5 @@
              qq/         Message-Id: $MHAmsgid\n/,
              qq/         Message Number: $MHAmsgnum\n/,
-             qq/         Content-Type/,
+             qq/         Content-Type: /,
                          ($fields->{'content-type'}[0] || 'text/plain'),
                          qq/\n/;

======================================================================
FILE: mhonarc/MHonArc/lib/mhdb.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/mhdb.pl?rev=2.38>

<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/mhdb.pl.diff?r1=2.37&r2=2.38&diff_format=h>
--- mhdb.pl	15 Dec 2004 20:33:39 -0000	2.37
+++ mhdb.pl	2 Jun 2005 05:50:27 -0000	2.38
@@ -131,4 +131,9 @@
                     unless $IsDefault{'MIMEEXCS'};
 }
+if (%readmail::MIMEIncs) {
+    print_var($db,'readmail::MIMEIncs',
+                    \%readmail::MIMEIncs)
+                    unless $IsDefault{'MIMEINCS'};
+}
 unless ($IsDefault{'MIMEALTPREFS'}) {
     print_var($db,'MIMEAltPrefs',

======================================================================
FILE: mhonarc/MHonArc/lib/mhopt.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/mhopt.pl?rev=2.59>

<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/mhopt.pl.diff?r1=2.58&r2=2.59&diff_format=h>
--- mhopt.pl	10 May 2005 19:05:23 -0000	2.58
+++ mhopt.pl	2 Jun 2005 05:50:27 -0000	2.59
@@ -1216,4 +1216,10 @@
     }
 
+    ##  Content-Types to only include:
+    ##    Blank by default: include everything
+    unless (%readmail::MIMEIncs) {
+        $IsDefault{'MIMEIncs'} = 1;
+    }
+
     ##  Content-type multipart/alternative preferences
     ##    Note: The variable is not a readmail package variable, but it

======================================================================
FILE: mhonarc/MHonArc/lib/mhrcfile.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/mhrcfile.pl?rev=2.44>

<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/mhrcfile.pl.diff?r1=2.43&r2=2.44&diff_format=h>
--- mhrcfile.pl	27 Apr 2005 18:14:03 -0000	2.43
+++ mhrcfile.pl	2 Jun 2005 05:50:27 -0000	2.44
@@ -612,4 +612,14 @@
             last FMTSW;
         }
+        if ($elem eq 'mimeincs') {              # Mime includes
+            $IsDefault{'MIMEINCS'} = 0;
+            %readmail::MIMEIncs = ()  if $override;
+            while (defined($line = <$handle>)) {
+                last  if $line =~ /^\s*<\/mimeincs\s*>/i;
+                $line =~ s/\s//g;  $line =~ tr/A-Z/a-z/;
+                $readmail::MIMEIncs{$line} = 1  if $line;
+            }
+            last FMTSW;
+        }
         if ($elem eq 'modifybodyaddresses') {   # Modify addresses in bodies
             $AddrModifyBodies = 1; last FMTSW;

======================================================================
FILE: mhonarc/MHonArc/lib/readmail.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/readmail.pl?rev=2.36>

<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/readmail.pl.diff?r1=2.35&r2=2.36&diff_format=h>
--- readmail.pl	10 Mar 2004 22:01:33 -0000	2.35
+++ readmail.pl	2 Jun 2005 05:50:27 -0000	2.36
@@ -199,7 +199,4 @@
 ##      Keys => content-type, or base-type
 ##      Values => <should evaluate to a true expression>
-##
-##  For purposes of efficiency, content-types, or base-types, should
-##  be specified in lowercase.  All key lookups are done in lowercase.
 
 %MIMEExcs                       = ()
@@ -207,4 +204,18 @@
 
 ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+##  %MIMEIncs is the associative array listing which data types
+##  should be auto-included during parsing:
+##
+##      Keys => content-type, or base-type
+##      Values => <should evaluate to a true expression>
+##
+##  If there are any keys defined in %MIMEIncs, then any content-type
+##  not in the hash is automatically excluded.  I.e.  %MIMEIncs can
+##  be used to only allow a well-defined set of content-types.
+
+%MIMEIncs                       = ()
+    unless defined(%MIMEIncs);
+
+## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ##  %MIMECharsetAliases is a mapping of charset names to charset names.
 ##  The MAILset_charset_aliases() routine should be used to set the
@@ -930,12 +941,26 @@
 sub MAILis_excluded {
     my $ctype = lc($_[0]) || 'text/plain';
-    if ($MIMEExcs{$ctype}) {
-        return 1;
+    my $btype = undef;
+
+    $ctype =~ s/\/x-/\//;
+    if ($ctype =~ m|([^/]+)/|) {
+        $btype = $1;
     }
-    if ($ctype =~ s/\/x-/\//) {
-        return 1  if $MIMEExcs{$ctype};
+
+    MIMEINCS: {
+        # Treat multipart special: It is always included unless present
+        # in MIMEExcs.
+        last  MIMEINCS  if ($ctype =~ /^multipart\b/);
+
+        if (%MIMEIncs) {
+            if ($MIMEIncs{$ctype} || (defined($btype) && $MIMEIncs{$btype})) {
+                last MIMEINCS;
+            } else {
+                return 1;
+            }
+        }
     }
-    if ($ctype =~ m|([^/]+)/|) {
-        return $MIMEExcs{$1};
+    if ($MIMEExcs{$ctype} || (defined($btype) && $MIMEExcs{$btype})) {
+        return 1;
     }
     0;


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