changeset: 7174:321805c70d99
user:      Kevin McCarthy <ke...@8t8.us>
date:      Sun Oct 15 15:13:18 2017 +0800
link:      http://dev.mutt.org/hg/mutt/rev/321805c70d99

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.

diffs (26 lines):

diff -r ba4a3cb944c5 -r 321805c70d99 imap/command.c
--- a/imap/command.c    Sat Sep 30 19:16:56 2017 -0700
+++ b/imap/command.c    Sun Oct 15 15:13:18 2017 +0800
@@ -333,7 +333,21 @@
 {
   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);

Reply via email to