From: Kevin McCarthy Date: Thu, 8 Aug 2019 01:24:15 +0000 (-0700) Subject: Allow nested setting of OPTIGNOREMACROEVENTS. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41d9d9cfe57c56a2425f7bd83e05a22f429e87c7;p=mutt Allow nested setting of OPTIGNOREMACROEVENTS. This will be needed for the first-run of autocrypt initialization. The initialization involves a number of prompts, and can even use the folder browser. The browser could in turn connect to IMAP which might invoke a certificate prompt, login prompt, etc. --- diff --git a/curs_lib.c b/curs_lib.c index 62792d4f..6db52a81 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -242,11 +242,16 @@ int _mutt_get_field (const char *field, char *buf, size_t buflen, int complete, int mutt_get_field_unbuffered (char *msg, char *buf, size_t buflen, int flags) { - int rc; + int rc, reset_ignoremacro = 0; - set_option (OPTIGNOREMACROEVENTS); + if (!option (OPTIGNOREMACROEVENTS)) + { + set_option (OPTIGNOREMACROEVENTS); + reset_ignoremacro = 1; + } rc = mutt_get_field (msg, buf, buflen, flags); - unset_option (OPTIGNOREMACROEVENTS); + if (reset_ignoremacro) + unset_option (OPTIGNOREMACROEVENTS); return (rc); } diff --git a/mutt_ssl.c b/mutt_ssl.c index 377636e9..3d83d1ea 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -1194,7 +1194,7 @@ static int interactive_check_cert (X509 *cert, int idx, int len, SSL *ssl, int a BUFFER *drow = NULL; unsigned u; FILE *fp; - int allow_skip = 0; + int allow_skip = 0, reset_ignoremacro = 0; mutt_push_current_menu (menu); @@ -1292,7 +1292,12 @@ static int interactive_check_cert (X509 *cert, int idx, int len, SSL *ssl, int a menu->help = helpstr; done = 0; - set_option(OPTIGNOREMACROEVENTS); + + if (!option (OPTIGNOREMACROEVENTS)) + { + set_option (OPTIGNOREMACROEVENTS); + reset_ignoremacro = 1; + } while (!done) { switch (mutt_menuLoop (menu)) @@ -1336,7 +1341,8 @@ static int interactive_check_cert (X509 *cert, int idx, int len, SSL *ssl, int a break; } } - unset_option(OPTIGNOREMACROEVENTS); + if (reset_ignoremacro) + unset_option (OPTIGNOREMACROEVENTS); mutt_buffer_pool_release (&drow); mutt_pop_current_menu (menu); diff --git a/mutt_ssl_gnutls.c b/mutt_ssl_gnutls.c index 8072d1f2..72d9e0a3 100644 --- a/mutt_ssl_gnutls.c +++ b/mutt_ssl_gnutls.c @@ -820,7 +820,7 @@ static int tls_check_one_certificate (const gnutls_datum_t *certdata, BUFFER *drow = NULL; FILE *fp; gnutls_datum_t pemdata; - int done, ret; + int done, ret, reset_ignoremacro = 0; if (!tls_check_preauth (certdata, certstat, hostname, idx, &certerr, &savedcert)) @@ -1015,7 +1015,11 @@ static int tls_check_one_certificate (const gnutls_datum_t *certdata, menu->help = helpstr; done = 0; - set_option (OPTIGNOREMACROEVENTS); + if (!option (OPTIGNOREMACROEVENTS)) + { + set_option (OPTIGNOREMACROEVENTS); + reset_ignoremacro = 1; + } while (!done) { switch (mutt_menuLoop (menu)) @@ -1070,7 +1074,8 @@ static int tls_check_one_certificate (const gnutls_datum_t *certdata, break; } } - unset_option (OPTIGNOREMACROEVENTS); + if (reset_ignoremacro) + unset_option (OPTIGNOREMACROEVENTS); mutt_buffer_pool_release (&drow); mutt_pop_current_menu (menu);