diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-04-17 15:33:12 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-04-18 19:00:32 +0300 |
commit | 27aae941c77f38392a1b058ce8fb04241c143331 (patch) | |
tree | ce4dce20c44837c5be0c004fefcd931089a88c50 /mh/repl.c | |
parent | c010cf73e93cbd46a89ef3a6e76a836974bb736b (diff) | |
download | mailutils-27aae941c77f38392a1b058ce8fb04241c143331.tar.gz mailutils-27aae941c77f38392a1b058ce8fb04241c143331.tar.bz2 |
Fix semantics of mu_header_set_value and creation of multipart/alternative MIME
Until now, mu_header_set_value called with replace=0 prepended the header
to the header list, if a header with such name was already present. This
has been changed. Now, if the header with the requested name is already
present, its action is as follows:
1. If repl is 0, return MU_ERR_EXISTS
2. Otherwise, replace the header with the new value.
If the header is not present, it is appended to the end of the header
list, instead of putting it at the beginning.
This change is incompatible and breaks the tests, that relied on a particular
field ordering. These are fixed as well.
The use of mu_header_set_value throughout the sources has been revised to
ensure that single-instance headers are never added twice.
This change also facilitates the second part of this commit, which
fixes creation of the multipart/alternative message by the mail utility.
* libmailutils/mailbox/header.c (mu_header_set_value): Fix semantics.
If the replace parameter is not set and the header field with the
given name already exists, return MU_ERR_EXISTS without changing
anything. If adding new header, append it to the end of the header
list, instead of pushing it to the top.
* configure.ac: Raise shared library revision number.
* libmu_scm/mu_message.c (mu-message-set-header)
(mu-message-set-header-fields): call mu_header_set_value explicitly if
repl is not set.
* libmu_sieve/extensions/moderator.c: Force replace header mode when
needed.
* libmu_sieve/extensions/vacation.c: Likewise.
* mh/mh_init.c (mh_annotate): Prepend the annotation header.
* mh/mhn.c: Force replace header mode when needed.
* mh/repl.c: Likewise.
* mh/send.c: Likewise.
* libmailutils/tests/modmesg01.at: Change expected header order.
* libmailutils/tests/modmesg03.at: Likewise.
* mh/tests/mhn.at: Likewise.
* mh/tests/send.at: Likewise.
* sieve/tests/moderator.at: Likewise.
* sieve/tests/redirect.at: Likewise.
* sieve/tests/reject.at: Likewise.
* sieve/tests/vacation.at: Likewise.
* examples/mta.c (message_finalize): Append X-Authentication-Warning,
instead of setting it.
Make sure Content-Disposition is not set for parts of a multipart/
alternative MIME message. Some mail readers (notably, yahoo),
misinterpret it.
* libmailutils/mime/attachment.c (at_hdr): Use mu_header_set_value
to set Content-Type and Content-Disposition.
* libmailutils/mime/mime.c (_mime_set_content_type): If the content
type is set to multipart/alternative, remove the Content-Disposition
headers from the message parts.
* mail/send.c (saveatt): Don't set content-disposition for
multipart/alternative, it is now done by the library.
(add_attachments): Warn about ignored headers.
Append only Received and X-* headers, replace others.
(parse_headers): Append headers.
(compose_header_set): Use mu_header_append if COMPOSE_APPEND is requested.
* mail/util.c (util_header_expand): Use mu_header_append.
Diffstat (limited to 'mh/repl.c')
-rw-r--r-- | mh/repl.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -247,7 +247,7 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh) mu_message_create_copy (&tmp_msg, msg); mu_message_get_header (tmp_msg, &hdr); text = mu_opool_finish (fcc_pool, NULL); - mu_header_set_value (hdr, MU_HEADER_FCC, text, 0); + mu_header_set_value (hdr, MU_HEADER_FCC, text, 1); mh_format (&format, tmp_msg, msgno, width, &buf); mu_message_destroy (&tmp_msg, NULL); } |