aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-29 15:55:57 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-29 15:55:57 +0200
commit8228619e05f14b92c6e4583f750af47dab79efe6 (patch)
tree24ca77e254514862d4c0b8a597ca3018560affb6
parent7636f0977cff47e152594902b69d99d9f0fc0232 (diff)
downloadmblaze-8228619e05f14b92c6e4583f750af47dab79efe6.tar.gz
mshow: allow filters to skip and select multipart parts
-rw-r--r--mshow.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mshow.c b/mshow.c
index 4d4e217..d5bd971 100644
--- a/mshow.c
+++ b/mshow.c
@@ -210,12 +210,24 @@ render_mime(int depth, struct message *msg, char *body, size_t bodylen)
if (e == 0) {
printf(" render=\"%s\" ---\n", cmd);
print_ascii(output, outlen);
+ } else if (e == 63) { // skip filter
+ free(output);
+ goto nofilter;
} else if (e == 64) { // decode output again
printf(" filter=\"%s\" ---\n", cmd);
struct message *imsg = blaze822_mem(output, outlen);
if (imsg)
walk_mime(imsg, depth+1, render_mime);
blaze822_free(imsg);
+ } else if (e >= 65 && e <= 80) { // choose N-64th part
+ struct message *imsg = 0;
+ int n = e - 64;
+ printf(" selector=\"%s\" part=%d ---\n", cmd, n);
+ while (blaze822_multipart(msg, &imsg)) {
+ if (--n == 0)
+ walk_mime(imsg, depth+1, render_mime);
+ }
+ blaze822_free(imsg);
} else {
printf(" filter=\"%s\" FAILED status=%d", cmd, e);
free(output);