about summary refs log tree commit diff
path: root/concat.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-10 14:45:03 -0400
committerJune McEnroe <june@causal.agency>2020-04-10 14:45:03 -0400
commit7bbf1c5811edba6cce197d8ee5a6585c8f03b093 (patch)
tree6b7537fb15b6f6b1fee1bbfa0d9f6654e0db5b11 /concat.c
parentRefactor main loop state machine (diff)
downloadbubger-7bbf1c5811edba6cce197d8ee5a6585c8f03b093.tar.gz
bubger-7bbf1c5811edba6cce197d8ee5a6585c8f03b093.zip
Use dataCheck in parsing
Diffstat (limited to 'concat.c')
-rw-r--r--concat.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/concat.c b/concat.c
index 3417e8a..9ad8537 100644
--- a/concat.c
+++ b/concat.c
@@ -30,15 +30,13 @@ static uint32_t threadRoot(struct List thread) {
 		thread = thread.ptr[0].list;
 		if (!thread.len) errx(EX_PROTOCOL, "empty subthread");
 	}
-	if (thread.ptr[0].type != Number) errx(EX_PROTOCOL, "invalid thread root");
-	return thread.ptr[0].number;
+	return dataCheck(thread.ptr[0], Number).number;
 }
 
 void concatFetch(FILE *imap, enum Atom tag, struct List threads) {
 	fprintf(imap, "%s UID FETCH ", Atoms[tag]);
 	for (size_t i = 0; i < threads.len; ++i) {
-		if (threads.ptr[i].type != List) errx(EX_PROTOCOL, "invalid thread");
-		uint32_t root = threadRoot(threads.ptr[i].list);
+		uint32_t root = threadRoot(dataCheck(threads.ptr[i], List).list);
 		fprintf(imap, "%s%" PRIu32, (i ? "," : ""), root);
 	}
 	fprintf(imap, " (UID ENVELOPE)\r\n");