diff options
Diffstat (limited to '')
-rw-r--r-- | imbox.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/imbox.c b/imbox.c index d63763d..a37b24d 100644 --- a/imbox.c +++ b/imbox.c @@ -172,11 +172,14 @@ int main(int argc, char *argv[]) { enum Atom login = 0; enum Atom examine = atom("examine"); - enum Atom headerFields = atom("HEADER.FIELDS"); - enum Atom text = atom("TEXT"); - FILE *imap = imapOpen(host, port); - for (struct Resp resp; resp = imapResp(imap), resp.resp != AtomBye;) { + FILE *imapRead, *imap; + imapOpen(&imapRead, &imap, host, port); + for ( + struct Resp resp; + resp = imapResp(imapRead), resp.resp != AtomBye; + respFree(resp) + ) { if (resp.resp == AtomNo || resp.resp == AtomBad) { errx(EX_CONFIG, "%s: %s", Atoms[resp.resp], resp.text); } @@ -240,10 +243,10 @@ int main(int argc, char *argv[]) { if (item.type != List) continue; if (!item.list.len) continue; if (item.list.ptr[0].type != Atom) continue; - if (item.list.ptr[0].atom == headerFields) { + if (item.list.ptr[0].atom == AtomHeader) { if (i + 1 < items.len) headers = items.ptr[i + 1]; } - if (item.list.ptr[0].atom == text) { + if (item.list.ptr[0].atom == AtomText) { if (i + 1 < items.len) body = items.ptr[i + 1]; } } @@ -260,8 +263,7 @@ int main(int argc, char *argv[]) { if (resp.tag == AtomFetch) { fprintf(imap, "ayy LOGOUT\r\n"); } - - respFree(resp); } + fclose(imapRead); fclose(imap); } |