~ubuntu-dev/ubuntu/lucid/mutt/lucid-201002110857

« back to all changes in this revision

Viewing changes to copy.c

  • Committer: Bazaar Package Importer
  • Author(s): Antonio Radici
  • Date: 2009-06-14 20:53:18 UTC
  • mfrom: (1.3.1 upstream)
  • mto: (2.1.3 squeeze)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20090614205318-wf0sqy1o3km636li
Tags: 1.5.20-1
* New upstream release, includes the following features:
  + Bounced messages contains From: headers (Closes: 93268)
  + Attachments displayed based on Content-Disposition (Closes: 199709)
  + fcc to a mailbox does not raise the 'new' flag (Closes: 209390)
  + '!' supported as suffix in gpg keys (Closes: 277945)
  + failed attachment saving shows an error message (Closes: 292350)
  + inline signed messages sent honouring $send_charset (Closes: 307819)
  + support for <clear-flag> and <set-flag> in the pager (Closes: 436007)
  + fcc_attach is a quad option (Closes: 478861)
  + Content-Description header not included in reply (Closes: 500766)
  + imap_sync_mailbox fix for a segfault (Closes: 516364)
  + better threading support with particular Message-ID's (Closes: 520735)
  + no crash on IMAP folder refresh (Closes: 528465)
  + undisclosed-recipients not passed in the envelope (Closes: 529090)
* debian/patches/series:
  + commented all references to upstream/*, they should be included in 1.5.20
  + removed debian-specific/529838-gnutls-autoconf.patch, ditto
  + removed misc/manpage-typos.patch, ditto 
  + modified misc/hyphen-as-minus.patch, a big part was integrated upstream
  + features/trash-folder: do not reupload messages to $trash if IMAP is used
    (Closes: #448241)
  + added misc/hg.pmdef.debugtime, see upstream #3263
* debian/control: added DM-Upload-Allowed: yes

Show diffs side-by-side

added added

removed removed

Lines of Context:
287
287
      if (flags & (CH_DECODE|CH_PREFIX))
288
288
      {
289
289
        if (mutt_write_one_header (out, 0, headers[x], 
290
 
                                   flags & CH_PREFIX ? prefix : 0, mutt_term_width (Wrap)) == -1)
 
290
                                   flags & CH_PREFIX ? prefix : 0, mutt_term_width (Wrap), flags) == -1)
291
291
        {
292
292
          error = TRUE;
293
293
          break;
348
348
      | (h->env->refs_changed ? CH_UPDATE_REFS : 0);
349
349
  
350
350
  if (mutt_copy_hdr (in, out, h->offset, h->content->offset, flags, prefix) == -1)
351
 
    return (-1);
 
351
    return -1;
352
352
 
353
353
  if (flags & CH_TXTPLAIN)
354
354
  {
360
360
    rfc822_cat(buffer, sizeof(buffer), chsbuf, MimeSpecials);
361
361
    fputs(buffer, out);
362
362
    fputc('\n', out);
363
 
    
364
 
    if (ferror (out) != 0 || feof (out) != 0)
365
 
      return -1;
366
 
    
367
 
  }
368
 
 
369
 
  if (flags & CH_UPDATE)
370
 
  {
371
 
    if ((flags & CH_NOSTATUS) == 0)
372
 
    {
373
 
      if (h->env->irt_changed && h->env->in_reply_to)
374
 
      {
375
 
        LIST *listp = h->env->in_reply_to;
376
 
 
377
 
        if (fputs ("In-Reply-To: ", out) == EOF)
378
 
          return (-1);
379
 
 
380
 
        for (; listp; listp = listp->next)
381
 
          if ((fputs (listp->data, out) == EOF) || (fputc (' ', out) == EOF))
382
 
            return (-1);
383
 
 
384
 
        if (fputc ('\n', out) == EOF)
385
 
          return (-1);
386
 
      }
387
 
 
388
 
      if (h->env->refs_changed && h->env->references)
389
 
      {
390
 
        LIST *listp = h->env->references, *refs = NULL, *t;
391
 
 
392
 
        if (fputs ("References: ", out) == EOF)
393
 
          return (-1);
394
 
 
395
 
        /* Mutt stores references in reverse order, thus we create
396
 
         * a reordered refs list that we can put in the headers */
