Skip to content

Commit

Permalink
mshow: add "-A all" to render all attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
leahneukirchen committed Jan 17, 2021
1 parent 8e0d574 commit 318ac21
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion contrib/_mblaze
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ _mshow() {
- regular \
'-n[only print message numbers]' \
'-h[display only given headers]:header list:_mblaze_colon_separated_headers' \
'-A[mixed/alternative preference]:mime type: ' \
'-A[multipart/alternative preference]:mime type: ' \
'-n[don'\''t update current message link]' \
'(-r)-q[print only header]' \
'(-q)-r[print body raw]' \
Expand Down
15 changes: 12 additions & 3 deletions man/mshow.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Dd August 24, 2018
.Dd January 17, 2021
.Dt MSHOW 1
.Os
.Sh NAME
Expand Down Expand Up @@ -47,17 +47,26 @@ instead of the default headers
.Sq Li from\&:subject\&:to\&:cc\&:date\&:reply\&-to\&: .
.It Fl A Ar mimetypes
Define
.Sq Li "mixed/alternative"
.Sq Li "multipart/alternative"
preference.
.Ar mimetypes
is a colon-separated list of
MIME types which will be preferred,
in the order given,
when rendering
.Sq Li "mixed/alternative"
.Sq Li "multipart/alternative"
parts.
If no MIME type matches, the first MIME part will be rendered.
.Pp
When
.Ar mimetypes
is
.Sq Li all ,
.Nm
will render all parts of a
.Sq Li "multipart/alternative"
part.
.Pp
Defaults to
.Sq Li "text/plain:text/html" .
.It Fl n
Expand Down
7 changes: 4 additions & 3 deletions mshow.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,10 @@ render_mime(int depth, struct message *msg, char *body, size_t bodylen)
}
printf("\n");
} else if (strncmp(ct, "multipart/alternative", 21) == 0) {
choose_alternative(msg, depth);

r = MIME_PRUNE;
if (strcmp(Aflag, "all") != 0) {
choose_alternative(msg, depth);
r = MIME_PRUNE;
} // else default blaze822_mime_walk action
} else if (strncmp(ct, "multipart/", 10) == 0) {
; // default blaze822_mime_walk action
} else {
Expand Down

0 comments on commit 318ac21

Please sign in to comment.