(var_quote): Output prefix sequence before each line of multiline headers.
Showing
1 changed file
with
18 additions
and
4 deletions
... | @@ -452,7 +452,7 @@ var_quote (int argc, char **argv, compose_env_t *env) | ... | @@ -452,7 +452,7 @@ var_quote (int argc, char **argv, compose_env_t *env) |
452 | size_t n = 0; | 452 | size_t n = 0; |
453 | char *prefix = "\t"; | 453 | char *prefix = "\t"; |
454 | 454 | ||
455 | if (util_get_message (mbox, cursor, &mesg, 1)) | 455 | if (util_get_message (mbox, cursor, &mesg, MSG_NODELETED)) |
456 | return 1; | 456 | return 1; |
457 | 457 | ||
458 | fprintf (stdout, "Interpolating: %d\n", cursor); | 458 | fprintf (stdout, "Interpolating: %d\n", cursor); |
... | @@ -472,12 +472,26 @@ var_quote (int argc, char **argv, compose_env_t *env) | ... | @@ -472,12 +472,26 @@ var_quote (int argc, char **argv, compose_env_t *env) |
472 | header_get_field_name (hdr, i, buf, sizeof buf, NULL); | 472 | header_get_field_name (hdr, i, buf, sizeof buf, NULL); |
473 | if (mail_header_is_visible (buf)) | 473 | if (mail_header_is_visible (buf)) |
474 | { | 474 | { |
475 | char *value; | ||
476 | |||
475 | fprintf (ofile, "%s%s: ", prefix, buf); | 477 | fprintf (ofile, "%s%s: ", prefix, buf); |
476 | header_get_field_value (hdr, i, buf, sizeof buf, NULL); | 478 | if (header_aget_value (hdr, buf, &value) == 0) |
477 | fprintf (ofile, "%s\n", buf); | 479 | { |
480 | int i; | ||
481 | char *p, *s; | ||
482 | |||
483 | for (i = 0, p = strtok_r (value, "\n", &s); p; | ||
484 | p = strtok_r (NULL, "\n", &s), i++) | ||
485 | { | ||
486 | if (i) | ||
487 | fprintf (ofile, "%s", prefix); | ||
488 | fprintf (ofile, "%s\n", p); | ||
489 | } | ||
490 | free (value); | ||
491 | } | ||
478 | } | 492 | } |
479 | } | 493 | } |
480 | fprintf (ofile, "\n"); | 494 | fprintf (ofile, "%s\n", prefix); |
481 | message_get_body (mesg, &body); | 495 | message_get_body (mesg, &body); |
482 | body_get_stream (body, &stream); | 496 | body_get_stream (body, &stream); |
483 | } | 497 | } | ... | ... |
-
Please register or sign in to post a comment