about summary refs log tree commit diff
path: root/export.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-13 11:47:36 -0400
committerJune McEnroe <june@causal.agency>2020-04-13 11:47:36 -0400
commit79efea7ad5ffa571d27321243e25c372ab4303b2 (patch)
treeff31d350114e46f8c2402405e82b11c34613e3b9 /export.c
parentFix concatHTML thread nesting (diff)
downloadbubger-79efea7ad5ffa571d27321243e25c372ab4303b2.tar.gz
bubger-79efea7ad5ffa571d27321243e25c372ab4303b2.zip
Rename atom rendering functions
Again, probably.
Diffstat (limited to 'export.c')
-rw-r--r--export.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/export.c b/export.c
index 411b70c..8e97370 100644
--- a/export.c
+++ b/export.c
@@ -71,8 +71,8 @@ static void exportEnvelope(uint32_t uid, const struct Envelope *envelope) {
 	file = fopen(pathUID(path, uid, "atom"), "w");
 	if (!file) err(EX_CANTCREAT, "%s", path);
 	error = 0
-		|| atomEntryHead(file, envelope)
-		|| atomEntryTail(file)
+		|| atomEntryOpen(file, envelope)
+		|| atomEntryClose(file)
 		|| fclose(file);
 	if (error) err(EX_IOERR, "%s", path);
 }
@@ -98,6 +98,12 @@ static void exportRaw(
 	if (error) err(EX_CANTCREAT, "%s", dst);
 }
 
+static void exportBodyPart(
+	uint32_t uid, const struct BodyPart *structure,
+	const struct BodyPart *part, const char *content
+) {
+}
+
 bool exportData(FILE *imap, enum Atom tag, struct List items) {
 	uint32_t uid = 0;
 	struct Envelope envelope = {0};
@@ -145,6 +151,12 @@ bool exportData(FILE *imap, enum Atom tag, struct List items) {
 	exportRaw(uid, &envelope, header, body);
 	exportEnvelope(uid, &envelope);
 
+	if (structure.multipart) {
+		// TODO: FETCH each body part.
+	} else {
+		exportBodyPart(uid, &structure, &structure, body);
+	}
+
 	envelopeFree(envelope);
 	bodyPartFree(structure);
 	return false;