message/rfc822 body parts.
/* Use built-in handler */
set_option (OPTVIEWATTACH); /* disable the "use 'v' to view this part"
* message in case of error */
- if (mutt_decode_save_attachment (fp, a, pagerfile, 1, 0))
+ if (mutt_decode_save_attachment (fp, a, pagerfile, M_DISPLAY, 0))
{
unset_option (OPTVIEWATTACH);
goto return_error;
HEADER *saved_hdr = NULL;
memset (&s, 0, sizeof (s));
- s.flags = (displaying ? M_DISPLAY : 0);
+ s.flags = displaying;
if (flags == M_SAVE_APPEND)
s.fpout = fopen (path, "a");
fpout = NULL;
mutt_mktemp (newfile);
- if (mutt_decode_save_attachment (fp, a, newfile, 0, 0) == 0)
+ if (mutt_decode_save_attachment (fp, a, newfile, M_PRINTING, 0) == 0)
{
dprint (2, (debugfile, "successfully decoded %s type attachment to %s\n",
mutt_message (h ? _("Message bounced.") : _("Messages bounced."));
}
-static void pipe_set_flags (int decode, int *cmflags, int *chflags)
+static void pipe_set_flags (int decode, int print, int *cmflags, int *chflags)
{
if (decode)
{
*cmflags |= M_CM_WEED;
}
}
+
+ if (print)
+ *cmflags |= M_CM_PRINTING;
+
}
-void pipe_msg (HEADER *h, FILE *fp, int decode)
+void pipe_msg (HEADER *h, FILE *fp, int decode, int print)
{
int cmflags = 0;
int chflags = CH_FROM;
- pipe_set_flags (decode, &cmflags, &chflags);
+ pipe_set_flags (decode, print, &cmflags, &chflags);
#ifdef HAVE_PGP
/* the following code is shared between printing and piping */
static int _mutt_pipe_message (HEADER *h, char *cmd,
- int decode,
- int split,
- char *sep)
+ int decode,
+ int print,
+ int split,
+ char *sep)
{
int i, rc = 0;
return 1;
}
- pipe_msg (h, fpout, decode);
+ pipe_msg (h, fpout, decode, print);
safe_fclose (&fpout);
rc = mutt_wait_filter (thepid);
}
mutt_perror _("Can't create filter process");
return 1;
}
- pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode);
+ pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode, print);
/* add the message separator */
if (sep) fputs (sep, fpout);
safe_fclose (&fpout);
if (Context->hdrs[Context->v2r[i]]->tagged)
{
mutt_message_hook (Context, Context->hdrs[Context->v2r[i]], M_MESSAGEHOOK);
- pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode);
+ pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode, print);
/* add the message separator */
if (sep) fputs (sep, fpout);
}
mutt_expand_path (buffer, sizeof (buffer));
_mutt_pipe_message (h, buffer,
option (OPTPIPEDECODE),
+ 0,
option (OPTPIPESPLIT),
PipeSep);
}
if (_mutt_pipe_message (h, PrintCmd,
option (OPTPRINTDECODE),
+ 1,
option (OPTPRINTSPLIT),
"\f") == 0)
mutt_message (h ? _("Message printed") : _("Messages printed"));
* M_CM_PREFIX quote header and body
* M_CM_DECODE decode message body to text/plain
* M_CM_DISPLAY displaying output to the user
+ * M_CM_PRINTING printing the message
* M_CM_UPDATE update structures in memory after syncing
* M_CM_DECODE_PGP used for decoding PGP messages
* M_CM_CHARCONV perform character set conversion
s.prefix = prefix;
if (flags & M_CM_DISPLAY)
s.flags |= M_DISPLAY;
+ if (flags & M_CM_PRINTING)
+ s.flags |= M_PRINTING;
if (flags & M_CM_WEED)
s.flags |= M_WEED;
if (flags & M_CM_CHARCONV)
#define M_CM_UPDATE (1<<4) /* update structs on sync */
#define M_CM_WEED (1<<5) /* weed message/rfc822 attachment headers */
#define M_CM_CHARCONV (1<<6) /* perform character set conversions */
+#define M_CM_PRINTING (1<<7) /* printing the message - display light */
#ifdef HAVE_PGP
-#define M_CM_DECODE_PGP (1<<7) /* used for decoding PGP messages */
-#define M_CM_VERIFY (1<<8) /* do signature verification */
+#define M_CM_DECODE_PGP (1<<8) /* used for decoding PGP messages */
+#define M_CM_VERIFY (1<<9) /* do signature verification */
#endif
if (b->parts)
{
mutt_copy_hdr (s->fpin, s->fpout, off_start, b->parts->offset,
- (((s->flags & M_WEED) || ((s->flags & M_DISPLAY) && option (OPTWEED))) ? (CH_WEED | CH_REORDER) : 0) |
+ (((s->flags & M_WEED) || ((s->flags & (M_DISPLAY|M_PRINTING)) && option (OPTWEED))) ? (CH_WEED | CH_REORDER) : 0) |
(s->prefix ? CH_PREFIX : 0) | CH_DECODE | CH_FROM, s->prefix);
if (s->prefix)
if (!ascii_strcasecmp (access_type, "x-mutt-deleted"))
{
- if (s->flags & M_DISPLAY)
+ if (s->flags & (M_DISPLAY|M_PRINTING))
{
char *length;
char pretty_size[10];
#define M_PENDINGPREFIX (1<<2) /* prefix to write, but character must follow */
#define M_WEED (1<<3) /* weed headers even when not in display mode */
#define M_CHARCONV (1<<4) /* Do character set conversions */
+#define M_PRINTING (1<<5) /* are we printing? - M_DISPLAY "light" */
#define state_set_prefix(s) ((s)->flags |= M_PENDINGPREFIX)
#define state_reset_prefix(s) ((s)->flags &= ~M_PENDINGPREFIX)
FILE *ifp;
mutt_mktemp (newfile);
- if (mutt_decode_save_attachment (fp, top, newfile, 0, 0) == 0)
+ if (mutt_decode_save_attachment (fp, top, newfile, M_PRINTING, 0) == 0)
{
if ((ifp = fopen (newfile, "r")) != NULL)
{