void mutt_refresh (void)
{
+ /* don't refresh when we are waiting for a child. */
+ if (option (OPTKEEPQUIET))
+ return;
+
/* don't refresh in the middle of macros unless necessary */
- if (!UngetCount || option (OPTFORCEREFRESH))
- refresh ();
+ if (UngetCount && !option (OPTFORCEREFRESH))
+ return;
+
+ /* else */
+ refresh ();
}
event_t mutt_getch (void)
Errorbuf[ (COLS < sizeof (Errorbuf) ? COLS : sizeof (Errorbuf)) - 2 ] = 0;
clean_error_buf();
- BEEP ();
- SETCOLOR (MT_COLOR_ERROR);
- mvaddstr (LINES-1, 0, Errorbuf);
- clrtoeol ();
- SETCOLOR (MT_COLOR_NORMAL);
- mutt_refresh ();
+ if (!option (OPTKEEPQUIET))
+ {
+ BEEP ();
+ SETCOLOR (MT_COLOR_ERROR);
+ mvaddstr (LINES-1, 0, Errorbuf);
+ clrtoeol ();
+ SETCOLOR (MT_COLOR_NORMAL);
+ mutt_refresh ();
+ }
set_option (OPTMSGERR);
}
Errorbuf[ (COLS < sizeof (Errorbuf) ? COLS : sizeof (Errorbuf)) - 2 ] = 0;
clean_error_buf();
- SETCOLOR (MT_COLOR_MESSAGE);
- mvaddstr (LINES - 1, 0, Errorbuf);
- clrtoeol ();
- SETCOLOR (MT_COLOR_NORMAL);
- mutt_refresh ();
+ if (!option (OPTKEEPQUIET))
+ {
+ SETCOLOR (MT_COLOR_MESSAGE);
+ mvaddstr (LINES - 1, 0, Errorbuf);
+ clrtoeol ();
+ SETCOLOR (MT_COLOR_NORMAL);
+ mutt_refresh ();
+ }
unset_option (OPTMSGERR);
}
void mutt_show_error (void)
{
+ if (option (OPTKEEPQUIET))
+ return;
+
SETCOLOR (option (OPTMSGERR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
CLEARLINE (LINES-1);
addstr (Errorbuf);
CLEARLINE (LINES - 1);
move (LINES - 1, 0);
#else
- move (LINES - 1, COLS - 1);
+ move (LINES - 1, COLS - 1);
CLEARLINE (LINES - 1);
#endif
int *socktype, char** mbox);
void imap_qualify_path (char* dest, size_t len, const char* host, int port,
const char* path, const char* name);
+void imap_keepalive (void);
#endif
#include <stdlib.h>
#include <ctype.h>
+#include <signal.h>
+
/* imap_continue: display a message and ask the user if she wants to
* go on. */
int imap_continue (const char* msg, const char* resp)
return mutt_strcasecmp(a, tmp);
}
+
+/* imap_keepalive: use buffy to poll a remote imap folder
+ * while waiting for an external process
+ */
+
+void imap_keepalive (void)
+{
+ sigset_t sigset;
+ sigset_t osigset;
+
+ if (option (OPTMSGERR))
+ return;
+
+ sigemptyset (&sigset);
+ sigaddset (&sigset, SIGCHLD);
+ sigprocmask (SIG_UNBLOCK, &sigset, &osigset);
+
+ set_option (OPTKEEPQUIET);
+
+ mutt_buffy_check (0);
+ sleep (ImapCheckTimeout > 0 ? ImapCheckTimeout : 60);
+
+ unset_option (OPTKEEPQUIET);
+ sigprocmask (SIG_BLOCK, &osigset, NULL);
+}
+
+
OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */
OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
OPTATTACHMSG, /* (pseudo) used by attach-message */
+ OPTKEEPQUIET, /* (pseudo) shut up the message and refresh
+ * functions while we are executing an
+ * external program.
+ */
#ifdef _PGPPATH
OPTPGPCHECKTRUST, /* (pseudo) used by pgp_select_key () */
*/
#include "mutt.h"
+#ifdef USE_IMAP
+# include "imap.h"
+#endif
#include <stdlib.h>
#include <signal.h>
}
else if (thepid != -1)
{
+#ifndef USE_IMAP
/* wait for the (first) child process to finish */
waitpid (thepid, &rc, 0);
+#else
+ while (waitpid (thepid, &rc, WNOHANG) == 0)
+ imap_keepalive ();
+#endif
}
sigaction (SIGCONT, &oldcont, NULL);