dovecot-2.2: imap: Send FETCH BINARY output using literal8.
dovecot at dovecot.org
dovecot at dovecot.org
Sat Aug 11 05:47:13 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/f0feae227c60
changeset: 14860:f0feae227c60
user: Timo Sirainen <tss at iki.fi>
date: Sat Aug 11 05:47:03 2012 +0300
description:
imap: Send FETCH BINARY output using literal8.
diffstat:
src/imap/imap-fetch-body.c | 13 ++++++++-----
src/lib-imap-storage/imap-msgpart.c | 3 +++
2 files changed, 11 insertions(+), 5 deletions(-)
diffs (51 lines):
diff -r f3ef88e19cd5 -r f0feae227c60 src/imap/imap-fetch-body.c
--- a/src/imap/imap-fetch-body.c Sat Aug 11 05:31:46 2012 +0300
+++ b/src/imap/imap-fetch-body.c Sat Aug 11 05:47:03 2012 +0300
@@ -58,7 +58,7 @@
static string_t *get_prefix(struct imap_fetch_context *ctx,
const struct imap_fetch_body_data *body,
- uoff_t size)
+ uoff_t size, bool has_nuls)
{
string_t *str;
@@ -70,10 +70,12 @@
str_append(str, get_body_name(body));
- if (size != (uoff_t)-1)
+ if (size == (uoff_t)-1)
+ str_append(str, " NIL");
+ else if (has_nuls && body->binary)
+ str_printfa(str, " ~{%"PRIuUOFF_T"}\r\n", size);
+ else
str_printfa(str, " {%"PRIuUOFF_T"}\r\n", size);
- else
- str_append(str, " NIL");
return str;
}
@@ -131,7 +133,8 @@
ctx->cur_size_field = result.size_field;
ctx->cur_name = p_strconcat(ctx->pool, "[", body->section, "]", NULL);
- str = get_prefix(ctx, body, ctx->cur_size);
+ str = get_prefix(ctx, body, ctx->cur_size,
+ result.binary_decoded_input_has_nuls);
o_stream_nsend(ctx->client->output, str_data(str), str_len(str));
ctx->cont_handler = fetch_stream_continue;
diff -r f3ef88e19cd5 -r f0feae227c60 src/lib-imap-storage/imap-msgpart.c
--- a/src/lib-imap-storage/imap-msgpart.c Sat Aug 11 05:31:46 2012 +0300
+++ b/src/lib-imap-storage/imap-msgpart.c Sat Aug 11 05:47:03 2012 +0300
@@ -665,6 +665,9 @@
use_partial_cache = TRUE;
}
+ if (binary && msgpart->decode_cte_to_binary)
+ result_r->binary_decoded_input_has_nuls = TRUE;
+
imap_msgpart_get_partial(mail, msgpart, !binary, use_partial_cache,
&part_size, result_r);
return 0;
More information about the dovecot-cvs
mailing list