]> diplodocus.org Git - nmh/commitdiff
mhshow: suppress error for undisplayable parts, if they're not wanted
authorPaul Fox <pgf@foxharp.boston.ma.us>
Sat, 26 Apr 2014 14:45:47 +0000 (10:45 -0400)
committerPaul Fox <pgf@foxharp.boston.ma.us>
Sat, 26 Apr 2014 14:53:22 +0000 (10:53 -0400)
consider this message:

   1       multipart/mixed          1113K
     1     multipart/alternative      292
     1.1   text/html                   66
     1.2   text/plain                  49
     2     image/jpeg                823K

if this is displayed using "mshow -part 2", in the presence of an
MHSHOW variable which _only_ describes a rule for displaying images,
then we don't want to get an error about how nothing in part 1 was
displayable.

uip/mhshowsbr.c

index 45c73cb..f402b9c 100644 (file)
@@ -571,6 +571,7 @@ show_multi_internal (CT ct, int alternate, int concatsw, int textonly,
     int        alternating, nowalternate, result;
     struct multipart *m = (struct multipart *) ct->c_ctparams;
     struct part *part;
+    int any_part_ok;
     CT p;
 
     alternating = 0;
@@ -587,6 +588,7 @@ show_multi_internal (CT ct, int alternate, int concatsw, int textonly,
  */
 
     result = alternate ? NOTOK : OK;
+    any_part_ok = 0;
 
     for (part = m->mp_parts; part; part = part->mp_next) {
        p = part->mp_part;
@@ -594,6 +596,8 @@ show_multi_internal (CT ct, int alternate, int concatsw, int textonly,
        if (part_ok (p, 1) && type_ok (p, 1)) {
            int inneresult;
 
+           any_part_ok = 1;
+
            inneresult = show_switch (p, nowalternate, concatsw, textonly,
                                      inlineonly, fmt);
            switch (inneresult) {
@@ -621,7 +625,7 @@ show_multi_internal (CT ct, int alternate, int concatsw, int textonly,
        }
     }
 
-    if (alternating && !part) {
+    if (alternating && !part && any_part_ok) {
        if (!alternate)
            content_error (NULL, ct, "don't know how to display any of the contents");
        result = NOTOK;