summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2000-03-16 10:01:43 +0000
committerThomas Roessler <roessler@does-not-exist.org>2000-03-16 10:01:43 +0000
commit2551a481f781d58e35ee10ccff88edae6de1f0e0 (patch)
tree3189ab9bf07c1d9c7b0a5a0e5bc8d4e7f809624e
parentf28d4dd52b3cbd1f9e31d8bb747e8f4cea4fee74 (diff)
Add the $print_decode option.
-rw-r--r--commands.c41
-rw-r--r--init.h11
-rw-r--r--mutt.h1
3 files changed, 35 insertions, 18 deletions
diff --git a/commands.c b/commands.c
index 8c506259..1927690b 100644
--- a/commands.c
+++ b/commands.c
@@ -232,22 +232,27 @@ void ci_bounce_message (HEADER *h, int *redraw)
mutt_message (h ? _("Message bounced.") : _("Messages bounced."));
}
-void mutt_pipe_message_to_state (HEADER *h, STATE *s)
+static void pipe_print_set_flags (int decode, int *cmflags, int *chflags)
{
- int cmflags = 0;
- int chflags = CH_FROM;
-
- if (option (OPTPIPEDECODE))
+ if (decode)
{
- cmflags |= M_CM_DECODE | M_CM_CHARCONV;
- chflags |= CH_DECODE | CH_REORDER;
+ *cmflags |= M_CM_DECODE | M_CM_CHARCONV;
+ *chflags |= CH_DECODE | CH_REORDER;
if (option (OPTWEED))
{
- chflags |= CH_WEED;
- cmflags |= M_CM_WEED;
+ *chflags |= CH_WEED;
+ *cmflags |= M_CM_WEED;
}
}
+}
+
+void mutt_pipe_message_to_state (HEADER *h, STATE *s)
+{
+ int cmflags = 0;
+ int chflags = CH_FROM;
+
+ pipe_print_set_flags (option (OPTPIPEDECODE), &cmflags, &chflags);
if (option (OPTPIPEDECODE))
mutt_parse_mime_message (Context, h);
@@ -686,19 +691,17 @@ int mutt_save_message (HEADER *h, int delete,
return -1;
}
+/* XXX - merge this with mutt_pipe_message_to_state? */
+
static void print_msg (FILE *fp, CONTEXT *ctx, HEADER *h)
{
- int cmflags = M_CM_DECODE | M_CM_CHARCONV;
- int chflags = CH_DECODE | CH_REORDER;
+ int cmflags = 0;
+ int chflags = CH_FROM;
- if (option (OPTWEED))
- {
- cmflags |= M_CM_WEED;
- chflags |= CH_WEED;
- }
+ pipe_print_set_flags (option (OPTPRINTDECODE), &cmflags, &chflags);
#ifdef HAVE_PGP
- if (h->pgp & PGPENCRYPT)
+ if (option (OPTPRINTDECODE) && (h->pgp & PGPENCRYPT))
{
if (!pgp_valid_passphrase ())
return;
@@ -706,7 +709,9 @@ static void print_msg (FILE *fp, CONTEXT *ctx, HEADER *h)
}
#endif
- mutt_parse_mime_message (ctx, h);
+ if (option (OPTPRINTDECODE))
+ mutt_parse_mime_message (ctx, h);
+
mutt_copy_message (fp, ctx, h, cmflags, chflags);
}
diff --git a/init.h b/init.h
index a7c4901f..acb3697e 100644
--- a/init.h
+++ b/init.h
@@ -1462,6 +1462,17 @@ struct option_t MuttVars[] = {
{ "print_cmd", DT_SYN, R_NONE, UL "print_command", 0 },
/*
*/
+ { "print_decode", DT_BOOL, R_NONE, OPTPRINTDECODE, 1 },
+ /*
+ ** .pp
+ ** Used in connection with the print-message command. If this
+ ** option is set, the message is decoded before it is passed to the
+ ** external command specified by $$print_command. If this option
+ ** is unset, no processing will be applied to the message when
+ ** printing it. The latter setting may be useful if you are using
+ ** some advanced printer filter which is able to properly format
+ ** e-mail messages for printing.
+ */
{ "prompt_after", DT_BOOL, R_NONE, OPTPROMPTAFTER, 1 },
/*
** .pp
diff --git a/mutt.h b/mutt.h
index da8bd213..48212dab 100644
--- a/mutt.h
+++ b/mutt.h
@@ -321,6 +321,7 @@ enum
OPTPIPESPLIT,
OPTPOPDELETE,
OPTPOPLAST,
+ OPTPRINTDECODE,
OPTPROMPTAFTER,
OPTREADONLY,
OPTREPLYSELF,