summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-10 13:29:47 -0400
committerJune McEnroe <june@causal.agency>2020-04-10 13:29:47 -0400
commit3e9d89ce69f59f21df98b20decc383d081c00e3b (patch)
treef944a5afda568a2bc16f2e6a320ce17a92f72008
parentFetch thread root envelopes for concat (diff)
downloadbubger-3e9d89ce69f59f21df98b20decc383d081c00e3b.tar.gz
bubger-3e9d89ce69f59f21df98b20decc383d081c00e3b.zip
Fix UIDNEXT check and write
-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);
 }