diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-12-09 13:28:02 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-12-09 13:28:02 +0200 |
commit | 819739696b8b087d311655b639db7b14fef48f02 (patch) | |
tree | fe2fa5173bbcff0851148f58cda549c6cec8424d /include | |
parent | 7bc05c7755523cdb1222463e5e3c9e71f6906f18 (diff) | |
download | mailutils-819739696b8b087d311655b639db7b14fef48f02.tar.gz mailutils-819739696b8b087d311655b639db7b14fef48f02.tar.bz2 |
Provide function for parsing the Content-Type header (RFC 2045).
* include/mailutils/util.h (mu_content_type, mu_param): New structs.
(mu_content_type_t): New typedef.
(mu_content_type_parse, mu_content_type_destroy): New protos.
* libmailutils/base/ctparse.c: New file.
* libmailutils/base/Makefile.am: Add new file.
* imap4d/fetch.c: Use mu_content_type_parse to parse the header.
* libmailutils/tests/conttype.c: New file.
* libmailutils/tests/Makefile.am: Add new file.
Diffstat (limited to 'include')
-rw-r--r-- | include/mailutils/util.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/mailutils/util.h b/include/mailutils/util.h index 1d994ddba..60bc99c65 100644 --- a/include/mailutils/util.h +++ b/include/mailutils/util.h @@ -124,6 +124,29 @@ int mu_rfc2822_references (mu_message_t msg, char **pstr); int mu_rfc2822_in_reply_to (mu_message_t msg, char **pstr); /* ----------------------- */ + /* ----------------------- */ +struct mu_content_type +{ + char *type; + char *subtype; + char *trailer; + mu_list_t param; +}; + +typedef struct mu_content_type *mu_content_type_t; + +struct mu_param +{ + char *name; + char *value; +}; + + + +int mu_content_type_parse (const char *input, mu_content_type_t *retct); +void mu_content_type_destroy (mu_content_type_t *pptr); + + /* ----------------------- */ /* Filter+iconv */ /* ----------------------- */ int mu_decode_filter (mu_stream_t *pfilter, mu_stream_t input, |