From: Thomas Roessler Date: Sat, 29 Apr 2000 13:05:30 +0000 (+0000) Subject: Fix the "empty screen after sync" bug observed with certain versions X-Git-Tag: mutt-1-1-13-rel~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ef157f66e32a1f3ffc31f8a7a3b93e5d5e0c1eb;p=mutt Fix the "empty screen after sync" bug observed with certain versions of the Courier IMAP server. From Brendan Cully. --- diff --git a/imap/imap.c b/imap/imap.c index 5d8b99d9..5d7c2ce2 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1,7 +1,7 @@ /* * Copyright (C) 1996-8 Michael R. Elkins * Copyright (C) 1996-9 Brandon Long - * Copyright (C) 1999 Brendan Cully + * Copyright (C) 1999-2000 Brendan Cully * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -213,8 +213,7 @@ int imap_reopen_mailbox (CONTEXT *ctx, int *index_hint) mutt_message (_("Reopening mailbox... %s"), CTX_DATA->selected_mailbox); imap_quote_string (buf, sizeof (buf), CTX_DATA->selected_mailbox); imap_make_sequence (seq, sizeof (seq)); - snprintf (bufout, sizeof (bufout), "%s %s %s\r\n", seq, - ctx->readonly ? "EXAMINE" : "SELECT", buf); + snprintf (bufout, sizeof (bufout), "%s STATUS %s (MESSAGES)\r\n", seq, buf); mutt_socket_write (CTX_DATA->conn, bufout); do @@ -226,39 +225,36 @@ int imap_reopen_mailbox (CONTEXT *ctx, int *index_hint) { pc = buf + 2; - if (isdigit (*pc)) + if (!mutt_strncasecmp ("STATUS", pc, 6) && + (pc = mutt_stristr (pc, "MESSAGES"))) { - char *pn = pc; + char* pn; + + /* skip "MESSAGES" */ + pc += 8; + SKIPWS (pc); + pn = pc; while (*pc && isdigit (*pc)) pc++; *pc++ = 0; n = atoi (pn); - SKIPWS (pc); - if (mutt_strncasecmp ("EXISTS", pc, 6) == 0) - count = n; + count = n; } else if (imap_handle_untagged (CTX_DATA, buf) != 0) - return (-1); + return -1; } } while (mutt_strncmp (seq, buf, mutt_strlen (seq)) != 0); - /* check for READ-ONLY notification */ - if (!strncmp (imap_get_qualifier (buf), "[READ-ONLY]", 11)) - { - dprint (2, (debugfile, "Mailbox is read-only.\n")); - ctx->readonly = 1; - } if (!imap_code (buf)) { char *s; s = imap_next_word (buf); /* skip seq */ s = imap_next_word (s); /* Skip response */ - CTX_DATA->state = IMAP_AUTHENTICATED; mutt_error (s); sleep (1); - return (-1); + return -1; } ctx->hdrmax = count;