From 6bfaf987a55c6dbbc2ad6fe4cdb89dd9b0c2ebde Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Mon, 12 Dec 2005 17:24:11 +0000 Subject: [PATCH] . Add $imap_idle boolean to disable the IDLE extension (may be needed with some servers like the particular version of dovecot I tried yesterday). . Don't attempt to poll mailboxes with connections that haven't yet authenticated. . Recognize NO responses again (silly typo, spotted by Charlie Allom) --- imap/command.c | 2 +- imap/imap.c | 5 +++-- init.h | 9 +++++++++ mutt.h | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/imap/command.c b/imap/command.c index 0d3c380c2..8ba51fbc8 100644 --- a/imap/command.c +++ b/imap/command.c @@ -337,7 +337,7 @@ static int cmd_status (const char *s) if (!ascii_strncasecmp("OK", s, 2)) return IMAP_CMD_OK; - if (!ascii_strncasecmp("NO", s, 3)) + if (!ascii_strncasecmp("NO", s, 2)) return IMAP_CMD_NO; return IMAP_CMD_BAD; diff --git a/imap/imap.c b/imap/imap.c index 4b6e293a2..ba01c6742 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1185,7 +1185,7 @@ int imap_check_mailbox (CONTEXT *ctx, int *index_hint, int force) idata = (IMAP_DATA*) ctx->data; /* try IDLE first */ - if (mutt_bit_isset (idata->capabilities, IDLE) + if (option (OPTIMAPIDLE) && mutt_bit_isset (idata->capabilities, IDLE) && (idata->state != IMAP_IDLE || time(NULL) >= idata->lastread + ImapKeepalive)) { @@ -1238,7 +1238,8 @@ static int imap_buffy_split (const char* path, IMAP_DATA** hidata, char* buf, si dprint (1, (debugfile, "imap_split_path: Error parsing %s\n", path)); return -1; } - if (!(*hidata = imap_conn_find (&(mx.account), option (OPTIMAPPASSIVE) ? M_IMAP_CONN_NONEW : 0))) + if (!(*hidata = imap_conn_find (&(mx.account), option (OPTIMAPPASSIVE) ? M_IMAP_CONN_NONEW : 0)) + || (*hidata)->state < IMAP_AUTHENTICATED) { FREE (&mx.mbox); return -1; diff --git a/init.h b/init.h index 6a3facf4f..e1d6d78f5 100644 --- a/init.h +++ b/init.h @@ -848,6 +848,15 @@ struct option_t MuttVars[] = { ** your INBOX in the IMAP browser. If you see something else, you may set ** this variable to the IMAP path to your folders. */ + { "imap_idle", DT_BOOL, R_NONE, OPTIMAPIDLE, 1 }, + /* + ** .pp + ** When \fIset\fP, mutt will attempt to use the IMAP IDLE extension + ** to check for new mail in the current mailbox. Some servers + ** (dovecot was the inspiration for this option) react badly + ** to mutt's implementation. If your connection seems to freeze + ** up periodically, try unsetting this. + */ { "imap_keepalive", DT_NUM, R_NONE, UL &ImapKeepalive, 900 }, /* ** .pp diff --git a/mutt.h b/mutt.h index d57b7d807..7bb6823d2 100644 --- a/mutt.h +++ b/mutt.h @@ -370,6 +370,7 @@ enum OPTIGNORELISTREPLYTO, #ifdef USE_IMAP OPTIMAPCHECKSUBSCRIBED, + OPTIMAPIDLE, OPTIMAPLSUB, OPTIMAPPASSIVE, OPTIMAPPEEK, -- 2.40.0