about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--archive.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/archive.c b/archive.c
index c2e7f5c..e741b4e 100644
--- a/archive.c
+++ b/archive.c
@@ -153,9 +153,9 @@ int main(int argc, char *argv[]) {
 				if (!previous) uidWrite("UIDVALIDITY", validity);
 			}
 			if (code == AtomUIDNext) {
-				uint32_t next = resp.code.ptr[1].number;
+				uidNext = resp.code.ptr[1].number;
 				uint32_t prev = uidRead("UIDNEXT");
-				if (next == prev) {
+				if (uidNext == prev) {
 					examine = 0;
 					fprintf(imap, "ayy LOGOUT\r\n");
 				}
@@ -193,8 +193,12 @@ int main(int argc, char *argv[]) {
 			concat = concatFetch(imap, threads);
 		}
 
+		if (concat && resp.tag == concat) {
+			uidWrite("UIDNEXT", uidNext);
+			fprintf(imap, "ayy LOGOUT\r\n");
+		}
+
 		respFree(resp);
 	}
 	fclose(imap);
-	uidWrite("UIDNEXT", uidNext);
 }