]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Don't enforce sending SNIPPET reply as literal
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 16 Feb 2018 12:49:59 +0000 (14:49 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 19 Feb 2018 11:37:48 +0000 (13:37 +0200)
Also change it to use "cur_str" since the reply is never very long.

src/imap/imap-fetch-body.c

index 1456d024fe706976d14a146fa1c8a2c7515f0a29..ce29d376985cb48ccd7534a4d71cc493bf5e4d04 100644 (file)
@@ -596,7 +596,6 @@ fetch_snippet(struct imap_fetch_context *ctx, struct mail *mail,
        enum mail_lookup_abort temp_lookup_abort = lazy ? MAIL_LOOKUP_ABORT_NOT_IN_CACHE : mail->lookup_abort;
        enum mail_lookup_abort orig_lookup_abort = mail->lookup_abort;
        const char *snippet;
-       const char *str;
        int ret;
 
        mail->lookup_abort = temp_lookup_abort;
@@ -625,14 +624,9 @@ fetch_snippet(struct imap_fetch_context *ctx, struct mail *mail,
                return 1;
        }
 
-       str = t_strdup_printf(" SNIPPET (FUZZY {%"PRIuSIZE_T"}\r\n", strlen(snippet));
-       if (ctx->state.cur_first) {
-               str++;
-               ctx->state.cur_first = FALSE;
-       }
-       o_stream_nsend_str(ctx->client->output, str);
-       o_stream_nsend_str(ctx->client->output, snippet);
-       o_stream_nsend_str(ctx->client->output, ")");
+       str_append(ctx->state.cur_str, "SNIPPET (FUZZY ");
+       imap_append_string(ctx->state.cur_str, snippet);
+       str_append(ctx->state.cur_str, ") ");
 
        return 1;
 }