#ifndef IMAP_MSGPART_H
#define IMAP_MSGPART_H
struct imap_msgpart;
struct imap_msgpart_open_result {
/* message contents with CRLF linefeeds */
/* size of input */
/* if size was looked up using cache and it ends up being wrong,
this field can be used to log about cache corruption */
/* TRUE if BINARY decoded content contains NUL characters */
};
struct imap_msgpart *imap_msgpart_full(void);
struct imap_msgpart *imap_msgpart_header(void);
struct imap_msgpart *imap_msgpart_body(void);
/* Parse section into imap_msgpart. Returns 0 and msgpart_r on success,
-1 if the section isn't valid. The same imap_msgpart can be used to open
multiple messages. */
/* Returns TRUE if the msgpart might return at least part of the message body.
Or alternatively: If FALSE is returned, the msgpart will never return
anything except (part of) the message header. MIME headers are counted
as part of the message body. */
/* Decode MIME parts with Content-Transfer-Encoding: base64/quoted-printable
to binary data (IMAP BINARY extension). If something can't be decoded, fails
with storage error set to MAIL_ERROR_CONVERSION. */
/* Set the fetch to be partial. For unlimited size use (uoff_t)-1. */
/* Return wanted_fields mask. */
/* Append all the specifically requested headers to the headers array
(no deduplication is done) */
/* Open message part refenced by IMAP section as istream. Returns 0 if
successful, -1 if storage error. Returned istream is initially referenced,
so i_stream_unref() must be called for it. */
struct imap_msgpart_open_result *result_r);
/* Return msgpart's size without actually opening the stream (if possible). */
/* Return msgpart's IMAP BODYPARTSTRUCTURE */
struct imap_msgpart *msgpart,
const char **bpstruct_r);
/* Header context is automatically created by imap_msgpart_open() and destroyed
by imap_msgpart_free(), but if you want to use the same imap_msgpart across
multiple mailboxes, you need to close the part before closing the mailbox. */
#endif