397
 
        for (; listp; listp = listp->next, refs = t)
398
 
        {
399
 
          t = (LIST *)safe_malloc (sizeof (LIST));
400
 
          t->data = listp->data;
401
 
          t->next = refs;
402
 
        }
403
 
 
404
 
        for (; refs; refs = refs->next)
405
 
          if ((fputs (refs->data, out) == EOF) || (fputc (' ', out) == EOF))
406
 
            return (-1);
407
 
 
408
 
        /* clearing refs from memory */
409
 
        for (t = refs; refs; refs = t->next, t = refs)
410
 
          FREE (&refs);
411
 
 
412
 
        if (fputc ('\n', out) == EOF)
413
 
          return (-1);
414
 
      }
415
 
 
416
 
      if (h->old || h->read)
417
 
      {
418
 
        if (fputs ("Status: ", out) == EOF)
419
 
          return (-1);
420
 
 
421
 
        if (h->read)
422
 
        {
423
 
          if (fputs ("RO", out) == EOF)
424
 
            return (-1);
425
 
        }
426
 
        else if (h->old)
427
 
        {
428
 
          if (fputc ('O', out) == EOF)
429
 
            return (-1);
430
 
        }
431
 
 
432
 
        if (fputc ('\n', out) == EOF)
433
 
          return (-1);
434
 
      }
435
 
 
436
 
      if (h->flagged || h->replied)
437
 
      {
438
 
        if (fputs ("X-Status: ", out) == EOF)
439
 
          return (-1);
440
 
 
441
 
        if (h->replied)
442
 
        {
443
 
          if (fputc ('A', out) == EOF)
444
 
            return (-1);
445
 
        }
446
 
 
447
 
        if (h->flagged)
448
 
        {
449
 
          if (fputc ('F', out) == EOF)
450
 
            return (-1);
451
 
        }
452
 
        
453
 
        if (fputc ('\n', out) == EOF)
454
 
          return (-1);
455
 
      }
 
363
  }
 
364
 
 
365
  if ((flags & CH_UPDATE_IRT) && h->env->in_reply_to)
 
366
  {
 
367
    LIST *listp = h->env->in_reply_to;
 
368
    fputs ("In-Reply-To:", out);
 
369
    for (; listp; listp = listp->next)
 
370
    {
 
371
      fputc (' ', out);
 
372
      fputs (listp->data, out);
 
373
    }
 
374
    fputc ('\n', out);
 
375
  }
 
376
 
 
377
  if ((flags & CH_UPDATE_REFS) && h->env->references)
 
378
  {
 
379
    fputs ("References:", out);
 
380
    mutt_write_references (h->env->references, out, 0);
 
381
    fputc ('\n', out);
 
382
  }
 
383
 
 
384
  if ((flags & CH_UPDATE) && (flags & CH_NOSTATUS) == 0)
 
385
  {
 
386
    if (h->old || h->read)
 
387
    {
 
388
      fputs ("Status: ", out);
 
389
      if (h->read)
 
390
        fputs ("RO", out);
 
391
      else if (h->old)
 
392
        fputc ('O', out);
 
393
      fputc ('\n', out);
 
394
    }
 
395
 
 
396
    if (h->flagged || h->replied)
 
397
    {
 
398
      fputs ("X-Status: ", out);
 
399
      if (h->replied)
 
400
        fputc ('A', out);
 
401
      if (h->flagged)
 
402
        fputc ('F', out);
 
403
      fputc ('\n', out);
456
404
    }
457
405
  }
458
406
 
