diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/lib-mail/qp-encoder.h | |
parent | Initial commit. (diff) | |
download | dovecot-upstream.tar.xz dovecot-upstream.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib-mail/qp-encoder.h')
-rw-r--r-- | src/lib-mail/qp-encoder.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib-mail/qp-encoder.h b/src/lib-mail/qp-encoder.h new file mode 100644 index 0000000..f4a6148 --- /dev/null +++ b/src/lib-mail/qp-encoder.h @@ -0,0 +1,25 @@ +#ifndef QP_ENCODER_H +#define QP_ENCODER_H 1 + +enum qp_encoder_flag { + /* encode spaces as underscores, encode crlfs, adds =?utf-8?q?..?= encapsulation */ + QP_ENCODER_FLAG_HEADER_FORMAT = 0x1, + /* treat input as true binary, no lf => crlf conversion, only CRLF is preserved */ + QP_ENCODER_FLAG_BINARY_DATA = 0x2, +}; + +/* Initialize quoted-printable encoder. Write all the encoded output to dest. */ +struct qp_encoder *qp_encoder_init(string_t *dest, unsigned int max_length, + enum qp_encoder_flag flags); +void qp_encoder_deinit(struct qp_encoder **qp); + +/* Translate more (binary) data into quoted printable. + If QP_ENCODER_FLAG_BINARY_DATA is not set, text is assumed to be in + UTF-8 (but not enforced). No other character sets are supported. */ +void qp_encoder_more(struct qp_encoder *qp, const void *src, size_t src_size); +/* Finish encoding any pending input. + This function also resets the entire encoder state, so the same encoder can + be used to encode more data if wanted. */ +void qp_encoder_finish(struct qp_encoder *qp); + +#endif |