about summary refs log tree commit diff
path: root/imap.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-10 16:44:04 -0400
committerJune McEnroe <june@causal.agency>2020-04-10 16:44:04 -0400
commit4e0840f8485a6f52ecd316159e22429726b90725 (patch)
tree1b025cdcc2980f2b4fa26634a69ae6b06a50e84f /imap.h
parentParse envelope and find thread in concatData (diff)
downloadbubger-4e0840f8485a6f52ecd316159e22429726b90725.tar.gz
bubger-4e0840f8485a6f52ecd316159e22429726b90725.zip
Concatenate mbox threads
Diffstat (limited to 'imap.h')
-rw-r--r--imap.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/imap.h b/imap.h
index f3ca668..3a30d5a 100644
--- a/imap.h
+++ b/imap.h
@@ -125,6 +125,16 @@ static inline void listPush(struct List *list, struct Data data) {
 	list->ptr[list->len++] = data;
 }
 
+static inline void listFlatten(struct List *flat, struct List nested) {
+	for (size_t i = 0; i < nested.len; ++i) {
+		if (nested.ptr[i].type == List) {
+			listFlatten(flat, nested.ptr[i].list);
+		} else {
+			listPush(flat, nested.ptr[i]);
+		}
+	}
+}
+
 static inline void dataFree(struct Data data);
 
 static inline void listFree(struct List list) {