Commit 91409e03 authored by Thomas Roessler's avatar Thomas Roessler

A slightly extended version of Dave Ewart's sleeptime patch.

parent ab8397b2
......@@ -479,7 +479,7 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body,
{
mutt_error ("The length calculation was wrong by %ld bytes", fail);
new_length += fail;
sleep (5);
mutt_sleep (1);
}
}
#endif
......
......@@ -983,8 +983,8 @@ int mutt_index_menu (void)
safe_free ((void **) &Context);
}
sleep (1); /* give a second to read the mailbox status */
mutt_sleep (0);
mutt_folder_hook (buf);
if ((Context = mx_open_mailbox (buf,
......
......@@ -137,6 +137,7 @@ WHERE short PagerContext;
WHERE short PagerIndexLines;
WHERE short ReadInc;
WHERE short SendmailWait;
WHERE short SleepTime INITVAL (1);
WHERE short Timeout;
WHERE short WriteInc;
WHERE short ScoreThresholdDelete;
......
......@@ -292,7 +292,7 @@ void mutt_folder_hook (char *path)
{
mutt_error ("%s", err.data);
FREE (&token.data);
sleep (1); /* pause a moment to let the user see the error */
mutt_sleep (1); /* pause a moment to let the user see the error */
current_hook_type = 0;
return;
}
......@@ -339,7 +339,7 @@ void mutt_message_hook (CONTEXT *ctx, HEADER *hdr, int type)
{
FREE (&token.data);
mutt_error ("%s", err.data);
sleep (1);
mutt_sleep (1);
current_hook_type = 0;
return;
}
......
......@@ -67,6 +67,6 @@ imap_auth_res_t imap_auth_anon (IMAP_DATA* idata)
bail:
mutt_error _("Anonymous authentication failed.");
sleep (2);
mutt_sleep (2);
return IMAP_AUTH_FAILURE;
}
......@@ -122,7 +122,7 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA* idata)
bail:
mutt_error _("CRAM-MD5 authentication failed.");
sleep (2);
mutt_sleep (2);
return IMAP_AUTH_FAILURE;
}
......
......@@ -260,6 +260,6 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA* idata)
bail:
mutt_error _("GSSAPI authentication failed.");
sleep (2);
mutt_sleep (2);
return IMAP_AUTH_FAILURE;
}
......@@ -61,6 +61,6 @@ imap_auth_res_t imap_auth_login (IMAP_DATA* idata)
return IMAP_AUTH_SUCCESS;
mutt_error _("Login failed.");
sleep (2);
mutt_sleep (2);
return IMAP_AUTH_FAILURE;
}
......@@ -162,7 +162,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata)
bail:
mutt_error _("SASL authentication failed.");
sleep(2);
mutt_sleep(2);
sasl_dispose (&saslconn);
return IMAP_AUTH_FAILURE;
......
......@@ -270,7 +270,7 @@ int imap_mailbox_create (const char* folder)
goto fail;
mutt_message _("Mailbox created.");
sleep (1);
mutt_sleep (0);
FREE (&mx.mbox);
return 0;
......
......@@ -216,7 +216,7 @@ int imap_exec (IMAP_DATA* idata, const char* cmd, int flags)
pc = idata->cmd.buf;
pc = imap_next_word (pc);
mutt_error ("%s", pc);
sleep (2);
mutt_sleep (2);
return -1;
}
......@@ -368,7 +368,7 @@ static int cmd_handle_untagged (IMAP_DATA* idata)
/* Display the warning message from the server */
mutt_error ("%s", s+3);
sleep (2);
mutt_sleep (2);
}
return 0;
......
......@@ -292,7 +292,7 @@ static int imap_check_capabilities (IMAP_DATA* idata)
||mutt_bit_isset(idata->capabilities,IMAP4REV1)))
{
mutt_error _("This IMAP server is ancient. Mutt does not work with it.");
sleep (5); /* pause a moment to let the user see the error */
mutt_sleep (5); /* pause a moment to let the user see the error */
return -1;
}
......@@ -361,7 +361,7 @@ int imap_open_connection (IMAP_DATA* idata)
if (mutt_socket_open (idata->conn) < 0)
{
mutt_error (_("Connection to %s failed."), idata->conn->account.host);
sleep (1);
mutt_sleep (1);
return -1;
}
......@@ -390,7 +390,7 @@ int imap_open_connection (IMAP_DATA* idata)
if (mutt_ssl_starttls (idata->conn))
{
mutt_error ("Could not negotiate TLS connection");
sleep (1);
mutt_sleep (1);
goto bail;
}
else
......@@ -593,7 +593,7 @@ int imap_open_mailbox (CONTEXT* ctx)
s = imap_next_word (idata->cmd.buf); /* skip seq */
s = imap_next_word (s); /* Skip response */
mutt_error ("%s", s);
sleep (2);
mutt_sleep (2);
goto fail;
}
......
......@@ -72,7 +72,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
else
{ /* Unable to fetch headers for lower versions */
mutt_error _("Unable to fetch headers from this IMAP server version.");
sleep (2); /* pause a moment to let the user see the error */
mutt_sleep (2); /* pause a moment to let the user see the error */
return -1;
}
......@@ -476,7 +476,7 @@ int imap_append_message (CONTEXT *ctx, MESSAGE *msg)
SKIPWS (pc);
pc = imap_next_word (pc);
mutt_error ("%s", pc);
sleep (1);
mutt_sleep (1);
fclose (fp);
goto fail;
}
......@@ -514,7 +514,7 @@ int imap_append_message (CONTEXT *ctx, MESSAGE *msg)
SKIPWS (pc);
pc = imap_next_word (pc);
mutt_error ("%s", pc);
sleep (1);
mutt_sleep (1);
goto fail;
}
......
......@@ -219,7 +219,7 @@ int imap_continue (const char* msg, const char* resp)
void imap_error (const char *where, const char *msg)
{
mutt_error (_("%s [%s]\n"), where, msg);
sleep (2);
mutt_sleep (2);
}
/* imap_new_idata: Allocate and initialise a new IMAP_DATA structure.
......
......@@ -1880,6 +1880,14 @@ struct option_t MuttVars[] = {
** positives of ``$$quote_regexp'', most notably smileys in the beginning
** of a line
*/
{ "sleep_time", DT_NUM, R_NONE, UL &SleepTime, 1 },
/*
** .pp
** Specifies time, in seconds, to pause while displaying certain informational
** messages, while moving from folder to folder and after expunging
** messages from the current folder. The default is to pause one second, so
** a value of zero for this option suppresses the pause.
*/
{ "sort", DT_SORT, R_INDEX|R_RESORT, UL &Sort, SORT_DATE },
/*
** .pp
......
......@@ -732,7 +732,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
unlink (tempfile);
}
mutt_error _("Could not create temporary file!");
sleep (5);
mutt_sleep (5);
goto bail;
}
......@@ -749,7 +749,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
* never happen, is we presume it is a bug in mutt.
*/
mutt_error _("sync: mbox modified, but no modified messages! (report this bug)");
sleep(5); /* the mutt_error /will/ get cleared! */
mutt_sleep(5); /* the mutt_error /will/ get cleared! */
dprint(1, (debugfile, "mbox_sync_mailbox(): no modified messages.\n"));
unlink (tempfile);
goto bail;
......@@ -797,7 +797,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
if (fputs (MMDF_SEP, fp) == EOF)
{
mutt_perror (tempfile);
sleep (5);
mutt_sleep (5);
unlink (tempfile);
goto bail;
}
......@@ -808,7 +808,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
if (fputs (KENDRA_SEP, fp) == EOF)
{
mutt_perror (tempfile);
sleep (5);
mutt_sleep (5);
unlink (tempfile);
goto bail;
}
......@@ -823,7 +823,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
if (mutt_copy_message (fp, ctx, ctx->hdrs[i], M_CM_UPDATE, CH_FROM | CH_UPDATE | CH_UPDATE_LEN) == -1)
{
mutt_perror (tempfile);
sleep (5);
mutt_sleep (5);
unlink (tempfile);
goto bail;
}
......@@ -843,7 +843,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
if(fputs(MMDF_SEP, fp) == EOF)
{
mutt_perror (tempfile);
sleep (5);
mutt_sleep (5);
unlink (tempfile);
goto bail;
}
......@@ -852,7 +852,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
if(fputs(KENDRA_SEP, fp) == EOF)
{
mutt_perror (tempfile);
sleep (5);
mutt_sleep (5);
unlink (tempfile);
goto bail;
}
......@@ -861,7 +861,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
if(fputs("\n", fp) == EOF)
{
mutt_perror (tempfile);
sleep (5);
mutt_sleep (5);
unlink (tempfile);
goto bail;
}
......@@ -875,7 +875,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
dprint(1, (debugfile, "mbox_sync_mailbox: fclose() returned non-zero.\n"));
unlink (tempfile);
mutt_perror (tempfile);
sleep (5);
mutt_sleep (5);
goto bail;
}
fp = NULL;
......@@ -884,7 +884,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
if (stat (ctx->path, &statbuf) == -1)
{
mutt_perror (ctx->path);
sleep (5);
mutt_sleep (5);
unlink (tempfile);
goto bail;
}
......@@ -895,7 +895,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
mx_fastclose_mailbox (ctx);
dprint (1, (debugfile, "mbox_sync_mailbox: unable to reopen temp copy of mailbox!\n"));
mutt_perror (tempfile);
sleep (5);
mutt_sleep (5);
return (-1);
}
......@@ -953,7 +953,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
mx_fastclose_mailbox (ctx);
mutt_pretty_mailbox (savefile);
mutt_error (_("Write failed! Saved partial mailbox to %s"), savefile);
sleep (5);
mutt_sleep (5);
return (-1);
}
......
......@@ -340,7 +340,7 @@ void menu_redraw_prompt (MUTTMENU *menu)
{
if (option (OPTMSGERR))
{
sleep (1);
mutt_sleep (1);
unset_option (OPTMSGERR);
}
......
......@@ -200,7 +200,7 @@ CONNECTION* mutt_conn_find (const CONNECTION* start, const ACCOUNT* account)
mutt_nss_socket_setup (conn);
#else
mutt_error _("SSL is unavailable.");
sleep (2);
mutt_sleep (2);
FREE (&conn);
return NULL;
......@@ -234,10 +234,10 @@ static int socket_connect (int fd, struct sockaddr* sa)
dprint (1, (debugfile, "Preconnect result: %d\n", rc));
if (rc)
{
save_errno = errno;
mutt_perror (_("Preconnect command failed."));
sleep (1);
save_errno = errno;
mutt_perror (_("Preconnect command failed."));
mutt_sleep (1);
return save_errno;
}
}
......
......@@ -170,7 +170,7 @@ int ssl_init (void)
if (! HAVE_ENTROPY())
{
mutt_error (_("Failed to find enough entropy on your system"));
sleep (2);
mutt_sleep (2);
return -1;
}
}
......@@ -202,7 +202,7 @@ static int add_entropy (const char *file)
((st.st_mode & (S_IWOTH | S_IROTH)) != 0))
{
mutt_error (_("%s has insecure permissions!"), file);
sleep (2);
mutt_sleep (2);
return -1;
}
......@@ -221,7 +221,7 @@ static int add_entropy (const char *file)
static int ssl_socket_open_err (CONNECTION *conn)
{
mutt_error (_("SSL disabled due the lack of entropy"));
sleep (2);
mutt_sleep (2);
return -1;
}
......@@ -324,7 +324,7 @@ int ssl_negotiate (sslsockdata* ssldata)
}
mutt_error ("SSL failed: %s", errmsg);
sleep (1);
mutt_sleep (1);
return -1;
}
......@@ -333,7 +333,7 @@ int ssl_negotiate (sslsockdata* ssldata)
if (!ssldata->cert)
{
mutt_error (_("Unable to get certificate from peer"));
sleep (1);
mutt_sleep (1);
return -1;
}
......@@ -342,7 +342,7 @@ int ssl_negotiate (sslsockdata* ssldata)
mutt_message (_("SSL connection using %s (%s)"),
SSL_get_cipher_version (ssldata->ssl), SSL_get_cipher_name (ssldata->ssl));
sleep (1);
mutt_sleep (0);
return 0;
}
......@@ -489,14 +489,14 @@ static int check_certificate_by_digest (X509 *peercert)
{
dprint (2, (debugfile, "Server certificate is not yet valid\n"));
mutt_error (_("Server certificate is not yet valid"));
sleep (2);
mutt_sleep (2);
return 0;
}
if (X509_cmp_current_time (X509_get_notAfter (peercert)) <= 0)
{
dprint (2, (debugfile, "Server certificate has expired"));
mutt_error (_("Server certificate has expired"));
sleep (2);
mutt_sleep (2);
return 0;
}
......@@ -637,10 +637,15 @@ static int ssl_check_certificate (sslsockdata * data)
fclose (fp);
}
if (!done)
{
mutt_error (_("Warning: Couldn't save certificate"));
mutt_sleep (2);
}
else
{
mutt_message (_("Certificate saved"));
sleep (1);
mutt_sleep (0);
}
/* fall through */
case OP_MAX + 2: /* accept once */
done = 2;
......
......@@ -1216,3 +1216,10 @@ void mutt_display_sanitize (char *s)
}
}
void mutt_sleep (short s)
{
if (SleepTime > s)
sleep (SleepTime);
else if (s)
sleep (s);
}
......@@ -1175,8 +1175,8 @@ int mx_sync_mailbox (CONTEXT *ctx, int *index_hint)
mutt_message (_("%d kept, %d deleted."), msgcount - deleted,
deleted);
sleep (1); /* allow the user time to read the message */
mutt_sleep (0);
if (ctx->msgcount == ctx->deleted &&
(ctx->magic == M_MBOX || ctx->magic == M_MMDF) &&
!mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
......
......@@ -484,7 +484,7 @@ static pgp_key_t *pgp_select_key (pgp_key_t *keys,
if (!i && unusable)
{
mutt_error _("All matching keys are marked expired/revoked.");
sleep (1);
mutt_sleep (1);
return NULL;
}
......
......@@ -240,7 +240,7 @@ int pop_open_mailbox (CONTEXT *ctx)
if (pop_parse_path (ctx->path, &acct))
{
mutt_error ("%s is an invalid POP path", ctx->path);
sleep (2);
mutt_sleep (2);
return -1;
}
......@@ -276,7 +276,7 @@ int pop_open_mailbox (CONTEXT *ctx)
if (ret < -1)
{
sleep (2);
mutt_sleep (2);
return -1;
}
}
......@@ -351,7 +351,7 @@ int pop_fetch_message (MESSAGE* msg, CONTEXT* ctx, int msgno)
return 0;
mutt_perror (cache->path);
sleep (2);
mutt_sleep (2);
return -1;
}
else
......@@ -371,7 +371,7 @@ int pop_fetch_message (MESSAGE* msg, CONTEXT* ctx, int msgno)
if (h->refno < 0)
{
mutt_error _("The message index is incorrect. Try reopening the mailbox.");
sleep (2);
mutt_sleep (2);
return -1;
}
......@@ -382,7 +382,7 @@ int pop_fetch_message (MESSAGE* msg, CONTEXT* ctx, int msgno)
if (!msg->fp)
{
mutt_perror (path);
sleep (2);
mutt_sleep (2);
return -1;
}
......@@ -398,14 +398,14 @@ int pop_fetch_message (MESSAGE* msg, CONTEXT* ctx, int msgno)
if (ret == -2)
{
mutt_error ("%s", pop_data->err_msg);
sleep (2);
mutt_sleep (2);
return -1;
}
if (ret == -3)
{
mutt_error _("Can't write message to temporary file!");
sleep (2);
mutt_sleep (2);
return -1;
}
}
......@@ -483,7 +483,7 @@ int pop_sync_mailbox (CONTEXT *ctx, int *index_hint)
if (ret == -2)
{
mutt_error ("%s", pop_data->err_msg);
sleep (2);
mutt_sleep (2);
return -1;
}
}
......
......@@ -152,7 +152,7 @@ bail:
}
mutt_error _("SASL authentication failed.");
sleep (2);
mutt_sleep (2);
if (rc == SASL_OK)
return POP_A_FAILURE;
......@@ -212,7 +212,7 @@ static pop_auth_res_t pop_auth_apop (POP_DATA *pop_data)
}
mutt_error _("APOP authentication failed.");
sleep (2);
mutt_sleep (2);
return POP_A_SKIP;
}
......@@ -270,7 +270,7 @@ static pop_auth_res_t pop_auth_user (POP_DATA *pop_data)
}
mutt_error ("%s %s", _("Login failed."), pop_data->err_msg);
sleep (2);
mutt_sleep (2);
return POP_A_FAILURE;
}
......
......@@ -235,7 +235,7 @@ int pop_open_connection (POP_DATA *pop_data)
ret = pop_connect (pop_data);
if (ret < 0)
{
sleep (2);
mutt_sleep (2);
return ret;
}
......@@ -244,7 +244,7 @@ int pop_open_connection (POP_DATA *pop_data)
goto err_conn;
if (ret == -2)
{
sleep (2);
mutt_sleep (2);
return -2;
}
......@@ -262,7 +262,7 @@ int pop_open_connection (POP_DATA *pop_data)
if (ret == -2)
{
mutt_error ("%s", pop_data->err_msg);
sleep (2);
mutt_sleep (2);
return ret;
}
......@@ -272,7 +272,7 @@ int pop_open_connection (POP_DATA *pop_data)
err_conn:
pop_data->status = POP_DISCONNECTED;
mutt_error _("Server closed connection!");
sleep (2);
mutt_sleep (2);
return -1;
}
......@@ -462,7 +462,7 @@ int pop_reconnect (CONTEXT *ctx)
if (ret == -2)
{
mutt_error ("%s", pop_data->err_msg);
sleep (2);
mutt_sleep (2);
}
}
if (ret == 0)
......
......@@ -320,6 +320,7 @@ int mutt_write_mime_header (BODY *, FILE *);
int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int, int);
int mutt_yesorno (const char *, int);
void mutt_set_header_color(CONTEXT *, HEADER *);
void mutt_sleep (short);
int mutt_save_confirm (const char *, struct stat *);
int mh_valid_message (const char *);
......
......@@ -230,7 +230,7 @@ void mutt_sort_headers (CONTEXT *ctx, int init)
(AuxSort = mutt_get_sort_func (SortAux)) == NULL)
{
mutt_error _("Could not find sorting function! [report this bug]");
sleep (1);
mutt_sleep (1);
return;
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment