[dovecot-cvs] dovecot/src/imap imap-sync.c,1.6,1.7

cras at dovecot.org cras at dovecot.org
Mon Jan 17 15:02:38 EET 2005


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv7730

Modified Files:
	imap-sync.c 
Log Message:
FETCH deinitialization wasn't done properly



Index: imap-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-sync.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- imap-sync.c	26 Dec 2004 09:12:40 -0000	1.6
+++ imap-sync.c	17 Jan 2005 13:02:35 -0000	1.7
@@ -84,6 +84,7 @@
 	enum mail_flags flags;
 	const char *const *keywords;
 	string_t *str;
+	int ret = 1;
 
 	t_push();
 	str = t_str_new(256);
@@ -91,9 +92,15 @@
 	for (;;) {
 		if (ctx->seq == 0) {
 			/* get next one */
-			if (mailbox_sync_next(ctx->sync_ctx,
-					      &ctx->sync_rec) <= 0)
+			ret = mailbox_sync_next(ctx->sync_ctx,
+						&ctx->sync_rec);
+			if (ret <= 0) {
+				if (ret == 0) {
+					/* all finished ok */
+					ret = 1;
+				}
 				break;
+			}
 		}
 
 		switch (ctx->sync_rec.type) {
@@ -114,10 +121,10 @@
 					    ctx->seq);
 				imap_write_flags(str, flags, keywords);
 				str_append(str, "))");
-				if (!client_send_line(ctx->client,
-						      str_c(str))) {
+				ret = client_send_line(ctx->client, str_c(str));
+				if (ret <= 0) {
 					t_pop();
-					return 0;
+					return ret;
 				}
 			}
 			break;
@@ -131,10 +138,10 @@
 			for (; ctx->seq >= ctx->sync_rec.seq1; ctx->seq--) {
 				str_truncate(str, 0);
 				str_printfa(str, "* %u EXPUNGE", ctx->seq);
-				if (!client_send_line(ctx->client,
-						      str_c(str))) {
+				ret = client_send_line(ctx->client, str_c(str));
+				if (ret <= 0) {
 					t_pop();
-					return 0;
+					return ret;
 				}
 			}
 			break;
@@ -142,7 +149,7 @@
 		ctx->seq = 0;
 	}
 	t_pop();
-	return 1;
+	return ret;
 }
 
 int imap_sync_nonselected(struct mailbox *box, enum mailbox_sync_flags flags)



More information about the dovecot-cvs mailing list