diff options
-rw-r--r-- | attach.c | 6 | ||||
-rw-r--r-- | commands.c | 25 | ||||
-rw-r--r-- | copy.c | 3 | ||||
-rw-r--r-- | copy.h | 5 | ||||
-rw-r--r-- | handler.c | 4 | ||||
-rw-r--r-- | mutt.h | 1 | ||||
-rw-r--r-- | recvattach.c | 2 |
7 files changed, 29 insertions, 17 deletions
@@ -543,7 +543,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, /* 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; @@ -801,7 +801,7 @@ int mutt_decode_save_attachment (FILE *fp, BODY *m, char *path, 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"); @@ -981,7 +981,7 @@ int mutt_print_attachment (FILE *fp, BODY *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", @@ -256,7 +256,7 @@ void ci_bounce_message (HEADER *h, int *redraw) 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) { @@ -269,14 +269,18 @@ static void pipe_set_flags (int decode, int *cmflags, int *chflags) *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 @@ -299,9 +303,10 @@ void pipe_msg (HEADER *h, FILE *fp, int decode) /* 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; @@ -330,7 +335,7 @@ static int _mutt_pipe_message (HEADER *h, char *cmd, return 1; } - pipe_msg (h, fpout, decode); + pipe_msg (h, fpout, decode, print); safe_fclose (&fpout); rc = mutt_wait_filter (thepid); } @@ -368,7 +373,7 @@ static int _mutt_pipe_message (HEADER *h, char *cmd, 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); @@ -390,7 +395,7 @@ static int _mutt_pipe_message (HEADER *h, char *cmd, 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); } @@ -418,6 +423,7 @@ void mutt_pipe_message (HEADER *h) mutt_expand_path (buffer, sizeof (buffer)); _mutt_pipe_message (h, buffer, option (OPTPIPEDECODE), + 0, option (OPTPIPESPLIT), PipeSep); } @@ -438,6 +444,7 @@ void mutt_print_message (HEADER *h) if (_mutt_pipe_message (h, PrintCmd, option (OPTPRINTDECODE), + 1, option (OPTPRINTSPLIT), "\f") == 0) mutt_message (h ? _("Message printed") : _("Messages printed")); @@ -417,6 +417,7 @@ static int count_delete_lines (FILE *fp, BODY *b, long *length, size_t datelen) * 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 @@ -519,6 +520,8 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body, 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) @@ -24,11 +24,12 @@ #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 @@ -1325,7 +1325,7 @@ void message_handler (BODY *a, STATE *s) 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) @@ -1596,7 +1596,7 @@ static void external_body_handler (BODY *b, STATE *s) 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]; @@ -777,6 +777,7 @@ typedef struct #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) diff --git a/recvattach.c b/recvattach.c index 6039f48f..b1c0ccd1 100644 --- a/recvattach.c +++ b/recvattach.c @@ -645,7 +645,7 @@ static void print_attachment_list (FILE *fp, int tag, BODY *top, STATE *state) 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) { |