summary refs log tree commit diff
path: root/notemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'notemap.c')
-rw-r--r--notemap.c9
1 files changed, 7 insertions, 2 deletions
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.
 		}
 	}
 }