message-decoder.h revision 345253fb28498b2e0a60f4a2a8644c65feee7e75
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#ifndef __MESSAGE_DECODER_H
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#define __MESSAGE_DECODER_H
c0435c854a0e7246373b9752d163095cc4fbe985Timo Sirainen
cc77c1cfe8d072765f793474f49fecd897525466Stephan Boschstruct message_block;
cc77c1cfe8d072765f793474f49fecd897525466Stephan Bosch
5ce2084ada06ade9f44fc2914c34658e9a842dc1Timo Sirainen/* Decode message's contents as UTF-8, both the headers and the MIME bodies.
a24665de9d5c773115a5918e60ed587aafe67d5cTimo Sirainen The bodies are decoded from quoted-printable and base64 formats if needed.
5ce2084ada06ade9f44fc2914c34658e9a842dc1Timo Sirainen If dtcase=TRUE, the data is returned through
c0435c854a0e7246373b9752d163095cc4fbe985Timo Sirainen uni_utf8_to_decomposed_titlecase(). */
c0435c854a0e7246373b9752d163095cc4fbe985Timo Sirainenstruct message_decoder_context *message_decoder_init(bool dtcase);
c0435c854a0e7246373b9752d163095cc4fbe985Timo Sirainenvoid message_decoder_deinit(struct message_decoder_context **ctx);
a1973d0f171b027f9a7c642bc1c2134293731e1cTimo Sirainen
a1973d0f171b027f9a7c642bc1c2134293731e1cTimo Sirainen/* Decode input and return decoded output. Headers are returned only in their
a1973d0f171b027f9a7c642bc1c2134293731e1cTimo Sirainen full multiline forms.
a1973d0f171b027f9a7c642bc1c2134293731e1cTimo Sirainen
a1973d0f171b027f9a7c642bc1c2134293731e1cTimo Sirainen Returns TRUE if output is given, FALSE if more data is needed. If the input
a1973d0f171b027f9a7c642bc1c2134293731e1cTimo Sirainen ends in a partial character, it's returned in the next output. */
a1973d0f171b027f9a7c642bc1c2134293731e1cTimo Sirainenbool message_decoder_decode_next_block(struct message_decoder_context *ctx,
a1973d0f171b027f9a7c642bc1c2134293731e1cTimo Sirainen struct message_block *input,
88b8c5db9f66bdbb70d274d8592947716f364c36Timo Sirainen struct message_block *output);
c0435c854a0e7246373b9752d163095cc4fbe985Timo Sirainen
c0435c854a0e7246373b9752d163095cc4fbe985Timo Sirainen#endif
f40e6ef5190f68c2fd0e94c0b001bdf7d160236aTimo Sirainen