468
416
  {
469
417
    if (flags & CH_PREFIX)
470
418
      fputs(prefix, out);
471
 
    if (fputc ('\n', out) == EOF) /* add header terminator */
472
 
      return (-1);
 
419
    fputc ('\n', out); /* add header terminator */
473
420
  }
474
421
 
475
422
  if (ferror (out) || feof (out))
476
423
    return -1;
477
424
  
478
 
  return (0);
 
425
  return 0;
479
426
}
480
427
 
481
428
/* Count the number of lines and bytes to be deleted in this body*/
572
519
      if (new_lines <= 0)
573
520
        new_lines = 0;
574
521
      else
575
 
        fprintf (fpout, "Lines: %d\n\n", new_lines);
 
522
        fprintf (fpout, "Lines: %d\n", new_lines);
 
523
 
 
524
      putc ('\n', fpout);
576
525
      if (ferror (fpout) || feof (fpout))
577
526
        return -1;
578
527
      new_offset = ftello (fpout);
652
601
  else if (WithCrypto
653
602
           && (flags & M_CM_DECODE_CRYPT) && (hdr->security & ENCRYPT))
654
603
  {
655
 
    BODY *cur;
 
604
    BODY *cur = NULL;
656
605
    FILE *fp;
657
606
 
658
607
    if ((WithCrypto & APPLICATION_PGP)
672
621
        return (-1);
673
622
    }
674
623
 
 
624
    if (!cur)
 
625
    {
 
626
      mutt_error (_("No decryption engine available for message"));
 
627
      return -1;
 
628
    }
 
629
 
675
630
    mutt_write_mime_header (cur, fpout);
676
631
    fputc ('\n', fpout);
677
632
 
678
633
    fseeko (fp, cur->offset, 0);
679
634
    if (mutt_copy_bytes (fp, fpout, cur->length) == -1)
680
635
    {
681
 
      fclose (fp);
 
636
      safe_fclose (&fp);
682
637
      mutt_free_body (&cur);
683
638
      return (-1);
684
639
    }
685
640
    mutt_free_body (&cur);
686
 
    fclose (fp);
 
641
    safe_fclose (&fp);
687
642
  }
688
643
  else
689
644
  {
718
673
  return rc;
719
674
}
720
675
 
 
676
/* should be made to return -1 on fatal errors, and 1 on non-fatal errors
 
677
 * like partial decode, where it is worth displaying as much as possible */
721
678
int
722
679
mutt_copy_message (FILE *fpout, CONTEXT *src, HEADER *hdr, int flags,
723
680
                   int chflags)
908
865
static int address_header_decode (char **h)
909
866
{
910
867
  char *s = *h;
911
 
  int l;
 
868
  int l, rp = 0;
912
869
 
913
870
  ADDRESS *a = NULL;
914
871
 
919
876
      if (ascii_strncasecmp (s, "return-path:", 12) == 0)
920
877
      {
921
878
        l = 12;
 
879
        rp = 1;
922
880
        break;
923
881
      }
924
882
      else if (ascii_strncasecmp (s, "reply-to:", 9) == 0)
979
937
  
980
938
  mutt_addrlist_to_local (a);
981
939
  rfc2047_decode_adrlist (a);
982
 
  
983
 
  *h = safe_calloc (1, l + 2);
984
 
  
985
 
  strfcpy (*h, s, l + 1);
986
 
  
987
 
  format_address_header (h, a);
 
940
 
 
941
  /* angle brackets for return path are mandated by RfC5322,
 
942
   * so leave Return-Path as-is */
 
943
  if (rp)
 
944
    *h = safe_strdup (s);
 
945
  else
 
946
  {
 
947
    *h = safe_calloc (1, l + 2);
 
948
    strfcpy (*h, s, l + 1);
 
949
    format_address_header (h, a);
 
950
  }
988
951
 
989
952
  rfc822_free_address (&a);
990
 
  
 
953
 
991
954
  FREE (&s);
992
955
  return 1;
993
956
}