From 70a06cd47ab03c4fff76ec218f7cc92574600fd6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 4 Jun 1997 17:15:32 +0000 Subject: Fix Rob Funk's bug. svn path=/trunk/; revision=1061 --- imap.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'imap.c') 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 -- cgit v1.2.3