From 336f7d88f7e9fd06a07aca9a35a4f42c05dc1d39 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sun, 15 Oct 2017 15:13:18 +0800 Subject: [PATCH] Add polling for the IDLE command. (closes #3957) Add $imap_poll_timeout poll for IDLE, since this is also a command that will freeze after waking if $imap_idle is set. --- imap/command.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/imap/command.c b/imap/command.c index 3c104681..41b4bee6 100644 --- a/imap/command.c +++ b/imap/command.c @@ -333,7 +333,21 @@ int imap_cmd_idle (IMAP_DATA* idata) { int rc; - imap_cmd_start (idata, "IDLE"); + if (cmd_start (idata, "IDLE", IMAP_CMD_POLL) < 0) + { + cmd_handle_fatal (idata); + return -1; + } + + if ((ImapPollTimeout > 0) && + (mutt_socket_poll (idata->conn, ImapPollTimeout)) == 0) + { + mutt_error (_("Connection to %s timed out"), idata->conn->account.host); + mutt_sleep (2); + cmd_handle_fatal (idata); + return -1; + } + do rc = imap_cmd_step (idata); while (rc == IMAP_CMD_CONTINUE); -- 2.50.1