Mercurial > dovecot > core-2.2
changeset 18705:4cd9e46e0c78
lib-imap-storage: Added imap_msgpart_contains_body()
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 15 May 2015 14:34:54 +0300 |
parents | c627a0f64719 |
children | 93bba97afb2a |
files | src/lib-imap-storage/imap-msgpart.c src/lib-imap-storage/imap-msgpart.h |
diffstat | 2 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-imap-storage/imap-msgpart.c Fri May 15 14:03:02 2015 +0300 +++ b/src/lib-imap-storage/imap-msgpart.c Fri May 15 14:34:54 2015 +0300 @@ -306,6 +306,22 @@ pool_unref(&msgpart->pool); } +bool imap_msgpart_contains_body(const struct imap_msgpart *msgpart) +{ + switch (msgpart->fetch_type) { + case FETCH_HEADER: + case FETCH_HEADER_FIELDS: + case FETCH_HEADER_FIELDS_NOT: + return FALSE; + case FETCH_FULL: + case FETCH_MIME: + case FETCH_MIME_BODY: + case FETCH_BODY: + break; + } + return TRUE; +} + void imap_msgpart_set_decode_to_binary(struct imap_msgpart *msgpart) { msgpart->decode_cte_to_binary = TRUE;
--- a/src/lib-imap-storage/imap-msgpart.h Fri May 15 14:03:02 2015 +0300 +++ b/src/lib-imap-storage/imap-msgpart.h Fri May 15 14:34:54 2015 +0300 @@ -24,6 +24,11 @@ int imap_msgpart_parse(const char *section, struct imap_msgpart **msgpart_r); void imap_msgpart_free(struct imap_msgpart **msgpart); +/* 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. */ +bool imap_msgpart_contains_body(const struct imap_msgpart *msgpart); /* 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. */