]> granicus.if.org Git - mutt/commitdiff
Allow nested setting of OPTIGNOREMACROEVENTS.
authorKevin McCarthy <kevin@8t8.us>
Thu, 8 Aug 2019 01:24:15 +0000 (18:24 -0700)
committerKevin McCarthy <kevin@8t8.us>
Thu, 8 Aug 2019 01:24:15 +0000 (18:24 -0700)
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.

curs_lib.c
mutt_ssl.c
mutt_ssl_gnutls.c

index 62792d4f4d83686e38bd03fa3425fedb14946de6..6db52a81b43919e41de646046cae5276d7156e86 100644 (file)
@@ -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);
 }
index 377636e9fb551a10a9ed121be99dce0ceee08c3d..3d83d1ea190d4ce43d7c707f4af756adccc4657b 100644 (file)
@@ -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);
index 8072d1f2ce11e7eae6587dcad53db0016588effd..72d9e0a39e5b3fd50829b0505f0a35738ead580f 100644 (file)
@@ -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);