static int envelope_defaults (ENVELOPE *env, CONTEXT *ctx, HEADER *cur, int flags) { ENVELOPE *curenv = NULL; int i = 0, tag = 0; if (!cur) { tag = 1; for (i = 0; i < ctx->vcount; i++) if (ctx->hdrs[ctx->v2r[i]]->tagged) { cur = ctx->hdrs[ctx->v2r[i]]; curenv = cur->env; break; } if (!cur) { /* This could happen if the user tagged some messages and then did * a limit such that none of the tagged message are visible. */ mutt_error _("No tagged messages are visible!"); return (-1); } } else curenv = cur->env; if (flags & SENDREPLY) { if (tag) { HEADER *h; for (i = 0; i < ctx->vcount; i++) { h = ctx->hdrs[ctx->v2r[i]]; if (h->tagged && mutt_fetch_recips (env, h->env, flags) == -1) return -1; } } else if (mutt_fetch_recips (env, curenv, flags) == -1) return -1; if ((flags & SENDLISTREPLY) && !env->to) { mutt_error _("No mailing lists found!"); return (-1); } mutt_make_misc_reply_headers (env, ctx, cur, curenv); mutt_make_reference_headers (tag ? NULL : curenv, env, ctx); } else if (flags & SENDFORWARD) mutt_make_forward_subject (env, ctx, cur); return (0); }
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; }
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; }