Re: imap/2747: imap_keepalive ignored when less than timeout and too much idle
Synopsis: imap_keepalive ignored when less than timeout and too much idle
**** Comment added by rado on Fri, 09 Feb 2007 18:54:24 +0100 ****
Oops, ignore previous attachment:
1) forgot {} in keymap.c,
2) Probably mistake: too simplistic to extend imap_allow_reopen around
buffy_checks,
so better add extra imap_allow/_disallow around km_dokey calling imap_keepalive.
Take this instead:
diff -ur org/curs_main.c cvs-2/curs_main.c
--- org/curs_main.c Wed Aug 16 11:00:02 2006
+++ cvs-2/curs_main.c Fri Feb 9 17:45:46 2007
@@ -513,7 +513,6 @@
}
#ifdef USE_IMAP
- imap_keepalive ();
imap_disallow_reopen (Context);
#endif
@@ -602,7 +601,16 @@
}
#endif
+#ifdef USE_IMAP
+ imap_allow_reopen (Context);
+#endif
+
+/* imap_keepalive called in km_dokey, disallow after check. */
op = km_dokey (MENU_MAIN);
+
+#ifdef USE_IMAP
+ imap_disallow_reopen (Context);
+#endif
dprint(4, (debugfile, "mutt_index_menu[%d]: Got op %d\n", __LINE__, op));
diff -ur org/keymap.c cvs-2/keymap.c
--- org/keymap.c Sat Sep 17 22:46:10 2005
+++ cvs-2/keymap.c Fri Feb 9 17:54:47 2007
@@ -26,6 +26,9 @@
#include "keymap.h"
#include "mapping.h"
#include "mutt_crypt.h"
+#ifdef USE_IMAP
+#include "imap/imap.h"
+#endif
#include <stdlib.h>
#include <string.h>
@@ -385,8 +388,15 @@
FOREVER
{
/* ncurses doesn't return on resized screen when timeout is set to zero */
- if (menu != MENU_EDITOR)
- timeout ((Timeout > 0 ? Timeout : 60) * 1000);
+ if (menu != MENU_EDITOR) {
+ i=(Timeout > 0 ? Timeout : 60);
+
+#ifdef USE_IMAP
+ imap_keepalive ();
+ if ((ImapKeepalive > 0) && (ImapKeepalive < i)) i=ImapKeepalive;
+#endif
+ timeout (i * 1000);
+ }
tmp = mutt_getch();
diff -ur org/menu.c cvs-2/menu.c
--- org/menu.c Tue Jan 9 11:00:02 2007
+++ cvs-2/menu.c Thu Feb 8 16:47:02 2007
@@ -853,10 +853,6 @@
mutt_curs_set (0);
-#ifdef USE_IMAP
- imap_keepalive ();
-#endif
-
if (menu_redraw (menu) == OP_REDRAW)
return OP_REDRAW;
diff -ur org/pager.c cvs-2/pager.c
--- org/pager.c Wed Aug 16 11:00:02 2006
+++ cvs-2/pager.c Thu Feb 8 17:07:21 2007
@@ -1587,10 +1587,6 @@
{
mutt_curs_set (0);
-#ifdef USE_IMAP
- imap_keepalive ();
-#endif
-
if (redraw & REDRAW_FULL)
{
SETCOLOR (MT_COLOR_NORMAL);