changeset 2680:48df7f95fa4a HEAD

If fetching fails, finish sending the untagged FETCH reply correctly.
author Timo Sirainen <tss@iki.fi>
date Sun, 03 Oct 2004 15:28:57 +0300
parents 8f7b01c29bcb
children d6c8faedc775
files src/imap/imap-fetch.c src/imap/imap-fetch.h
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/imap-fetch.c	Fri Oct 01 17:41:16 2004 +0300
+++ b/src/imap/imap-fetch.c	Sun Oct 03 15:28:57 2004 +0300
@@ -204,6 +204,7 @@
 			str_truncate(ctx->cur_str, 0);
 			str_append_c(ctx->cur_str, ' ');
 			ctx->first = TRUE;
+			ctx->line_finished = FALSE;
 		}
 
 		for (; ctx->cur_handler < size; ctx->cur_handler++) {
@@ -231,6 +232,7 @@
 			str_truncate(ctx->cur_str, 0);
 		}
 
+		ctx->line_finished = TRUE;
 		if (o_stream_send(ctx->client->output, ")\r\n", 3) < 0)
 			return -1;
 
@@ -245,6 +247,11 @@
 {
 	str_free(ctx->cur_str);
 
+	if (!ctx->line_finished) {
+		if (o_stream_send(ctx->client->output, ")\r\n", 3) < 0)
+			return -1;
+	}
+
 	if (ctx->cur_input != NULL) {
 		i_stream_unref(ctx->cur_input);
 		ctx->cur_input = NULL;
--- a/src/imap/imap-fetch.h	Fri Oct 01 17:41:16 2004 +0300
+++ b/src/imap/imap-fetch.h	Sun Oct 03 15:28:57 2004 +0300
@@ -53,6 +53,7 @@
 	unsigned int cur_have_eoh:1;
 	unsigned int cur_append_eoh:1;
 	unsigned int first:1;
+	unsigned int line_finished:1;
 	unsigned int failed:1;
 };