From d0fd62ac40d972f41d6fc9d59cfce5295c2f4dff Mon Sep 17 00:00:00 2001
From: "C. McEnroe" <june@causal.agency>
Date: Mon, 13 Apr 2020 17:34:44 -0400
Subject: Fetch .TEXT of single-part nested messages

---
 export.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/export.c b/export.c
index 52f6f88..f703e20 100644
--- a/export.c
+++ b/export.c
@@ -111,13 +111,19 @@ static void exportFetchParts(
 			exportFetchParts(imap, parts, &structure->parts.ptr[i]);
 			parts->len--;
 		}
-	} else if (structure->message.structure) {
+	} else if (
+		structure->message.structure &&
+		structure->message.structure->multipart
+	) {
 		exportFetchParts(imap, parts, structure->message.structure);
 	} else {
 		fprintf(imap, " BODY[");
 		for (size_t i = 0; i < parts->len; ++i) {
 			fprintf(imap, "%s%" PRIu32, (i ? "." : ""), parts->ptr[i].number);
 		}
+		if (structure->message.structure) {
+			fprintf(imap, ".TEXT");
+		}
 		fprintf(imap, "]");
 	}
 }
-- 
cgit 1.4.1