]> 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>
Fri, 16 Feb 2018 13:22:52 +0000 (15:22 +0200)
Also change it to use "cur_str" since the reply is never very long.

src/imap/imap-fetch-body.c

index 52318b387f26abb607016ad239d18729faa31f72..3c154d68781b5d82ab9373d0143c81ec33d41a93 100644 (file)
@@ -597,7 +597,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;
@@ -626,14 +625,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;
 }