about summary refs log tree commit diff
path: root/archive.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-13 16:18:37 -0400
committerJune McEnroe <june@causal.agency>2020-04-13 16:18:37 -0400
commitbab44e23d43b064fa1995975434db88913a1ce20 (patch)
treefcca2b7b8ce4cf3b9444c8f82750d16fe1452ed2 /archive.c
parentAdd -u option to set base URL (diff)
downloadbubger-bab44e23d43b064fa1995975434db88913a1ce20.tar.gz
bubger-bab44e23d43b064fa1995975434db88913a1ce20.zip
Use two FILEs for IMAP
Turns out that funopen cannot be used for a full-duplex socket.
Diffstat (limited to 'archive.c')
-rw-r--r--archive.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/archive.c b/archive.c
index d505949..992b592 100644
--- a/archive.c
+++ b/archive.c
@@ -104,6 +104,9 @@ int main(int argc, char *argv[]) {
 		if (!pass) errx(EX_CONFIG, ENV_PASSWORD " unset");
 	}
 
+	FILE *imapRead, *imap;
+	imapOpen(&imapRead, &imap, host, port);
+
 	enum {
 		Ready,
 		Login,
@@ -123,8 +126,7 @@ int main(int argc, char *argv[]) {
 
 	uint32_t uidNext = 0;
 	struct List threads = {0};
-	FILE *imap = imapOpen(host, port);
-	for (struct Resp resp; resp = imapResp(imap), resp.resp != AtomBye;) {
+	for (struct Resp resp; resp = imapResp(imapRead), resp.resp != AtomBye;) {
 		if (resp.resp == AtomNo || resp.resp == AtomBad) {
 			errx(EX_CONFIG, "%s %s", Atoms[resp.resp], resp.text);
 		}
@@ -221,5 +223,6 @@ int main(int argc, char *argv[]) {
 		}
 		respFree(resp);
 	}
+	fclose(imapRead);
 	fclose(imap);
 }