From dfa9dc5fbd8a0b649da619899f7bf23756faae2c Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 26 Jan 2020 21:03:12 -0500 Subject: Check envelope date rather than internal date --- notemap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'notemap.c') diff --git a/notemap.c b/notemap.c index 2b0fe3b..0ba364b 100644 --- a/notemap.c +++ b/notemap.c @@ -250,6 +250,7 @@ static void append( len = 0; } if (ch == '\n') { + // TODO: Check if last character was space or tab. fprintf(msg, "\r\n"); len = 0; } else if (ch == '\t' || (ch >= ' ' && ch <= '~' && ch != '=')) { @@ -419,7 +420,7 @@ next: break; case Search: { if (!seq) goto append; - fprintf(imap, "%s FETCH %d INTERNALDATE\r\n", Atoms[Fetch], seq); + fprintf(imap, "%s FETCH %d ENVELOPE\r\n", Atoms[Fetch], seq); } break; case Fetch: { @@ -451,9 +452,12 @@ append: } if (resp == Fetch) { + if (!strncmp(rest, "(FLAGS", 6)) continue; + + // TODO: Factor out format string. struct tm date = {0}; rest = strptime( - rest, "(INTERNALDATE \"%d-%b-%Y %H:%M:%S %z\")", &date + rest, "(ENVELOPE (\"%a, %e %b %Y %H:%M:%S %z\"", &date ); if (!rest) errx(EX_PROTOCOL, "invalid INTERNALDATE"); @@ -464,6 +468,7 @@ append: if (!force && status.st_mtime < mktime(&date)) { errx(EX_TEMPFAIL, "%s: note has been modified in mailbox", note); } + // TODO: Skip if times are the same. } } } -- cgit 1.4.1