diff options
author | June McEnroe <june@causal.agency> | 2019-12-22 17:50:43 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-12-22 17:50:43 -0500 |
commit | e508617acee08836f3617e48470f591a36264fed (patch) | |
tree | 8861f699da0d87b8637b455cb000a92699c12a1e /imbox.c | |
parent | Use EXAMINE rather than SELECT (diff) | |
download | imbox-e508617acee08836f3617e48470f591a36264fed.tar.gz imbox-e508617acee08836f3617e48470f591a36264fed.zip |
Use sequence numbers rather than UIDs
We aren't doing any expunging or anything across different sessions, so it's safe to just use sequence numbers.
Diffstat (limited to '')
-rw-r--r-- | imbox.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/imbox.c b/imbox.c index 850e9b8..bdc8a16 100644 --- a/imbox.c +++ b/imbox.c @@ -283,7 +283,7 @@ int main(int argc, char *argv[]) { setlinebuf(imap); bool login = false; - char *uids = NULL; + char *nums = NULL; char *line = NULL; size_t cap = 0; @@ -315,7 +315,7 @@ int main(int argc, char *argv[]) { fprintf(imap, "%s EXAMINE %s\r\n", Atoms[Examine], mailbox); } break; case Examine: { - fprintf(imap, "%s UID SEARCH CHARSET UTF-8", Atoms[Search]); + fprintf(imap, "%s SEARCH CHARSET UTF-8", Atoms[Search]); if (subject) fprintf(imap, " SUBJECT \"%s\"", subject); if (from) fprintf(imap, " FROM \"%s\"", from); if (to) fprintf(imap, " TO \"%s\"", to); @@ -323,20 +323,20 @@ int main(int argc, char *argv[]) { fprintf(imap, "\r\n"); } break; case Search: { - if (!uids) errx(EX_PROTOCOL, "no search response"); - for (char *ch = uids; *ch; ++ch) { + if (!nums) errx(EX_PROTOCOL, "no search response"); + for (char *ch = nums; *ch; ++ch) { if (*ch == ' ') *ch = ','; } fprintf( imap, - "%s UID FETCH %s (BODY[HEADER.FIELDS (" + "%s FETCH %s (BODY[HEADER.FIELDS (" "Date From To Cc Subject Message-Id In-Reply-To " "Content-Transfer-Encoding" ")] BODY[TEXT])\r\n", - Atoms[Fetch], uids + Atoms[Fetch], nums ); - free(uids); - uids = NULL; + free(nums); + nums = NULL; } break; case Fetch: { fprintf(imap, "ayy LOGOUT\r\n"); @@ -349,8 +349,8 @@ int main(int argc, char *argv[]) { switch (resp) { break; case Search: { if (!rest) errx(EX_TEMPFAIL, "no matching messages"); - uids = strdup(rest); - if (!uids) err(EX_OSERR, "strdup"); + nums = strdup(rest); + if (!nums) err(EX_OSERR, "strdup"); } break; case Fetch: { char *headers = readLiteral(imap, rest); |