From: Richard Russon Date: Tue, 13 Feb 2018 02:42:14 +0000 (+0000) Subject: sleep after every error message X-Git-Tag: neomutt-20180323~13^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e1070ec2a3d1616b8073e660d0459e0be3a7fe8;p=neomutt sleep after every error message Mark the time of an error message. Do not allow an error to be cleared or overwritten by a normal message within one second. --- diff --git a/Makefile.autosetup b/Makefile.autosetup index 1f86c9f3d..3525ae40b 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -65,7 +65,7 @@ NEOMUTTOBJS= mutt_account.o addrbook.o alias.o attach.o bcache.o body.o \ compose.o compress.o conststrings.o copy.o curs_lib.o \ curs_main.o edit.o editmsg.o enter.o envelope.o filter.o \ flags.o from.o group.o handler.o hdrline.o \ - header.o help.o history.o hook.o init.o keymap.o main.o \ + header.o help.o history.o hook.o init.o keymap.o mutt_logging.o main.o \ mbox.o menu.o mh.o muttlib.o \ mutt_socket.o tags.o mx.o \ newsrc.o nntp.o pager.o parse.o pattern.o pop.o \ diff --git a/alias.c b/alias.c index 065a034d3..08cc4953a 100644 --- a/alias.c +++ b/alias.c @@ -356,7 +356,6 @@ retry_name: if (mutt_addrlist_to_intl(new->addr, &err)) { mutt_error(_("Error: '%s' is a bad IDN."), err); - mutt_sleep(2); continue; } } while (!new->addr); diff --git a/attach.c b/attach.c index 5fd7b1873..8c65f8f15 100644 --- a/attach.c +++ b/attach.c @@ -558,7 +558,6 @@ int mutt_view_attachment(FILE *fp, struct Body *a, int flag, struct Header *hdr, mutt_debug(1, "mutt_file_fopen(%s) errno=%d %s\n", pagerfile, errno, strerror(errno)); mutt_perror(pagerfile); - mutt_sleep(1); goto return_error; } decode_state.fpin = fp; @@ -823,7 +822,6 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct if (!s.fpout) { mutt_perror("fopen"); - mutt_sleep(2); return -1; } fseeko((s.fpin = fp), m->offset, SEEK_SET); @@ -832,7 +830,6 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct if (mutt_file_fsync_close(&s.fpout) != 0) { mutt_perror("fclose"); - mutt_sleep(2); return -1; } } diff --git a/commands.c b/commands.c index 8e3dea842..2cb8e2d07 100644 --- a/commands.c +++ b/commands.c @@ -266,7 +266,6 @@ void ci_bounce_message(struct Header *h) if (!h->env->from) { mutt_error(_("Warning: message contains no From: header")); - mutt_sleep(2); } } else if (Context) @@ -276,7 +275,6 @@ void ci_bounce_message(struct Header *h) if (message_is_tagged(Context, rc) && !Context->hdrs[rc]->env->from) { mutt_error(_("Warning: message contains no From: header")); - mutt_sleep(2); break; } } diff --git a/conn/sasl.c b/conn/sasl.c index 14db77f0f..77b25e2c5 100644 --- a/conn/sasl.c +++ b/conn/sasl.c @@ -607,7 +607,6 @@ int mutt_sasl_client_new(struct Connection *conn, sasl_conn_t **saslconn) if (rc != SASL_OK) { mutt_error(_("Error allocating SASL connection")); - mutt_sleep(2); return -1; } diff --git a/conn/socket.c b/conn/socket.c index f2a916983..19e2e3502 100644 --- a/conn/socket.c +++ b/conn/socket.c @@ -84,7 +84,6 @@ static int socket_preconnect(void) { const int save_errno = errno; mutt_perror(_("Preconnect command failed.")); - mutt_sleep(1); return save_errno; } @@ -274,7 +273,6 @@ int mutt_socket_readchar(struct Connection *conn, char *c) if (conn->available == 0) { mutt_error(_("Connection to %s closed"), conn->account.host); - mutt_sleep(2); } if (conn->available <= 0) { @@ -367,7 +365,6 @@ int raw_socket_read(struct Connection *conn, char *buf, size_t len) if (rc == -1) { mutt_error(_("Error talking to %s (%s)"), conn->account.host, strerror(errno)); - mutt_sleep(2); SigInt = 0; } mutt_sig_allow_interrupt(0); @@ -375,7 +372,6 @@ int raw_socket_read(struct Connection *conn, char *buf, size_t len) if (SigInt) { mutt_error(_("Connection to %s has been aborted"), conn->account.host); - mutt_sleep(2); SigInt = 0; rc = -1; } @@ -400,7 +396,6 @@ int raw_socket_write(struct Connection *conn, const char *buf, size_t count) if (rc == -1) { mutt_error(_("Error talking to %s (%s)"), conn->account.host, strerror(errno)); - mutt_sleep(2); SigInt = 0; } mutt_sig_allow_interrupt(0); @@ -408,7 +403,6 @@ int raw_socket_write(struct Connection *conn, const char *buf, size_t count) if (SigInt) { mutt_error(_("Connection to %s has been aborted"), conn->account.host); - mutt_sleep(2); SigInt = 0; rc = -1; } @@ -516,7 +510,6 @@ int raw_socket_open(struct Connection *conn) if (rc) { mutt_error(_("Could not find the host \"%s\""), conn->account.host); - mutt_sleep(2); return -1; } @@ -607,7 +600,6 @@ int raw_socket_open(struct Connection *conn) { mutt_error(_("Could not connect to %s (%s)."), conn->account.host, (rc > 0) ? strerror(rc) : _("unknown error")); - mutt_sleep(2); return -1; } diff --git a/conn/ssl.c b/conn/ssl.c index e3ce86ce2..c2d6b24a4 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -226,7 +226,6 @@ static int add_entropy(const char *file) ((st.st_mode & (S_IWOTH | S_IROTH)) != 0)) { mutt_error(_("%s has insecure permissions!"), file); - mutt_sleep(2); return -1; } @@ -373,7 +372,6 @@ static int ssl_passwd_cb(char *buf, int size, int rwflag, void *userdata) static int ssl_socket_open_err(struct Connection *conn) { mutt_error(_("SSL disabled due to the lack of entropy")); - mutt_sleep(2); return -1; } @@ -518,7 +516,6 @@ static bool check_certificate_expiration(X509 *peercert, bool silent) { mutt_debug(2, "Server certificate is not yet valid\n"); mutt_error(_("Server certificate is not yet valid")); - mutt_sleep(2); } return false; } @@ -528,7 +525,6 @@ static bool check_certificate_expiration(X509 *peercert, bool silent) { mutt_debug(2, "Server certificate has expired\n"); mutt_error(_("Server certificate has expired")); - mutt_sleep(2); } return false; } @@ -621,7 +617,6 @@ static int ssl_init(void) if (!HAVE_ENTROPY()) { mutt_error(_("Failed to find enough entropy on your system")); - mutt_sleep(2); return -1; } } @@ -1078,7 +1073,6 @@ static int interactive_check_cert(X509 *cert, int idx, size_t len, SSL *ssl, int if (!done) { mutt_error(_("Warning: Couldn't save certificate")); - mutt_sleep(2); } else { @@ -1199,7 +1193,6 @@ static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx) if (!check_host(cert, host, buf, sizeof(buf))) { mutt_error(_("Certificate host check failed: %s"), buf); - mutt_sleep(2); /* we disallow (a)ccept always in the prompt, because it will have no effect * for hostname mismatches. */ return interactive_check_cert(cert, pos, len, ssl, 0); @@ -1279,7 +1272,6 @@ static int ssl_negotiate(struct Connection *conn, struct SslSockData *ssldata) * TLS Server Name Indication (SNI). This allows the server to present * the correct certificate if it supports multiple hosts. */ mutt_error(_("Warning: unable to set TLS SNI host name")); - mutt_sleep(1); } ERR_clear_error(); @@ -1300,7 +1292,6 @@ static int ssl_negotiate(struct Connection *conn, struct SslSockData *ssldata) } mutt_error(_("SSL failed: %s"), errmsg); - mutt_sleep(1); return -1; } @@ -1389,7 +1380,6 @@ static int ssl_socket_open(struct Connection *conn) if (ssl_set_verify_partial(data->ctx)) { mutt_error(_("Warning: error enabling ssl_verify_partial_chains")); - mutt_sleep(2); } data->ssl = SSL_new(data->ctx); @@ -1490,7 +1480,6 @@ int mutt_ssl_starttls(struct Connection *conn) if (ssl_set_verify_partial(ssldata->ctx)) { mutt_error(_("Warning: error enabling ssl_verify_partial_chains")); - mutt_sleep(2); } ssldata->ssl = SSL_new(ssldata->ctx); diff --git a/conn/ssl_gnutls.c b/conn/ssl_gnutls.c index 8efa70b00..5698bc5ea 100644 --- a/conn/ssl_gnutls.c +++ b/conn/ssl_gnutls.c @@ -92,7 +92,6 @@ static int tls_init(void) if (err < 0) { mutt_error("gnutls_global_init: %s", gnutls_strerror(err)); - mutt_sleep(2); return -1; } @@ -116,7 +115,6 @@ static int tls_socket_read(struct Connection *conn, char *buf, size_t len) if (!data) { mutt_error(_("Error: no TLS socket open")); - mutt_sleep(2); return -1; } @@ -126,7 +124,6 @@ static int tls_socket_read(struct Connection *conn, char *buf, size_t len) if ((rc < 0 && gnutls_error_is_fatal(rc) == 1) || rc == GNUTLS_E_INTERRUPTED) { mutt_error("tls_socket_read (%s)", gnutls_strerror(rc)); - mutt_sleep(2); return -1; } } while (rc == GNUTLS_E_AGAIN); @@ -150,7 +147,6 @@ static int tls_socket_write(struct Connection *conn, const char *buf, size_t len if (!data) { mutt_error(_("Error: no TLS socket open")); - mutt_sleep(2); return -1; } @@ -162,7 +158,6 @@ static int tls_socket_write(struct Connection *conn, const char *buf, size_t len if (gnutls_error_is_fatal(ret) == 1 || ret == GNUTLS_E_INTERRUPTED) { mutt_error("tls_socket_write (%s)", gnutls_strerror(ret)); - mutt_sleep(4); return -1; } return ret; @@ -240,13 +235,11 @@ static gnutls_certificate_status_t tls_verify_peers(gnutls_session_t tlsstate) if (status == GNUTLS_E_NO_CERTIFICATE_FOUND) { mutt_error(_("Unable to get certificate from peer")); - mutt_sleep(2); return 0; } if (verify_ret < 0) { mutt_error(_("Certificate verification error (%s)"), gnutls_strerror(status)); - mutt_sleep(2); return 0; } @@ -254,7 +247,6 @@ static gnutls_certificate_status_t tls_verify_peers(gnutls_session_t tlsstate) if (gnutls_certificate_type_get(tlsstate) != GNUTLS_CRT_X509) { mutt_error(_("Certificate is not X.509")); - mutt_sleep(2); return 0; } @@ -447,14 +439,12 @@ static int tls_check_preauth(const gnutls_datum_t *certdata, if (gnutls_x509_crt_init(&cert) < 0) { mutt_error(_("Error initialising gnutls certificate data")); - mutt_sleep(2); return -1; } if (gnutls_x509_crt_import(cert, certdata, GNUTLS_X509_FMT_DER) < 0) { mutt_error(_("Error processing certificate data")); - mutt_sleep(2); gnutls_x509_crt_deinit(cert); return -1; } @@ -597,7 +587,6 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata, { mutt_error(_("Warning: Server certificate was signed using an insecure " "algorithm")); - mutt_sleep(2); } return 0; } @@ -606,14 +595,12 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata, if (gnutls_x509_crt_init(&cert) < 0) { mutt_error(_("Error initialising gnutls certificate data")); - mutt_sleep(2); return 0; } if (gnutls_x509_crt_import(cert, certdata, GNUTLS_X509_FMT_DER) < 0) { mutt_error(_("Error processing certificate data")); - mutt_sleep(2); gnutls_x509_crt_deinit(cert); return 0; } @@ -853,7 +840,6 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata, if (!done) { mutt_error(_("Warning: Couldn't save certificate")); - mutt_sleep(2); } else { @@ -893,7 +879,6 @@ static int tls_check_certificate(struct Connection *conn) if (gnutls_auth_get_type(state) != GNUTLS_CRD_CERTIFICATE) { mutt_error(_("Unable to get certificate from peer")); - mutt_sleep(2); return 0; } @@ -903,7 +888,6 @@ static int tls_check_certificate(struct Connection *conn) if (!cert_list) { mutt_error(_("Unable to get certificate from peer")); - mutt_sleep(2); return 0; } @@ -1073,7 +1057,6 @@ static int tls_set_priority(struct TlsSockData *data) if (err < 0) { mutt_error("gnutls_priority_set_direct(%s): %s", priority, gnutls_strerror(err)); - mutt_sleep(2); FREE(&priority); return -1; } @@ -1113,7 +1096,6 @@ static int tls_set_priority(struct TlsSockData *data) { mutt_error( _("Explicit ciphersuite selection via $ssl_ciphers not supported")); - mutt_sleep(2); } /* We use default priorities (see gnutls documentation), @@ -1145,7 +1127,6 @@ static int tls_negotiate(struct Connection *conn) { FREE(&conn->sockdata); mutt_error("gnutls_certificate_allocate_credentials: %s", gnutls_strerror(err)); - mutt_sleep(2); return -1; } @@ -1175,7 +1156,6 @@ static int tls_negotiate(struct Connection *conn) if (err) { mutt_error("gnutls_handshake: %s", gnutls_strerror(err)); - mutt_sleep(2); goto fail; } @@ -1186,7 +1166,6 @@ static int tls_negotiate(struct Connection *conn) mutt_str_strlen(conn->account.host))) { mutt_error(_("Warning: unable to set TLS SNI host name")); - mutt_sleep(1); } if (tls_set_priority(data) < 0) @@ -1220,7 +1199,6 @@ static int tls_negotiate(struct Connection *conn) { mutt_error("gnutls_handshake: %s", gnutls_strerror(err)); } - mutt_sleep(2); goto fail; } diff --git a/conn/tunnel.c b/conn/tunnel.c index 0ab7e85cb..174108bd8 100644 --- a/conn/tunnel.c +++ b/conn/tunnel.c @@ -160,7 +160,6 @@ static int tunnel_socket_close(struct Connection *conn) { mutt_error(_("Tunnel to %s returned error %d (%s)"), conn->account.host, WEXITSTATUS(status), NONULL(mutt_str_sysexit(WEXITSTATUS(status)))); - mutt_sleep(2); } FREE(&conn->sockdata); @@ -184,7 +183,6 @@ static int tunnel_socket_read(struct Connection *conn, char *buf, size_t len) if (rc == -1) { mutt_error(_("Tunnel error talking to %s: %s"), conn->account.host, strerror(errno)); - mutt_sleep(1); } return rc; @@ -207,7 +205,6 @@ static int tunnel_socket_write(struct Connection *conn, const char *buf, size_t if (rc == -1) { mutt_error(_("Tunnel error talking to %s: %s"), conn->account.host, strerror(errno)); - mutt_sleep(1); } return rc; diff --git a/copy.c b/copy.c index a045ff8b3..05d754889 100644 --- a/copy.c +++ b/copy.c @@ -611,7 +611,6 @@ int mutt_copy_message_fp(FILE *fpout, FILE *fpin, struct Header *hdr, int flags, { mutt_error("The length calculation was wrong by %ld bytes", fail); new_length += fail; - mutt_sleep(1); } /* Update original message if we are sync'ing a mailfolder */ diff --git a/curs_lib.c b/curs_lib.c index ab1b053f2..92b7c1450 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -45,6 +45,7 @@ #include "globals.h" #include "header.h" #include "mutt_curses.h" +#include "mutt_logging.h" #include "mutt_menu.h" #include "opcodes.h" #include "options.h" @@ -213,13 +214,6 @@ int mutt_get_field_unbuffered(char *msg, char *buf, size_t buflen, int flags) return rc; } -void mutt_clear_error(void) -{ - ErrorBuf[0] = 0; - if (!OPT_NO_CURSES) - mutt_window_clearline(MuttMessageWindow, 0); -} - void mutt_edit_file(const char *editor, const char *data) { char cmd[LONG_STRING]; @@ -229,7 +223,6 @@ void mutt_edit_file(const char *editor, const char *data) if (mutt_system(cmd) != 0) { mutt_error(_("Error running \"%s\"!"), cmd); - mutt_sleep(2); } /* the terminal may have been resized while the editor owned it */ mutt_resize_screen(); @@ -398,6 +391,10 @@ static void curses_message(int error, const char *fmt, va_list ap) vsnprintf(scratch, sizeof(scratch), fmt, ap); + /* Only pause if this is a message following an error */ + if (!error && OPT_MSG_ERR) + error_pause(); + mutt_debug(1, "%s\n", scratch); mutt_simple_format(ErrorBuf, sizeof(ErrorBuf), 0, MuttMessageWindow->cols, FMT_LEFT, 0, scratch, sizeof(scratch), 0); @@ -414,9 +411,16 @@ static void curses_message(int error, const char *fmt, va_list ap) } if (error) + { OPT_MSG_ERR = true; + if (gettimeofday(&LastError, NULL) < 0) + mutt_debug(1, "gettimeofday failed: %d\n", errno); + } else + { OPT_MSG_ERR = false; + LastError.tv_sec = 0; + } } void mutt_curses_error(const char *fmt, ...) diff --git a/hcache/hcache.c b/hcache/hcache.c index 606ffd1a3..6f876c004 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -543,7 +543,6 @@ static bool create_hcache_dir(const char *path) return true; mutt_error(_("Can't create %s: %s."), dir, strerror(errno)); - mutt_sleep(2); return false; } diff --git a/hook.c b/hook.c index 33095e458..7b8bbeec7 100644 --- a/hook.c +++ b/hook.c @@ -365,7 +365,6 @@ void mutt_folder_hook(const char *path) { mutt_error("%s", err.data); FREE(&token.data); - mutt_sleep(1); /* pause a moment to let the user see the error */ current_hook_type = 0; FREE(&err.data); @@ -425,7 +424,6 @@ void mutt_message_hook(struct Context *ctx, struct Header *hdr, int type) { FREE(&token.data); mutt_error("%s", err.data); - mutt_sleep(1); current_hook_type = 0; FREE(&err.data); @@ -571,7 +569,6 @@ void mutt_account_hook(const char *url) FREE(&token.data); mutt_error("%s", err.data); FREE(&err.data); - mutt_sleep(1); inhook = false; return; @@ -605,7 +602,6 @@ void mutt_timeout_hook(void) if (mutt_parse_rc_line(hook->command, &token, &err) == -1) { mutt_error("%s", err.data); - mutt_sleep(1); /* The hooks should be independent of each other, so even though this on * failed, we'll carry on with the others. */ @@ -640,7 +636,6 @@ void mutt_startup_shutdown_hook(int type) if (mutt_parse_rc_line(hook->command, &token, &err) == -1) { mutt_error("%s", err.data); - mutt_sleep(1); } } FREE(&token.data); diff --git a/imap/auth.c b/imap/auth.c index 21caa7db7..e4f8771f1 100644 --- a/imap/auth.c +++ b/imap/auth.c @@ -130,7 +130,6 @@ int imap_authenticate(struct ImapData *idata) if (r == IMAP_AUTH_UNAVAIL) { mutt_error(_("No authenticators available")); - mutt_sleep(1); } return r; diff --git a/imap/auth_anon.c b/imap/auth_anon.c index d6a0bb10c..0adb57922 100644 --- a/imap/auth_anon.c +++ b/imap/auth_anon.c @@ -93,6 +93,5 @@ enum ImapAuthRes imap_auth_anon(struct ImapData *idata, const char *method) bail: mutt_error(_("Anonymous authentication failed.")); - mutt_sleep(2); return IMAP_AUTH_FAILURE; } diff --git a/imap/auth_cram.c b/imap/auth_cram.c index 5e98baf4e..7cc20ba5f 100644 --- a/imap/auth_cram.c +++ b/imap/auth_cram.c @@ -187,6 +187,5 @@ enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method) bail: mutt_error(_("CRAM-MD5 authentication failed.")); - mutt_sleep(2); return IMAP_AUTH_FAILURE; } diff --git a/imap/auth_gss.c b/imap/auth_gss.c index 40adcfae1..542bf9b09 100644 --- a/imap/auth_gss.c +++ b/imap/auth_gss.c @@ -315,6 +315,5 @@ err_abort_cmd: bail: mutt_error(_("GSSAPI authentication failed.")); - mutt_sleep(2); return IMAP_AUTH_FAILURE; } diff --git a/imap/auth_login.c b/imap/auth_login.c index 4b8572e04..f9769632e 100644 --- a/imap/auth_login.c +++ b/imap/auth_login.c @@ -87,6 +87,5 @@ enum ImapAuthRes imap_auth_login(struct ImapData *idata, const char *method) } mutt_error(_("Login failed.")); - mutt_sleep(2); return IMAP_AUTH_FAILURE; } diff --git a/imap/auth_plain.c b/imap/auth_plain.c index 355125dc0..2243c362e 100644 --- a/imap/auth_plain.c +++ b/imap/auth_plain.c @@ -75,7 +75,6 @@ enum ImapAuthRes imap_auth_plain(struct ImapData *idata, const char *method) else if (rc == IMAP_CMD_NO) { mutt_error(_("Login failed.")); - mutt_sleep(2); res = IMAP_AUTH_FAILURE; } diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index 2b212237b..b802aa2d3 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -255,7 +255,6 @@ bail: } mutt_error(_("SASL authentication failed.")); - mutt_sleep(2); return IMAP_AUTH_FAILURE; } diff --git a/imap/browse.c b/imap/browse.c index fafa56858..97842bf60 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -402,7 +402,6 @@ int imap_mailbox_create(const char *folder) if (!mutt_str_strlen(buf)) { mutt_error(_("Mailbox must have a name.")); - mutt_sleep(1); goto fail; } @@ -463,7 +462,6 @@ int imap_mailbox_rename(const char *mailbox) if (!mutt_str_strlen(newname)) { mutt_error(_("Mailbox must have a name.")); - mutt_sleep(1); goto fail; } @@ -472,7 +470,6 @@ int imap_mailbox_rename(const char *mailbox) if (imap_rename_mailbox(idata, &mx, buf) < 0) { mutt_error(_("Rename failed: %s"), imap_get_qualifier(idata->buf)); - mutt_sleep(1); goto fail; } diff --git a/imap/command.c b/imap/command.c index a0420b075..f8fea70d9 100644 --- a/imap/command.c +++ b/imap/command.c @@ -167,7 +167,6 @@ static void cmd_handle_fatal(struct ImapData *idata) mutt_socket_close(idata->conn); mutt_error(_("Mailbox %s@%s closed"), idata->conn->account.login, idata->conn->account.host); - mutt_sleep(1); idata->state = IMAP_DISCONNECTED; } @@ -898,7 +897,6 @@ static int cmd_handle_untagged(struct ImapData *idata) s += 3; SKIPWS(s); mutt_error("%s", s); - mutt_sleep(2); cmd_handle_fatal(idata); return -1; @@ -909,7 +907,6 @@ static int cmd_handle_untagged(struct ImapData *idata) /* Display the warning message from the server */ mutt_error("%s", s + 3); - mutt_sleep(2); } return 0; @@ -1128,7 +1125,6 @@ int imap_exec(struct ImapData *idata, const char *cmdstr, int flags) (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; } @@ -1223,7 +1219,6 @@ int imap_cmd_idle(struct ImapData *idata) 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; } diff --git a/imap/imap.c b/imap/imap.c index 27f0f1a16..30a5b6256 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -127,8 +127,6 @@ static int check_capabilities(struct ImapData *idata) { mutt_error( _("This IMAP server is ancient. NeoMutt does not work with it.")); - mutt_sleep(2); /* pause a moment to let the user see the error */ - return -1; } @@ -1082,7 +1080,6 @@ int imap_open_connection(struct ImapData *idata) if (mutt_ssl_starttls(idata->conn)) { mutt_error(_("Could not negotiate TLS connection")); - mutt_sleep(1); goto err_close_conn; } else @@ -1098,7 +1095,6 @@ int imap_open_connection(struct ImapData *idata) if (SslForceTls && !idata->conn->ssf) { mutt_error(_("Encrypted connection unavailable")); - mutt_sleep(1); goto err_close_conn; } #endif @@ -2169,7 +2165,6 @@ static int imap_open_mailbox(struct Context *ctx) s = imap_next_word(idata->buf); /* skip seq */ s = imap_next_word(s); /* Skip response */ mutt_error("%s", s); - mutt_sleep(2); goto fail; } @@ -2218,7 +2213,6 @@ static int imap_open_mailbox(struct Context *ctx) if (count && (imap_read_headers(idata, 1, count) < 0)) { mutt_error(_("Error opening mailbox")); - mutt_sleep(1); goto fail; } @@ -2434,7 +2428,6 @@ int imap_sync_mailbox(struct Context *ctx, int expunge) if (rc < 0) { mutt_error(_("Expunge failed")); - mutt_sleep(1); goto out; } @@ -2658,7 +2651,6 @@ static int imap_edit_message_tags(struct Context *ctx, const char *tags, char *b *checker == 93) // ] { mutt_error(_("Invalid IMAP flags")); - mutt_sleep(2); return 0; } diff --git a/imap/message.c b/imap/message.c index ff7a76a27..d7d2d1113 100644 --- a/imap/message.c +++ b/imap/message.c @@ -489,7 +489,6 @@ static void alloc_msn_index(struct ImapData *idata, size_t msn_count) if (msn_count >= (UINT_MAX / sizeof(struct Header *))) { mutt_error(_("Integer overflow -- can't allocate memory.")); - sleep(1); mutt_exit(1); } @@ -662,7 +661,6 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i else { /* Unable to fetch headers for lower versions */ mutt_error(_("Unable to fetch headers from this IMAP server version.")); - mutt_sleep(2); /* pause a moment to let the user see the error */ goto error_out_0; } @@ -673,7 +671,6 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i if (!fp) { mutt_error(_("Could not create temporary file %s"), tempfile); - mutt_sleep(2); goto error_out_0; } unlink(tempfile); @@ -1333,7 +1330,6 @@ int imap_append_message(struct Context *ctx, struct Message *msg) SKIPWS(pc); pc = imap_next_word(pc); mutt_error("%s", pc); - mutt_sleep(1); mutt_file_fclose(&fp); goto fail; } @@ -1372,7 +1368,6 @@ int imap_append_message(struct Context *ctx, struct Message *msg) SKIPWS(pc); pc = imap_next_word(pc); mutt_error("%s", pc); - mutt_sleep(1); goto fail; } diff --git a/imap/util.c b/imap/util.c index 4e35df2bf..9e39e84c4 100644 --- a/imap/util.c +++ b/imap/util.c @@ -604,7 +604,6 @@ 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); - mutt_sleep(2); } /** diff --git a/mbox.c b/mbox.c index ba1f802f9..075bd9b2b 100644 --- a/mbox.c +++ b/mbox.c @@ -1010,7 +1010,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) unlink(tempfile); } mutt_error(_("Could not create temporary file!")); - mutt_sleep(5); goto bail; } @@ -1029,7 +1028,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) */ mutt_error( _("sync: mbox modified, but no modified messages! (report this bug)")); - mutt_sleep(5); /* the mutt_error /will/ get cleared! */ mutt_debug(1, "no modified messages.\n"); unlink(tempfile); goto bail; @@ -1080,7 +1078,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) if (fputs(MMDF_SEP, fp) == EOF) { mutt_perror(tempfile); - mutt_sleep(5); unlink(tempfile); goto bail; } @@ -1096,7 +1093,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) CH_FROM | CH_UPDATE | CH_UPDATE_LEN) != 0) { mutt_perror(tempfile); - mutt_sleep(5); unlink(tempfile); goto bail; } @@ -1116,7 +1112,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) if (fputs(MMDF_SEP, fp) == EOF) { mutt_perror(tempfile); - mutt_sleep(5); unlink(tempfile); goto bail; } @@ -1125,7 +1120,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) if (fputs("\n", fp) == EOF) { mutt_perror(tempfile); - mutt_sleep(5); unlink(tempfile); goto bail; } @@ -1139,7 +1133,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) mutt_debug(1, "mutt_file_fclose (&) returned non-zero.\n"); unlink(tempfile); mutt_perror(tempfile); - mutt_sleep(5); goto bail; } fp = NULL; @@ -1148,7 +1141,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) if (stat(ctx->path, &statbuf) == -1) { mutt_perror(ctx->path); - mutt_sleep(5); unlink(tempfile); goto bail; } @@ -1160,7 +1152,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) mx_fastclose_mailbox(ctx); mutt_debug(1, "unable to reopen temp copy of mailbox!\n"); mutt_perror(tempfile); - mutt_sleep(5); FREE(&new_offset); FREE(&old_offset); return -1; @@ -1225,7 +1216,6 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) mx_fastclose_mailbox(ctx); mutt_pretty_mailbox(savefile, sizeof(savefile)); mutt_error(_("Write failed! Saved partial mailbox to %s"), savefile); - mutt_sleep(5); FREE(&new_offset); FREE(&old_offset); return -1; diff --git a/mutt/memory.c b/mutt/memory.c index a40bb45e4..065d124c1 100644 --- a/mutt/memory.c +++ b/mutt/memory.c @@ -58,7 +58,6 @@ void *mutt_mem_calloc(size_t nmemb, size_t size) if (nmemb > (SIZE_MAX / size)) { mutt_error(_("Integer overflow -- can't allocate memory!")); - sleep(1); mutt_exit(1); } @@ -66,7 +65,6 @@ void *mutt_mem_calloc(size_t nmemb, size_t size) if (!p) { mutt_error(_("Out of memory!")); - sleep(1); mutt_exit(1); } return p; @@ -108,7 +106,6 @@ void *mutt_mem_malloc(size_t size) if (!p) { mutt_error(_("Out of memory!")); - sleep(1); mutt_exit(1); } return p; @@ -143,7 +140,6 @@ void mutt_mem_realloc(void *ptr, size_t size) if (!r) { mutt_error(_("Out of memory!")); - sleep(1); mutt_exit(1); } diff --git a/mutt_logging.c b/mutt_logging.c new file mode 100644 index 000000000..10f0b3f81 --- /dev/null +++ b/mutt_logging.c @@ -0,0 +1,98 @@ +/** + * @file + * Mutt Logging + * + * @authors + * Copyright (C) 2018 Richard Russon + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +/** + * @page mutt_logging Mutt Logging + * + * Mutt Logging + * + * | File | Description + * | :------------------- | :----------------------------------------------- + * | mutt_clear_error() | Clear the message line (bottom line of screen) + */ + +#include "config.h" +#include +#include +#include +#include +#include "mutt/mutt.h" +#include "globals.h" +#include "mutt_curses.h" + +struct timeval LastError = { 0 }; + +/** + * micro_elapsed - Number of microseconds between two timevals + * @param begin Begin time + * @param end End time + * @retval num Microseconds elapsed + * @retval LONG_MAX Begin time was zero + */ +static long micro_elapsed(const struct timeval *begin, const struct timeval *end) +{ + if ((begin->tv_sec == 0) && (end->tv_sec != 0)) + return LONG_MAX; + + return ((end->tv_sec - begin->tv_sec) * 1000000) + (end->tv_usec - begin->tv_usec); +} + +/** + * error_pause - Wait for an error message to be read + * + * If a second hasn't elapsed since LastError, then wait. + */ +void error_pause(void) +{ + struct timeval now = { 0 }; + + if (gettimeofday(&now, NULL) < 0) + { + mutt_debug(1, "gettimeofday failed: %d\n", errno); + return; + } + + long micro = micro_elapsed(&LastError, &now); + if (micro >= 1000000) + return; + + struct timespec wait = { 0 }; + wait.tv_nsec = 1000000000 - (micro * 10); + + mutt_refresh(); + nanosleep(&wait, NULL); +} + +/** + * mutt_clear_error - Clear the message line (bottom line of screen) + */ +void mutt_clear_error(void) +{ + /* Make sure the error message has had time to be read */ + if (OPT_MSG_ERR) + error_pause(); + + ErrorBuf[0] = 0; + if (!OPT_NO_CURSES) + mutt_window_clearline(MuttMessageWindow, 0); +} + diff --git a/mutt_logging.h b/mutt_logging.h new file mode 100644 index 000000000..a252b7807 --- /dev/null +++ b/mutt_logging.h @@ -0,0 +1,33 @@ +/** + * @file + * Mutt Logging + * + * @authors + * Copyright (C) 2018 Richard Russon + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef _LOGGING2_H +#define _LOGGING2_H + +#include + +extern struct timeval LastError; + +void mutt_clear_error(void); +void error_pause(void); + +#endif /* _LOGGING2_H */ diff --git a/mx.c b/mx.c index 17a20c925..18213060a 100644 --- a/mx.c +++ b/mx.c @@ -1260,7 +1260,6 @@ void mx_alloc_memory(struct Context *ctx) if ((ctx->hdrmax + 25) * s < ctx->hdrmax * s) { mutt_error(_("Integer overflow -- can't allocate memory.")); - sleep(1); mutt_exit(1); } diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index fb3fb157c..d3f364cd1 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -466,7 +466,6 @@ static gpgme_ctx_t create_gpgme_context(int for_smime) if (err) { mutt_error(_("error creating gpgme context: %s\n"), gpgme_strerror(err)); - sleep(2); mutt_exit(1); } @@ -476,7 +475,6 @@ static gpgme_ctx_t create_gpgme_context(int for_smime) if (err) { mutt_error(_("error enabling CMS protocol: %s\n"), gpgme_strerror(err)); - sleep(2); mutt_exit(1); } } @@ -498,7 +496,6 @@ static gpgme_data_t create_gpgme_data(void) if (err) { mutt_error(_("error creating gpgme data object: %s\n"), gpgme_strerror(err)); - sleep(2); mutt_exit(1); } return data; @@ -841,7 +838,6 @@ static gpgme_error_t set_pka_sig_notation(gpgme_ctx_t ctx) if (err) { mutt_error(_("error setting PKA signature notation: %s\n"), gpgme_strerror(err)); - mutt_sleep(2); } return err; @@ -2392,14 +2388,12 @@ void pgp_gpgme_invoke_import(const char *fname) { mutt_file_fclose(&in); mutt_error(_("error allocating data object: %s\n"), gpgme_strerror(err)); - mutt_sleep(1); return; } if (pgp_gpgme_extract_keys(keydata, &out, 0)) { mutt_error(_("Error extracting key data!\n")); - mutt_sleep(1); } gpgme_data_release(keydata); mutt_file_fclose(&in); @@ -2790,7 +2784,6 @@ int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s) else { mutt_error(_("Could not decrypt PGP message")); - mutt_sleep(2); rc = -1; } @@ -4204,7 +4197,6 @@ static struct CryptKeyInfo *crypt_select_key(struct CryptKeyInfo *keys, if (!i && unusable) { mutt_error(_("All matching keys are marked expired/revoked.")); - mutt_sleep(1); return NULL; } @@ -4611,7 +4603,6 @@ static struct CryptKeyInfo *crypt_ask_for_key(char *tag, char *whatfor, short ab return key; mutt_error(_("No matching keys found for \"%s\""), resp); - mutt_sleep(0); } /* not reached */ } @@ -4783,7 +4774,6 @@ struct Body *pgp_gpgme_make_key_attachment(char *tempf) if (err != GPG_ERR_NO_ERROR) { mutt_error(_("Error exporting key: %s\n"), gpgme_strerror(err)); - mutt_sleep(1); goto bail; } diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 0336d1396..e625c867e 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -507,7 +507,6 @@ int pgp_application_pgp_handler(struct Body *m, struct State *s) if (could_not_decrypt && !(s->flags & MUTT_DISPLAY)) { mutt_error(_("Could not decrypt PGP message")); - mutt_sleep(1); rc = -1; goto out; } @@ -1084,7 +1083,6 @@ int pgp_encrypted_handler(struct Body *a, struct State *s) else { mutt_error(_("Could not decrypt PGP message")); - mutt_sleep(2); /* void the passphrase, even if it's not necessarily the problem */ pgp_void_passphrase(); rc = -1; diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index f56c8d38a..60e7c0acb 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -513,7 +513,6 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys, if (!i && unusable) { mutt_error(_("All matching keys are expired, revoked, or disabled.")); - mutt_sleep(1); return NULL; } @@ -724,7 +723,6 @@ struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, en return key; mutt_error(_("No matching keys found for \"%s\""), resp); - mutt_sleep(0); } /* not reached */ } diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 37e82fa80..c91849689 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -757,7 +757,6 @@ static struct SmimeKey *smime_ask_for_key(char *prompt, short abilities, short p return key; mutt_error(_("No matching keys found for \"%s\""), resp); - mutt_sleep(0); } } diff --git a/newsrc.c b/newsrc.c index 6b351510d..0afb03176 100644 --- a/newsrc.c +++ b/newsrc.c @@ -185,7 +185,6 @@ int nntp_newsrc_parse(struct NntpServer *nserv) if (!nserv->newsrc_fp) { mutt_perror(nserv->newsrc_file); - mutt_sleep(2); return -1; } @@ -201,7 +200,6 @@ int nntp_newsrc_parse(struct NntpServer *nserv) { mutt_perror(nserv->newsrc_file); nntp_newsrc_close(nserv); - mutt_sleep(2); return -1; } @@ -425,8 +423,6 @@ static int update_file(char *filename, char *buf) mutt_file_fclose(&fp); if (*tmpfile) unlink(tmpfile); - if (rc) - mutt_sleep(2); return rc; } @@ -500,7 +496,6 @@ int nntp_newsrc_update(struct NntpServer *nserv) else { mutt_perror(nserv->newsrc_file); - mutt_sleep(2); } } FREE(&buf); @@ -966,7 +961,6 @@ struct NntpServer *nntp_select_server(char *server, bool leave_lock) if (!server || !*server) { mutt_error(_("No news server defined!")); - mutt_sleep(2); return NULL; } @@ -981,7 +975,6 @@ struct NntpServer *nntp_select_server(char *server, bool leave_lock) { url_free(&url); mutt_error(_("%s is an invalid news server specification!"), server); - mutt_sleep(2); return NULL; } if (url.scheme == U_NNTPS) @@ -1044,7 +1037,6 @@ struct NntpServer *nntp_select_server(char *server, bool leave_lock) if (mutt_file_mkdir(file, S_IRWXU) < 0) { mutt_error(_("Can't create %s: %s."), file, strerror(errno)); - mutt_sleep(2); } nserv->cacheable = true; } diff --git a/nntp.c b/nntp.c index ae28c6889..3f01d482d 100644 --- a/nntp.c +++ b/nntp.c @@ -60,7 +60,6 @@ static int nntp_connect_error(struct NntpServer *nserv) { nserv->status = NNTP_NONE; mutt_error(_("Server closed connection!")); - mutt_sleep(2); return -1; } @@ -163,7 +162,6 @@ static int nntp_capabilities(struct NntpServer *nserv) mutt_socket_close(conn); nserv->status = NNTP_BYE; mutt_error(_("Server doesn't support reader mode.")); - mutt_sleep(2); return -1; } @@ -363,7 +361,6 @@ static int nntp_auth(struct NntpServer *nserv) if (!a) { mutt_error(_("No authenticators available")); - mutt_sleep(2); break; } @@ -582,7 +579,6 @@ static int nntp_auth(struct NntpServer *nserv) } mutt_error(_("%s authentication failed."), method); - mutt_sleep(2); break; } break; @@ -594,7 +590,6 @@ static int nntp_auth(struct NntpServer *nserv) if (conn->fd < 0) { mutt_error(_("Server closed connection!")); - mutt_sleep(2); } else mutt_socket_close(conn); @@ -630,7 +625,6 @@ int nntp_open_connection(struct NntpServer *nserv) mutt_socket_close(conn); mutt_str_remove_trailing_ws(buf); mutt_error("%s", buf); - mutt_sleep(2); return -1; } @@ -657,7 +651,6 @@ int nntp_open_connection(struct NntpServer *nserv) { mutt_socket_close(conn); mutt_error(_("Could not switch to reader mode.")); - mutt_sleep(2); return -1; } @@ -695,7 +688,6 @@ int nntp_open_connection(struct NntpServer *nserv) { nserv->use_tls = 0; mutt_error("STARTTLS: %s", buf); - mutt_sleep(2); } else if (mutt_ssl_starttls(conn)) { @@ -703,7 +695,6 @@ int nntp_open_connection(struct NntpServer *nserv) nserv->status = NNTP_NONE; mutt_socket_close(nserv->conn); mutt_error(_("Could not negotiate TLS connection")); - mutt_sleep(2); return -1; } else @@ -748,7 +739,6 @@ int nntp_open_connection(struct NntpServer *nserv) { mutt_socket_close(conn); mutt_error(_("Could not switch to reader mode.")); - mutt_sleep(2); return -1; } } @@ -972,7 +962,6 @@ static int get_description(struct NntpData *nntp_data, char *wildmat, char *msg) if (rc > 0) { mutt_error("%s: %s", cmd, buf); - mutt_sleep(2); } return rc; } @@ -1263,7 +1252,6 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, if (rc > 0) { mutt_error("LISTGROUP: %s", buf); - mutt_sleep(2); } if (rc == 0) { @@ -1364,7 +1352,6 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, if (!fp) { mutt_perror(tempfile); - mutt_sleep(2); unlink(tempfile); rc = -1; break; @@ -1383,7 +1370,6 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, if (mutt_str_strncmp("423", buf, 3) != 0) { mutt_error("HEAD: %s", buf); - mutt_sleep(2); break; } @@ -1438,7 +1424,6 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, if (rc > 0) { mutt_error("%s: %s", cmd, buf); - mutt_sleep(2); } } @@ -1473,7 +1458,6 @@ static int nntp_open_mailbox(struct Context *ctx) { url_free(&url); mutt_error(_("%s is an invalid newsgroup specification!"), ctx->path); - mutt_sleep(2); return -1; } @@ -1492,7 +1476,6 @@ static int nntp_open_mailbox(struct Context *ctx) { nntp_newsrc_close(nserv); mutt_error(_("Newsgroup %s not found on the server."), group); - mutt_sleep(2); return -1; } @@ -1525,7 +1508,6 @@ static int nntp_open_mailbox(struct Context *ctx) nntp_delete_group_cache(nntp_data); nntp_newsrc_update(nserv); } - mutt_sleep(2); } /* parse newsgroup info */ @@ -1535,7 +1517,6 @@ static int nntp_open_mailbox(struct Context *ctx) { nntp_newsrc_close(nserv); mutt_error("GROUP: %s", buf); - mutt_sleep(2); return -1; } nntp_data->first_message = first; @@ -2221,7 +2202,6 @@ int nntp_active_fetch(struct NntpServer *nserv, bool new) if (rc > 0) { mutt_error("LIST: %s", buf); - mutt_sleep(2); } return -1; } @@ -2324,7 +2304,6 @@ int nntp_check_new_groups(struct NntpServer *nserv) if (rc > 0) { mutt_error("NEWGROUPS: %s", buf); - mutt_sleep(2); } return -1; } diff --git a/pop.c b/pop.c index 473d0ba7a..b59a96d0c 100644 --- a/pop.c +++ b/pop.c @@ -315,7 +315,6 @@ static int pop_fetch_headers(struct Context *ctx) if (deleted > 0) { mutt_error(_("%d messages have been lost. Try reopening the mailbox."), deleted); - mutt_sleep(2); } bool hcached = false; @@ -433,7 +432,6 @@ static int pop_open_mailbox(struct Context *ctx) if (pop_parse_path(ctx->path, &acct)) { mutt_error(_("%s is an invalid POP path"), ctx->path); - mutt_sleep(2); return -1; } @@ -574,7 +572,6 @@ static int pop_fetch_message(struct Context *ctx, struct Message *msg, int msgno return 0; mutt_perror(cache->path); - mutt_sleep(2); return -1; } else @@ -595,7 +592,6 @@ static int pop_fetch_message(struct Context *ctx, struct Message *msg, int msgno { mutt_error( _("The message index is incorrect. Try reopening the mailbox.")); - mutt_sleep(2); return -1; } @@ -613,7 +609,6 @@ static int pop_fetch_message(struct Context *ctx, struct Message *msg, int msgno if (!msg->fp) { mutt_perror(path); - mutt_sleep(2); return -1; } } @@ -635,14 +630,12 @@ static int pop_fetch_message(struct Context *ctx, struct Message *msg, int msgno if (ret == -2) { mutt_error("%s", pop_data->err_msg); - mutt_sleep(2); return -1; } if (ret == -3) { mutt_error(_("Can't write message to temporary file!")); - mutt_sleep(2); return -1; } } @@ -771,7 +764,6 @@ static int pop_sync_mailbox(struct Context *ctx, int *index_hint) if (ret == -2) { mutt_error("%s", pop_data->err_msg); - mutt_sleep(2); return -1; } } diff --git a/pop_auth.c b/pop_auth.c index bc1e00400..c7b7a9049 100644 --- a/pop_auth.c +++ b/pop_auth.c @@ -186,7 +186,6 @@ bail: FREE(&buf); mutt_error(_("SASL authentication failed.")); - mutt_sleep(2); return POP_A_FAILURE; } @@ -224,7 +223,6 @@ static enum PopAuthRes pop_auth_apop(struct PopData *pop_data, const char *metho if (!mutt_addr_valid_msgid(pop_data->timestamp)) { mutt_error(_("POP timestamp is invalid!")); - mutt_sleep(2); return POP_A_UNAVAIL; } @@ -249,7 +247,6 @@ static enum PopAuthRes pop_auth_apop(struct PopData *pop_data, const char *metho } mutt_error(_("APOP authentication failed.")); - mutt_sleep(2); return POP_A_FAILURE; } @@ -306,7 +303,6 @@ static enum PopAuthRes pop_auth_user(struct PopData *pop_data, const char *metho } mutt_error("%s %s", _("Login failed."), pop_data->err_msg); - mutt_sleep(2); return POP_A_FAILURE; } diff --git a/pop_lib.c b/pop_lib.c index 75997fbe3..fb881cb48 100644 --- a/pop_lib.c +++ b/pop_lib.c @@ -71,7 +71,6 @@ int pop_parse_path(const char *path, struct Account *acct) url_free(&url); FREE(&c); mutt_error(_("Invalid POP URL: %s\n"), path); - mutt_sleep(1); return -1; } @@ -343,12 +342,10 @@ int pop_open_connection(struct PopData *pop_data) if (rc != 0) { mutt_error("%s", pop_data->err_msg); - mutt_sleep(2); } else if (mutt_ssl_starttls(pop_data->conn)) { mutt_error(_("Could not negotiate TLS connection")); - mutt_sleep(2); return -2; } else @@ -369,7 +366,6 @@ int pop_open_connection(struct PopData *pop_data) if (SslForceTls && !pop_data->conn->ssf) { mutt_error(_("Encrypted connection unavailable")); - mutt_sleep(1); return -2; } #endif @@ -400,7 +396,6 @@ int pop_open_connection(struct PopData *pop_data) if (rc == -2) { mutt_error("%s", pop_data->err_msg); - mutt_sleep(2); return rc; } @@ -411,7 +406,6 @@ int pop_open_connection(struct PopData *pop_data) err_conn: pop_data->status = POP_DISCONNECTED; mutt_error(_("Server closed connection!")); - mutt_sleep(2); return -1; } @@ -628,7 +622,6 @@ int pop_reconnect(struct Context *ctx) if (ret == -2) { mutt_error("%s", pop_data->err_msg); - mutt_sleep(2); } } if (ret == 0) diff --git a/recvcmd.c b/recvcmd.c index 768f7f1d2..ae6f78e4a 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -139,7 +139,6 @@ void mutt_attach_bounce(FILE *fp, struct AttachCtx *actx, struct Body *cur) if (!cur->hdr->env->from) { mutt_error(_("Warning: message contains no From: header")); - mutt_sleep(2); mutt_clear_error(); } } @@ -152,7 +151,6 @@ void mutt_attach_bounce(FILE *fp, struct AttachCtx *actx, struct Body *cur) if (!actx->idx[i]->content->hdr->env->from) { mutt_error(_("Warning: message contains no From: header")); - mutt_sleep(2); mutt_clear_error(); break; } diff --git a/safe_asprintf.c b/safe_asprintf.c index 756ade6bb..c8ea5fca3 100644 --- a/safe_asprintf.c +++ b/safe_asprintf.c @@ -49,7 +49,6 @@ int safe_asprintf(char **strp, const char *fmt, ...) if (n < 0) { mutt_error(_("Out of memory!")); - sleep(1); mutt_exit(1); } diff --git a/send.c b/send.c index d23ff925f..4832ff55f 100644 --- a/send.c +++ b/send.c @@ -204,8 +204,6 @@ static int edit_address(struct Address **a, /* const */ char *field) if (idna_ok != 0) { mutt_error(_("Error: '%s' is a bad IDN."), err); - mutt_refresh(); - mutt_sleep(2); FREE(&err); } } while (idna_ok != 0); @@ -1774,7 +1772,6 @@ int ci_send_message(int flags, struct Header *msg, char *tempfile, { mutt_error(_( "No crypto backend configured. Disabling message security setting.")); - mutt_sleep(1); msg->security = 0; } diff --git a/smtp.c b/smtp.c index 1d7c70b4f..7f8b05a59 100644 --- a/smtp.c +++ b/smtp.c @@ -138,7 +138,6 @@ static int smtp_get_resp(struct Connection *conn) return 0; mutt_error(_("SMTP session failed: %s"), buf); - mutt_sleep(0); return -1; } @@ -292,7 +291,6 @@ static int smtp_fill_account(struct Account *account) url_free(&url); FREE(&urlstr); mutt_error(_("Invalid SMTP URL: %s"), SmtpUrl); - mutt_sleep(1); return -1; } url_free(&url); @@ -484,7 +482,6 @@ static int smtp_auth(struct Connection *conn) if (r == SMTP_AUTH_FAIL && delim) { mutt_error(_("%s authentication failed, trying next method"), method); - mutt_sleep(1); } else if (r != SMTP_AUTH_UNAVAIL) break; @@ -501,12 +498,10 @@ static int smtp_auth(struct Connection *conn) if (r == SMTP_AUTH_FAIL) { mutt_error(_("SASL authentication failed")); - mutt_sleep(1); } else if (r == SMTP_AUTH_UNAVAIL) { mutt_error(_("No authenticators available")); - mutt_sleep(1); } return r == SMTP_AUTH_SUCCESS ? 0 : -1; @@ -565,7 +560,6 @@ static int smtp_auth_plain(struct Connection *conn) error: mutt_error(error); - mutt_sleep(1); return -1; } #endif /* USE_SASL */ @@ -607,7 +601,6 @@ static int smtp_open(struct Connection *conn) if (mutt_ssl_starttls(conn)) { mutt_error(_("Could not negotiate TLS connection")); - mutt_sleep(1); return -1; } @@ -623,7 +616,6 @@ static int smtp_open(struct Connection *conn) if (!mutt_bit_isset(Capabilities, AUTH)) { mutt_error(_("SMTP server does not support authentication")); - mutt_sleep(1); return -1; } diff --git a/sort.c b/sort.c index 12c782b4c..753fcdc65 100644 --- a/sort.c +++ b/sort.c @@ -362,7 +362,6 @@ void mutt_sort_headers(struct Context *ctx, int init) (AuxSort = mutt_get_sort_func(SortAux)) == NULL) { mutt_error(_("Could not find sorting function! [report this bug]")); - mutt_sleep(1); return; } else