]> granicus.if.org Git - neomutt/commitdiff
Add polling for the IDLE command. (closes #3957)
authorKevin McCarthy <kevin@8t8.us>
Sun, 15 Oct 2017 07:13:18 +0000 (15:13 +0800)
committerRichard Russon <rich@flatcap.org>
Sun, 15 Oct 2017 10:34:05 +0000 (11:34 +0100)
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

index 4b0cf5767e7cf121081e737431f607538b9d9c3b..14f88eac5c4e1c8e4836bcaf8b980b8b7ae9ddba 100644 (file)
@@ -1142,7 +1142,20 @@ int imap_cmd_idle(struct ImapData *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);