diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-08-01 22:24:56 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-08-01 22:24:56 +0300 |
commit | b1d907181773eac9a53d70f7af1c6abc8a8d74f4 (patch) | |
tree | e02e5bf65003d02b3e5005aaf094bdc0868aa324 /include | |
parent | 2843c4054207db33a1237a6991143564c086b3d2 (diff) | |
download | mailutils-b1d907181773eac9a53d70f7af1c6abc8a8d74f4.tar.gz mailutils-b1d907181773eac9a53d70f7af1c6abc8a8d74f4.tar.bz2 |
New function to reconstruct message envelope from the headers.
* include/mailutils/sys/message_stream.h (_mu_message_stream): Reorganize
structure.
* libmailutils/base/amd.c: Use mu_message_reconstruct_envelope instead
of the amd-specific envelope functions.
* libmailutils/stream/message_stream.c: Likewise.
* libmailutils/tests/readmesg.at: New test case.
* libmailutils/tests/readmesg.c: New test program.
* libmailutils/tests/Makefile.am: Add new tests.
* libmailutils/tests/testsuite.at: Likewise.
* mh/tests/mhl.at: Update expected output.
* mh/tests/mhn.at: Likewise.
* testsuite/mh/mbox1/: Fix timestamps in X-Envelope-Date
* testsuite/mh/teaparty/: Likewise.
Diffstat (limited to 'include')
-rw-r--r-- | include/mailutils/sys/message_stream.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/include/mailutils/sys/message_stream.h b/include/mailutils/sys/message_stream.h index 296f0d7c0..66f321a57 100644 --- a/include/mailutils/sys/message_stream.h +++ b/include/mailutils/sys/message_stream.h @@ -19,22 +19,31 @@ #include <mailutils/sys/stream.h> +struct mu_substring_location +{ + size_t start; + size_t length; +}; + struct _mu_message_stream { struct _mu_stream stream; mu_stream_t transport; /* Actual stream */ mu_off_t offset; - int construct_envelope; - char *envelope_string; - size_t envelope_length; - char *from; - char *date; - size_t mark_offset; /* Offset of the header separator */ - size_t mark_length; /* Length of the header separator (not counting the - newline) */ - mu_off_t body_start; - mu_off_t body_end; + int construct_envelope; /* If 1, construct the envelope. */ + char *envelope_string; /* The From_ line, if found. */ + size_t envelope_length; /* Total length of the From_ line, + including trailing whitespace (if any) + and final \n. */ + struct mu_substring_location from; /* Sender location in envelope_string. */ + struct mu_substring_location date; /* Date location in envelope_string. */ + + struct mu_substring_location mark; /* Location of the header separator in + stream. */ + + mu_off_t body_start; /* Start of the body. */ + mu_off_t body_end; /* End of the body. */ }; struct _mu_body_stream |