Changeset 5422:e2780a423d96

Show
Ignore:
Timestamp:
2008-06-25 22:43:32 (5 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Make mutt_copy_message distinguish between fatal and non-fatal errors.
Non-fatal errors should prevent moving messages, since they indicate
data loss. But mutt should still attempt to display them, since being
able to see some attachments is better than nothing.
Also stop printing out non-PGP material in application/pgp
attachments. Closes #2545, #2912.

Files:
6 modified

Legend:

Unmodified
Added
Removed
  • commands.c

    r5321 r5422  
    148148  res = mutt_copy_message (fpout, Context, cur, cmflags, 
    149149        (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) | CH_DECODE | CH_FROM); 
    150   if ((safe_fclose (&fpout) != 0 && errno != EPIPE) || res == -1) 
     150  if ((safe_fclose (&fpout) != 0 && errno != EPIPE) || res < 0) 
    151151  { 
    152152    mutt_error (_("Could not copy message")); 
  • copy.c

    r5291 r5422  
    719719} 
    720720 
     721/* should be made to return -1 on fatal errors, and 1 on non-fatal errors 
     722 * like partial decode, where it is worth displaying as much as possible */ 
    721723int 
    722724mutt_copy_message (FILE *fpout, CONTEXT *src, HEADER *hdr, int flags, 
  • crypt-gpgme.c

    r5385 r5422  
    20972097 
    20982098                  { 
    2099                     /* Check wether signatures have been verified.  */ 
     2099                    /* Check whether signatures have been verified.  */ 
    21002100                    gpgme_verify_result_t verify_result; 
    21012101 
     
    22002200            } 
    22012201        } 
     2202#if 0 
    22022203      else 
    2203         { 
    2204           /* XXX - we may wish to recode here */ 
    2205           if (s->prefix) 
    2206             state_puts (s->prefix, s); 
    2207           state_puts (buf, s); 
    2208         } 
     2204      { 
     2205        /* why would we want to display this at all? */ 
     2206        /* XXX - we may wish to recode here */ 
     2207        if (s->prefix) 
     2208          state_puts (s->prefix, s); 
     2209        state_puts (buf, s); 
     2210      } 
     2211#endif 
    22092212    } 
    22102213 
     
    22152218      state_attach_puts (_("[-- Error: could not find beginning" 
    22162219                           " of PGP message! --]\n\n"), s); 
    2217       return -1; 
     2220      return 1; 
    22182221    } 
    22192222  dprint (2, (debugfile, "Leaving pgp_application_pgp handler\n")); 
  • handler.c

    r5421 r5422  
    12121212      a->encoding == ENCUUENCODED) 
    12131213    mutt_free_body (&b); 
    1214    
     1214 
     1215  /* make failure of a single part non-fatal */ 
     1216  if (rc < 0) 
     1217    rc = 1; 
    12151218  return rc; 
    12161219} 
  • mbox.c

    r5397 r5422  
    834834      newOffset[i - first].hdr = ftello (fp) + offset; 
    835835 
    836       if (mutt_copy_message (fp, ctx, ctx->hdrs[i], M_CM_UPDATE, CH_FROM | CH_UPDATE | CH_UPDATE_LEN) == -1) 
     836      if (mutt_copy_message (fp, ctx, ctx->hdrs[i], M_CM_UPDATE, 
     837                             CH_FROM | CH_UPDATE | CH_UPDATE_LEN) != 0) 
    837838      { 
    838839        mutt_perror (tempfile); 
  • pgp.c

    r5410 r5422  
    468468      } 
    469469    } 
     470#if 0 
    470471    else 
    471472    { 
     473      /* why would we want to display this at all? */ 
    472474      /* XXX - we may wish to recode here */ 
    473475      if (s->prefix) 
     
    475477      state_puts (buf, s); 
    476478    } 
     479#endif 
    477480  } 
    478481