Esempio n. 1
0
static void 
mutt_make_reference_headers (ENVELOPE *curenv, ENVELOPE *env, CONTEXT *ctx)
{
  env->references = NULL;
  env->in_reply_to = NULL;
  
  if (!curenv)
  {
    HEADER *h;
    LIST **p = NULL, **q = NULL;
    int i;
    
    for(i = 0; i < ctx->vcount; i++)
    {
      h = ctx->hdrs[ctx->v2r[i]];
      if (h->tagged)
	mutt_add_to_reference_headers (env, h->env, &p, &q);
    }
  }
  else
    mutt_add_to_reference_headers (env, curenv, NULL, NULL);

  /* if there's more than entry in In-Reply-To (i.e. message has
     multiple parents), don't generate a References: header as it's
     discouraged by RfC2822, sect. 3.6.4 */
  if (ctx->tagged > 0 && env->in_reply_to && env->in_reply_to->next)
    mutt_free_list (&env->references);
}
Esempio n. 2
0
File: recvcmd.c Progetto: 0xAX/muttx
static int
attach_reply_envelope_defaults (struct envelope *env, ATTACHPTR **idx, short idxlen,
				struct header *parent, int flags)
{
	struct envelope *curenv = NULL;
	struct header *curhdr = NULL;
	short i;

	if (!parent)
	{
		for (i = 0; i < idxlen; i++)
		{
			if (idx[i]->content->tagged)
			{
				curhdr = idx[i]->content->hdr;
				curenv = curhdr->env;
				break;
			}
		}
	}
	else
	{
		curenv = parent->env;
		curhdr = parent;
	}

	if (curenv == NULL  ||  curhdr == NULL)
	{
		mutt_error ("Can't find any tagged messages.");
		return -1;
	}

	if (parent)
	{
		if (mutt_fetch_recips (env, curenv, flags) == -1)
			return -1;
	}
	else
	{
		for (i = 0; i < idxlen; i++)
		{
			if (idx[i]->content->tagged
			    && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1)
				return -1;
		}
	}

	if ((flags & SENDLISTREPLY) && !env->to)
	{
		mutt_error ("No mailing lists found!");
		return (-1);
	}

	mutt_fix_reply_recipients (env);
	mutt_make_misc_reply_headers (env, Context, curhdr, curenv);

	if (parent)
		mutt_add_to_reference_headers (env, curenv, NULL, NULL);
	else
	{
		struct list_t **p = NULL, **q = NULL;

		for (i = 0; i < idxlen; i++)
		{
			if (idx[i]->content->tagged)
				mutt_add_to_reference_headers (env, idx[i]->content->hdr->env, &p, &q);
		}
	}

	return 0;
}
Esempio n. 3
0
static int
attach_reply_envelope_defaults (ENVELOPE * env, ATTACHPTR ** idx,
                                short idxlen, HEADER * parent, int flags)
{
  ENVELOPE *curenv = NULL;
  HEADER *curhdr = NULL;
  short i;

  if (!parent) {
    for (i = 0; i < idxlen; i++) {
      if (idx[i]->content->tagged) {
        curhdr = idx[i]->content->hdr;
        curenv = curhdr->env;
        break;
      }
    }
  }
  else {
    curenv = parent->env;
    curhdr = parent;
  }

  if (curenv == NULL || curhdr == NULL) {
    mutt_error _("Can't find any tagged messages.");

    return -1;
  }

#ifdef USE_NNTP
  if ((flags & SENDNEWS)) {
    /* in case followup set Newsgroups: with Followup-To: if it present */
    if (!env->newsgroups && curenv &&
        str_casecmp (curenv->followup_to, "poster"))
      env->newsgroups = str_dup (curenv->followup_to);
  }
  else
#endif
  {
    if (parent) {
      if (mutt_fetch_recips (env, curenv, flags) == -1)
        return -1;
    }
    else {
      for (i = 0; i < idxlen; i++) {
        if (idx[i]->content->tagged
            && mutt_fetch_recips (env, idx[i]->content->hdr->env,
                                  flags) == -1)
          return -1;
      }
    }

    if ((flags & SENDLISTREPLY) && !env->to) {
      mutt_error _("No mailing lists found!");

      return (-1);
    }

    mutt_fix_reply_recipients (env);
  }
  mutt_make_misc_reply_headers (env, Context, curhdr, curenv);

  if (parent)
    mutt_add_to_reference_headers (env, curenv, NULL, NULL);
  else {
    LIST **p = NULL, **q = NULL;

    for (i = 0; i < idxlen; i++) {
      if (idx[i]->content->tagged)
        mutt_add_to_reference_headers (env, idx[i]->content->hdr->env, &p,
                                       &q);
    }
  }

  return 0;
}