~ubuntu-dev/ubuntu/lucid/mutt/lucid-201002101906

« back to all changes in this revision

Viewing changes to send.c

  • Committer: Bazaar Package Importer
  • Author(s): أحمد المحمودي (Ahmed El-Mahmoudy)
  • Date: 2009-06-17 17:17:28 UTC
  • mfrom: (1.1.11 upstream) (16.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090617171728-lj10l5x2m2vg6cag
Tags: 1.5.20-1ubuntu1
* Merge from debian unstable (LP: #388515)
* Build-depend on elinks-lite
  + elinks-lite doesn't provide links anymore.
  + elinks-lite is now in main, and pulls less dependencies than the
    full-fledged elinks.
* debian/control: Recommend default-mta instead of exim4. (LP: #386308)

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
    if (option (OPTSIGDASHES))
60
60
      fputs ("\n-- \n", f);
61
61
    mutt_copy_stream (tmpfp, f);
62
 
    fclose (tmpfp);
 
62
    safe_fclose (&tmpfp);
63
63
    if (thepid != -1)
64
64
      mutt_wait_filter (thepid);
65
65
  }
309
309
    else if (ascii_strncasecmp ("to:", uh->data, 3) != 0 &&
310
310
             ascii_strncasecmp ("cc:", uh->data, 3) != 0 &&
311
311
             ascii_strncasecmp ("bcc:", uh->data, 4) != 0 &&
312
 
             ascii_strncasecmp ("subject:", uh->data, 8) != 0)
 
312
             ascii_strncasecmp ("subject:", uh->data, 8) != 0 &&
 
313
             ascii_strncasecmp ("return-path:", uh->data, 12) != 0)
313
314
    {
314
315
      if (last)
315
316
      {
387
388
  if (option (OPTFORWQUOTE))
388
389
    cmflags |= M_CM_PREFIX;
389
390
 
 
391
  /* wrapping headers for forwarding is considered a display
 
392
   * rather than send action */
 
393
  chflags |= CH_DISPLAY;
 
394
 
390
395
  mutt_copy_message (out, ctx, cur, cmflags, chflags);
391
396
  mutt_forward_trailer (out);
392
397
  return 0;
451
456
 
452
457
  if (flags && env->mail_followup_to && hmfupto == M_YES) 
453
458
  {
454
 
    rfc822_append (to, env->mail_followup_to);
 
459
    rfc822_append (to, env->mail_followup_to, 1);
455
460
    return 0;
456
461
  }
457
462
 
464
469
  if (!option(OPTREPLYSELF) && mutt_addr_is_user (env->from))
465
470
  {
466
471
    /* mail is from the user, assume replying to recipients */
467
 
    rfc822_append (to, env->to);
 
472
    rfc822_append (to, env->to, 1);
468
473
  }
469
474
  else if (env->reply_to)
470
475
  {
482
487
       * in his From header.
483
488
       * 
484
489
       */
485
 
      rfc822_append (to, env->from);
 
490
      rfc822_append (to, env->from, 0);
486
491
    }
487
492
    else if (!(mutt_addrcmp (env->from, env->reply_to) && 
488
493
               !env->reply_to->next) &&
499
504
      switch (query_quadoption (OPT_REPLYTO, prompt))
500
505
      {
501
506
      case M_YES:
502
 
        rfc822_append (to, env->reply_to);
 
507
        rfc822_append (to, env->reply_to, 0);
503
508
        break;
504
509
 
505
510
      case M_NO:
506
 
        rfc822_append (to, env->from);
 
511
        rfc822_append (to, env->from, 0);
507
512
        break;
508
513
 
509
514
      default:
511
516
      }
512
517
    }
513
518
    else
514
 
      rfc822_append (to, env->reply_to);
 
519
      rfc822_append (to, env->reply_to, 0);
515
520
  }
516
521
  else
517
 
    rfc822_append (to, env->from);
 
522
    rfc822_append (to, env->from, 0);
518
523
 
519
524
  return (0);
520
525
}
538
543
  if (flags & SENDLISTREPLY)
539
544
  {
540
545
    tmp = find_mailing_lists (in->to, in->cc);
541
 
    rfc822_append (&out->to, tmp);
 
546
    rfc822_append (&out->to, tmp, 0);
542
547
    rfc822_free_address (&tmp);
543
548
 
544
549
    if (in->mail_followup_to && hmfupto == M_YES &&
553
558
    if ((flags & SENDGROUPREPLY) && (!in->mail_followup_to || hmfupto != M_YES))
554
559
    {
555
560
      /* if(!mutt_addr_is_user(in->to)) */
556
 
      rfc822_append (&out->cc, in->to);
557
 
      rfc822_append (&out->cc, in->cc);
 
561
      rfc822_append (&out->cc, in->to, 1);
 
562
      rfc822_append (&out->cc, in->cc, 1);
558
563
    }
559
564
  }
560
565
  return 0;
675
680
  }
676
681
  else
677
682
    mutt_add_to_reference_headers (env, curenv, NULL, NULL);
 
683
 
 
684
  /* if there's more than entry in In-Reply-To (i.e. message has
 
685
     multiple parents), don't generate a References: header as it's
 
686
     discouraged by RfC2822, sect. 3.6.4 */
 
687
  if (ctx->tagged > 0 && env->in_reply_to && env->in_reply_to->next)
 
688
    mutt_free_list (&env->references);
678
689
}
679
690
 
