Commit 0e055ab7 authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

Add config vars for forwarded message attribution intro/trailer.

Add $forward_attribution_intro and $forward_attribution_trailer to
allow the default strings to be overridden.
parent a040e912
......@@ -51,6 +51,8 @@ WHERE char *DsnReturn;
WHERE char *Editor;
WHERE char *EscChar;
WHERE char *FolderFormat;
WHERE char *ForwardAttrIntro;
WHERE char *ForwardAttrTrailer;
WHERE char *ForwFmt;
WHERE char *Fqdn;
WHERE char *HdrFmt;
......
......@@ -888,6 +888,22 @@ struct option_t MuttVars[] = {
** .pp
** Also see the $$record variable.
*/
{ "forward_attribution_intro", DT_STR, R_NONE, UL &ForwardAttrIntro, UL "----- Forwarded message from %f -----" },
/*
** .pp
** This is the string that will precede a message which has been forwarded
** in the main body of a message (when $$mime_forward is unset).
** For a full listing of defined \fCprintf(3)\fP-like sequences see
** the section on $$index_format. See also $$attribution_locale.
*/
{ "forward_attribution_trailer", DT_STR, R_NONE, UL &ForwardAttrTrailer, UL "----- End forwarded message -----" },
/*
** .pp
** This is the string that will follow a message which has been forwarded
** in the main body of a message (when $$mime_forward is unset).
** For a full listing of defined \fCprintf(3)\fP-like sequences see
** the section on $$index_format. See also $$attribution_locale.
*/
{ "forward_decode", DT_BOOL, R_NONE, OPTFORWDECODE, 1 },
/*
** .pp
......
......@@ -207,8 +207,8 @@ void mutt_folder_hook (char *);
void mutt_format_string (char *, size_t, int, int, int, char, const char *, size_t, int);
void mutt_format_s (char *, size_t, const char *, const char *);
void mutt_format_s_tree (char *, size_t, const char *, const char *);
void mutt_forward_intro (FILE *fp, HEADER *cur);
void mutt_forward_trailer (FILE *fp);
void mutt_forward_intro (CONTEXT *ctx, HEADER *cur, FILE *fp);
void mutt_forward_trailer (CONTEXT *ctx, HEADER *cur, FILE *fp);
void mutt_free_alias (ALIAS **);
void mutt_free_body (BODY **);
void mutt_free_color (int fg, int bg);
......
......@@ -442,7 +442,7 @@ static void attach_forward_bodies (FILE * fp, HEADER * hdr,
return;
}
mutt_forward_intro (tmpfp, parent);
mutt_forward_intro (Context, parent, tmpfp);
/* prepare the prefix here since we'll need it later. */
......@@ -541,7 +541,7 @@ _("Can't decode all tagged attachments. MIME-forward the others?"))) == -1)
goto bail;
}
mutt_forward_trailer (tmpfp);
mutt_forward_trailer (Context, parent, tmpfp);
safe_fclose (&tmpfp);
tmpfp = NULL;
......@@ -641,9 +641,9 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr,
if (cur)
{
/* mutt_message_hook (cur->hdr, MUTT_MESSAGEHOOK); */
mutt_forward_intro (tmpfp, cur->hdr);
mutt_forward_intro (Context, cur->hdr, tmpfp);
_mutt_copy_message (tmpfp, fp, cur->hdr, cur->hdr->content, cmflags, chflags);
mutt_forward_trailer (tmpfp);
mutt_forward_trailer (Context, cur->hdr, tmpfp);
}
else
{
......@@ -652,10 +652,10 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr,
if (idx[i]->content->tagged)
{
/* mutt_message_hook (idx[i]->content->hdr, MUTT_MESSAGEHOOK); */
mutt_forward_intro (tmpfp, idx[i]->content->hdr);
mutt_forward_intro (Context, idx[i]->content->hdr, tmpfp);
_mutt_copy_message (tmpfp, fp, idx[i]->content->hdr,
idx[i]->content->hdr->content, cmflags, chflags);
mutt_forward_trailer (tmpfp);
mutt_forward_trailer (Context, idx[i]->content->hdr, tmpfp);
}
}
}
......
......@@ -324,20 +324,33 @@ static void process_user_header (ENVELOPE *env)
}
}
void mutt_forward_intro (FILE *fp, HEADER *cur)
void mutt_forward_intro (CONTEXT *ctx, HEADER *cur, FILE *fp)
{
char buffer[STRING];
fputs ("----- Forwarded message from ", fp);
buffer[0] = 0;
rfc822_write_address (buffer, sizeof (buffer), cur->env->from, 1);
fputs (buffer, fp);
fputs (" -----\n\n", fp);
char buffer[LONG_STRING];
if (ForwardAttrIntro)
{
setlocale (LC_TIME, NONULL (AttributionLocale));
mutt_make_string (buffer, sizeof (buffer), ForwardAttrIntro, ctx, cur);
setlocale (LC_TIME, "");
fputs (buffer, fp);
fputs ("\n\n", fp);
}
}
void mutt_forward_trailer (FILE *fp)
void mutt_forward_trailer (CONTEXT *ctx, HEADER *cur, FILE *fp)
{
fputs ("\n----- End forwarded message -----\n", fp);
char buffer[LONG_STRING];
if (ForwardAttrTrailer)
{
setlocale (LC_TIME, NONULL (AttributionLocale));
mutt_make_string (buffer, sizeof (buffer), ForwardAttrTrailer, ctx, cur);
setlocale (LC_TIME, "");
fputc ('\n', fp);
fputs (buffer, fp);
fputc ('\n', fp);
}
}
......@@ -354,7 +367,7 @@ static int include_forward (CONTEXT *ctx, HEADER *cur, FILE *out)
crypt_valid_passphrase (cur->security);
}
mutt_forward_intro (out, cur);
mutt_forward_intro (ctx, cur, out);
if (option (OPTFORWDECODE))
{
......@@ -373,7 +386,7 @@ static int include_forward (CONTEXT *ctx, HEADER *cur, FILE *out)
chflags |= CH_DISPLAY;
mutt_copy_message (out, ctx, cur, cmflags, chflags);
mutt_forward_trailer (out);
mutt_forward_trailer (ctx, cur, out);
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment