diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-06-02 12:30:56 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-06-02 12:30:56 +0300 |
commit | 2c410af37c282a50492f399735f7acf1e61ad959 (patch) | |
tree | 48af20bc41d2623c394888854d8e6511c888fde9 /include | |
parent | f859272c0535106e2fdfc4520e738b03c19a5a7d (diff) | |
download | mailutils-2c410af37c282a50492f399735f7acf1e61ad959.tar.gz mailutils-2c410af37c282a50492f399735f7acf1e61ad959.tar.bz2 |
Improve message part iterator and readmsg output
* include/mailutils/message.h (mu_coord_t): New data type.
(mu_coord_alloc, mu_coord_realloc)
(mu_coord_dup, mu_coord_string): New protos.
(mu_coord_length): New function.
* libmailutils/base/Makefile.am: Add coord.c
* libmailutils/base/coord.c: New file.
* libmailutils/mime/mimeitr.c: Key returned by mu_iterator_current_kv
is allocated in the struct mimeitr. Caller may not free it.
(struct mimeitr): New member: coord.
(getitem): Reallocate coord.
(mimeitr_free): New function.
(destroy): Use mimeitr_free.
(itrdup): Duplicate coord
(mu_message_get_iterator): Initialize coord.
* libmailutils/tests/mimeitr.c: Use mu_coord_string to print the part
coordinates.
* readmsg/msglist.c (message_body_stream): New argument: unix_header.
Install additional "FROM" encoding filter if it is set.
(print_header): Special handling for "*" in the weedlist.
(msgpart_str): Remove. Use mu_coord_string instead.
(main): In mime decode mode, if -h (display all headers) is requested,
ignore MIME headers, since after decoding they are no longer relevant.
Diffstat (limited to 'include')
-rw-r--r-- | include/mailutils/message.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/mailutils/message.h b/include/mailutils/message.h index b6c0ec23b..cacee0f06 100644 --- a/include/mailutils/message.h +++ b/include/mailutils/message.h @@ -270,7 +270,24 @@ extern int mu_message_from_stream_with_envelope (mu_message_t *pmsg, extern int mu_stream_to_message (mu_stream_t instream, mu_message_t *pmsg); extern int mu_message_get_iterator (mu_message_t msg, mu_iterator_t *pitr); + +/* + * Message part coordinates + */ +typedef size_t *mu_coord_t; +int mu_coord_alloc (mu_coord_t *ptr, size_t n); +int mu_coord_realloc (mu_coord_t *ptr, size_t n); +int mu_coord_dup (mu_coord_t orig, mu_coord_t *copy); + +static inline size_t +mu_coord_length (mu_coord_t c) +{ + return c[0]; +} + +char *mu_coord_string (mu_coord_t c); + #ifdef __cplusplus } #endif |