- /* ncurses doesn't return on resized screen when timeout is set to zero */
- if (menu != MENU_EDITOR)
- timeout ((Timeout > 0 ? Timeout : 60) * 1000);
+ i = Timeout > 0 ? Timeout : 60;
+#ifdef USE_IMAP
+ /* keepalive may need to run more frequently than Timeout allows */
+ if (ImapKeepalive)
+ {
+ if (ImapKeepalive >= i)
+ imap_keepalive ();
+ else
+ while (ImapKeepalive && ImapKeepalive < i)
+ {
+ timeout (ImapKeepalive * 1000);
+ tmp = mutt_getch ();
+ timeout (-1);
+ if (tmp.ch != -2)
+ /* something other than timeout */
+ goto gotkey;
+ i -= ImapKeepalive;
+ imap_keepalive ();
+ }
+ }
+#endif