aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--imap.c14
2 files changed, 14 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 0a023e9c..dc01d95f 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,7 @@ pl 3.9.7 ():
* Fess up to sometimes only counting header bytes in the progress messages.
* Man page updates, including removal of restriction on --syslog.
* You can now set --syslog in the .fetchmailrc file.
+* Parse more different variants of IMAP "UNSEEN" message.
There are 252 people on the fetchmail-friends list.
diff --git a/imap.c b/imap.c
index 404f8937..c09dc39a 100644
--- a/imap.c
+++ b/imap.c
@@ -47,7 +47,19 @@ int imap_ok (int sock, char *argbuf)
if (strstr(buf, "RECENT"))
recent = atoi(buf+2);
if (strstr(buf, "UNSEEN"))
- unseen = atoi(buf+2);
+ {
+ char *cp;
+
+ /*
+ * Handle both "* 42 UNSEEN" and "* OK [UNSEEN 42] 42".
+ */
+ unseen = 0;
+ for (cp = buf; *cp && !isdigit(*cp); cp++)
+ {
+ unseen = atoi(cp);
+ break;
+ }
+ }
if (strstr(buf, "FLAGS"))
seen = (strstr(buf, "Seen") != (char *)NULL);
} while