680
691
static int
863
874
       * mail-followup-to header
864
875
       */
865
876
 
866
 
      t = rfc822_append (&e->mail_followup_to, e->to);
867
 
      rfc822_append (&t, e->cc);
 
877
      t = rfc822_append (&e->mail_followup_to, e->to, 0);
 
878
      rfc822_append (&t, e->cc, 1);
868
879
    }
869
880
 
870
881
    /* remove ourselves from the mail-followup-to header */
880
891
    if (e->mail_followup_to && !mutt_is_list_recipient (0, e->to, e->cc))
881
892
    {
882
893
      if (e->reply_to)
883
 
        from = rfc822_cpy_adr (e->reply_to);
 
894
        from = rfc822_cpy_adr (e->reply_to, 0);
884
895
      else if (e->from)
885
 
        from = rfc822_cpy_adr (e->from);
 
896
        from = rfc822_cpy_adr (e->from, 0);
886
897
      else
887
898
        from = mutt_default_from ();
888
899
      
997
1008
 
998
1009
  if ((mutt_write_mime_body (msg->content, tempfp) == -1))
999
1010
  {
1000
 
    fclose(tempfp);
 
1011
    safe_fclose (&tempfp);
1001
1012
    unlink (tempfile);
1002
1013
    return (-1);
1003
1014
  }
1082
1093
  return ci_send_message (SENDRESEND, msg, NULL, ctx, cur);
1083
1094
}
1084
1095
 
 
1096
static int is_reply (HEADER *reply, HEADER *orig)
 
1097
{
 
1098
  return mutt_find_list (orig->env->references, reply->env->message_id) ||
 
1099
         mutt_find_list (orig->env->in_reply_to, reply->env->message_id);
 
1100
}
 
1101
 
 
1102
static int has_recips (ADDRESS *a)
 
1103
{
 
1104
  int c = 0;
 
1105
 
 
1106
  for ( ; a; a = a->next)
 
1107
  {
 
1108
    if (!a->mailbox || a->group)
 
1109
      continue;
 
1110
    c++;
 
1111
  }
 
1112
  return c;
 
1113
}
 
1114
 
1085
1115
int
1086
1116
ci_send_message (int flags,             /* send mode */
1087
1117
                 HEADER *msg,           /* template to use for new message */
1541
1571
    }
1542
1572
  }
1543
1573
 
1544
 
  if (!msg->env->to && !msg->env->cc && !msg->env->bcc)
 
1574
  if (!has_recips (msg->env->to) && !has_recips (msg->env->cc) &&
 
1575
      !has_recips (msg->env->bcc))
1545
1576
  {
1546
1577
    if (! (flags & SENDBATCH))
1547
1578
    {
1665
1696
      msg->content = clear_content;
1666
1697
 
1667
1698
    /* check to see if the user wants copies of all attachments */
1668
 
    if (!option (OPTFCCATTACH) && msg->content->type == TYPEMULTIPART)
 
1699
    if (query_quadoption (OPT_FCCATTACH, _("Save attachments in Fcc?")) != M_YES &&
 
1700
        msg->content->type == TYPEMULTIPART)
1669
1701
    {
1670
1702
      if (WithCrypto
1671
1703
          && (mutt_strcmp (msg->content->subtype, "encrypted") == 0 ||
1786
1818
  if (WithCrypto && free_clear_content)
1787
1819
    mutt_free_body (&clear_content);
1788
1820
 
 
1821
  /* set 'replied' flag only if the user didn't change/remove
 
1822
     In-Reply-To: and References: headers during edit */
1789
1823
  if (flags & SENDREPLY)
1790
1824
  {
1791
1825
    if (cur && ctx)
1792
 
      mutt_set_flag (ctx, cur, M_REPLIED, 1);
 
1826
      mutt_set_flag (ctx, cur, M_REPLIED, is_reply (cur, msg));
1793
1827
    else if (!(flags & SENDPOSTPONED) && ctx && ctx->tagged)
1794
1828
    {
1795
1829
      for (i = 0; i < ctx->vcount; i++)
1796
1830
        if (ctx->hdrs[ctx->v2r[i]]->tagged)
1797
 
          mutt_set_flag (ctx, ctx->hdrs[ctx->v2r[i]], M_REPLIED, 1);
 
1831
          mutt_set_flag (ctx, ctx->hdrs[ctx->v2r[i]], M_REPLIED,
 
1832
                         is_reply (ctx->hdrs[ctx->v2r[i]], msg));
1798
1833
    }
1799
1834
  }
1800
1835