changeset: 7061:fa0c2155ab8f
user:      Kevin McCarthy <ke...@8t8.us>
date:      Tue May 23 15:53:30 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/fa0c2155ab8f

Fix memory leak when closing mailbox and using the sidebar.

The code updating the sidebar counts decremented the msgcount, but did
not set it back to the original value.  Which means fastclose was not
freeing all the headers.

Update the sidebar only when something is deleted, since I don't
believe it's required otherwise and the code is a bit cleaner that
way.

changeset: 7062:8904261ed212
user:      Kevin McCarthy <ke...@8t8.us>
date:      Tue May 23 15:54:46 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/8904261ed212

merge stable

diffs (truncated from 7039 to 950 lines):

diff -r 59a2125b49f2 -r 8904261ed212 addrbook.c
--- a/addrbook.c        Mon May 22 18:18:29 2017 -0700
+++ b/addrbook.c        Tue May 23 15:54:46 2017 -0700
@@ -145,15 +145,13 @@
     mutt_error _("You have no aliases!");
     return;
   }
-  
-  /* tell whoever called me to redraw the screen when I return */
-  set_option (OPTNEEDREDRAW);
-  
+
   menu = mutt_new_menu (MENU_ALIAS);
   menu->make_entry = alias_entry;
   menu->tag = alias_tag;
   menu->title = _("Aliases");
   menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_ALIAS, 
AliasHelp);
+  mutt_push_current_menu (menu);
 
 new_aliases:
 
@@ -237,6 +235,7 @@
     rfc822_write_address (buf, buflen, AliasTable[t]->addr, 1);
   }
 
+  mutt_pop_current_menu (menu);
   mutt_menuDestroy (&menu);
   FREE (&AliasTable);
   
diff -r 59a2125b49f2 -r 8904261ed212 browser.c
--- a/browser.c Mon May 22 18:18:29 2017 -0700
+++ b/browser.c Tue May 23 15:54:46 2017 -0700
@@ -492,17 +492,20 @@
       tmp->msg_unread = Context->unread;
     }
 
+    strfcpy (buffer, NONULL (tmp->path), sizeof (buffer));
+    mutt_pretty_mailbox (buffer, sizeof (buffer));
+
 #ifdef USE_IMAP
     if (mx_is_imap (tmp->path))
     {
-      add_folder (menu, state, tmp->path, NULL, tmp);
+      add_folder (menu, state, buffer, NULL, tmp);
       continue;
     }
 #endif
 #ifdef USE_POP
     if (mx_is_pop (tmp->path))
     {
-      add_folder (menu, state, tmp->path, NULL, tmp);
+      add_folder (menu, state, buffer, NULL, tmp);
       continue;
     }
 #endif
@@ -528,9 +531,6 @@
        s.st_mtime = st2.st_mtime;
     }
 
-    strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
-    mutt_pretty_mailbox (buffer, sizeof (buffer));
-
     add_folder (menu, state, buffer, &s, tmp);
   }
   while ((tmp = tmp->next));
@@ -611,7 +611,7 @@
   char helpstr[LONG_STRING];
   char title[STRING];
   struct browser_state state;
-  MUTTMENU *menu;
+  MUTTMENU *menu = NULL;
   struct stat st;
   int i, killPrefix = 0;
   int multiple = (flags & MUTT_SEL_MULTI)  ? 1 : 0;
@@ -722,6 +722,7 @@
 
   menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER,
     FolderHelp);
+  mutt_push_current_menu (menu);
 
   init_menu (&state, menu, title, sizeof (title), buffy);
 
@@ -908,7 +909,6 @@
        }
 
        destroy_state (&state);
-       mutt_menuDestroy (&menu);
        goto bail;
 
       case OP_BROWSER_TELL:
@@ -954,7 +954,6 @@
          menu->current = 0; 
          menu->top = 0; 
          init_menu (&state, menu, title, sizeof (title), buffy);
-         MAYBE_REDRAW (menu->redraw);
        }
        /* else leave error on screen */
        break;
@@ -977,7 +976,6 @@
            menu->current = 0;
            menu->top = 0;
            init_menu (&state, menu, title, sizeof (title), buffy);
-           MAYBE_REDRAW (menu->redraw);
          }
        }
        break;
@@ -1015,7 +1013,6 @@
              state.entrylen--;
              mutt_message _("Mailbox deleted.");
              init_menu (&state, menu, title, sizeof (title), buffy);
-             MAYBE_REDRAW (menu->redraw);
            }
          }
          else
@@ -1080,7 +1077,6 @@
                  mutt_error _("Error scanning directory.");
                  if (examine_directory (menu, &state, LastDir, prefix) == -1)
                  {
-                   mutt_menuDestroy (&menu);
                    goto bail;
                  }
                }
@@ -1095,7 +1091,6 @@
              mutt_perror (buf);
          }
        }
-       MAYBE_REDRAW (menu->redraw);
        break;
        
       case OP_ENTER_MASK:
@@ -1151,7 +1146,6 @@
            else
            {
              mutt_error _("Error scanning directory.");
-             mutt_menuDestroy (&menu);
              goto bail;
            }
            killPrefix = 0;
@@ -1162,7 +1156,6 @@
            }
          }
        }
-       MAYBE_REDRAW (menu->redraw);
        break;
 
       case OP_SORT:
@@ -1246,10 +1239,8 @@
        {
          strfcpy (f, buf, flen);
          destroy_state (&state);
-         mutt_menuDestroy (&menu);
          goto bail;
        }
-       MAYBE_REDRAW (menu->redraw);
        break;
 
       case OP_BROWSER_VIEW_FILE:
@@ -1264,7 +1255,6 @@
        {
          strfcpy (f, state.entry[menu->current].name, flen);
          destroy_state (&state);
-         mutt_menuDestroy (&menu);
          goto bail;
        }
        else
@@ -1296,7 +1286,13 @@
   }
   
   bail:
-  
+
+  if (menu)
+  {
+    mutt_pop_current_menu (menu);
+    mutt_menuDestroy (&menu);
+  }
+
   if (!folder)
     strfcpy (LastDir, LastDirBackup, sizeof (LastDir));
   
diff -r 59a2125b49f2 -r 8904261ed212 buffy.c
--- a/buffy.c   Mon May 22 18:18:29 2017 -0700
+++ b/buffy.c   Tue May 23 15:54:46 2017 -0700
@@ -27,6 +27,7 @@
 #include "mx.h"
 
 #include "mutt_curses.h"
+#include "mutt_menu.h"
 
 #ifdef USE_SIDEBAR
 #include "sidebar.h"
@@ -580,7 +581,7 @@
         (orig_count != tmp->msg_count) ||
         (orig_unread != tmp->msg_unread) ||
         (orig_flagged != tmp->msg_flagged))
-      SidebarNeedsRedraw = 1;
+      mutt_set_current_menu_redraw (REDRAW_SIDEBAR);
 #endif
 
     if (!tmp->new)
diff -r 59a2125b49f2 -r 8904261ed212 color.c
--- a/color.c   Mon May 22 18:18:29 2017 -0700
+++ b/color.c   Tue May 23 15:54:46 2017 -0700
@@ -22,6 +22,7 @@
 
 #include "mutt.h"
 #include "mutt_curses.h"
+#include "mutt_menu.h"
 #include "mapping.h"
 
 #include <string.h>
@@ -105,6 +106,16 @@
   { NULL,              0 }
 };
 
+static const struct mapping_t ComposeFields[] =
+{
+  { "header",               MT_COLOR_COMPOSE_HEADER },
+  { "security_encrypt",     MT_COLOR_COMPOSE_SECURITY_ENCRYPT },
+  { "security_sign",        MT_COLOR_COMPOSE_SECURITY_SIGN },
+  { "security_both",        MT_COLOR_COMPOSE_SECURITY_BOTH },
+  { "security_none",        MT_COLOR_COMPOSE_SECURITY_NONE },
+  { NULL,                   0 }
+};
+
 #define COLOR_QUOTE_INIT       8
 
 static COLOR_LINE *mutt_new_color_line (void)
@@ -494,7 +505,7 @@
   if (do_cache && !option (OPTNOCURSES))
   {
     int i;
-    set_option (OPTFORCEREDRAWINDEX);
+    mutt_set_menu_redraw_full (MENU_MAIN);
     /* force re-caching of index colors */
     for (i = 0; Context && i < Context->msgcount; i++)
       Context->hdrs[i]->pair = 0;
@@ -621,6 +632,22 @@
     
     *o = MT_COLOR_QUOTED;
   }
+  else if (!ascii_strcasecmp(buf->data, "compose"))
+  {
+    if (!MoreArgs(s))
+    {
+      strfcpy(err->data, _("Missing arguments."), err->dsize);
+      return -1;
+    }
+
+    mutt_extract_token(buf, s, 0);
+
+    if ((*o = mutt_getvaluebyname (buf->data, ComposeFields)) == -1)
+    {
+      snprintf (err->data, err->dsize, _("%s: no such object"), buf->data);
+      return (-1);
+    }
+  }
   else if ((*o = mutt_getvaluebyname (buf->data, Fields)) == -1)
   {
     snprintf (err->data, err->dsize, _("%s: no such object"), buf->data);
@@ -771,7 +798,7 @@
   else if (object == MT_COLOR_INDEX)
   {
     r = add_pattern (&ColorIndexList, buf->data, 1, fg, bg, attr, err, 1);
-    set_option (OPTFORCEREDRAWINDEX);
+    mutt_set_menu_redraw_full (MENU_MAIN);
   }
   else if (object == MT_COLOR_QUOTED)
   {
diff -r 59a2125b49f2 -r 8904261ed212 commands.c
--- a/commands.c        Mon May 22 18:18:29 2017 -0700
+++ b/commands.c        Tue May 23 15:54:46 2017 -0700
@@ -238,7 +238,7 @@
   return rc;
 }
 
-void ci_bounce_message (HEADER *h, int *redraw)
+void ci_bounce_message (HEADER *h)
 {
   char prompt[SHORT_STRING];
   char scratch[SHORT_STRING];
@@ -276,13 +276,6 @@
     strfcpy(prompt, _("Bounce tagged messages to: "), sizeof(prompt));
   
   rc = mutt_get_field (prompt, buf, sizeof (buf), MUTT_ALIAS);
-
-  if (option (OPTNEEDREDRAW))
-  {
-    unset_option (OPTNEEDREDRAW);
-    *redraw = REDRAW_FULL;
-  }
-
   if (rc || !buf[0])
     return;
 
@@ -413,10 +406,12 @@
       mutt_perror _("Can't create filter process");
       return 1;
     }
-      
+
+    set_option (OPTKEEPQUIET);
     pipe_msg (h, fpout, decode, print);
     safe_fclose (&fpout);
     rc = mutt_wait_filter (thepid);
+    unset_option (OPTKEEPQUIET);
   }
   else
   { /* handle tagged messages */
@@ -447,12 +442,14 @@
            mutt_perror _("Can't create filter process");
            return 1;
          }
+          set_option (OPTKEEPQUIET);
           pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode, print);
           /* add the message separator */
           if (sep)  fputs (sep, fpout);
          safe_fclose (&fpout);
          if (mutt_wait_filter (thepid) != 0)
            rc = 1;
+          unset_option (OPTKEEPQUIET);
         }
       }
     }
@@ -464,6 +461,7 @@
        mutt_perror _("Can't create filter process");
        return 1;
       }
+      set_option (OPTKEEPQUIET);
       for (i = 0; i < Context->vcount; i++)
       {
         if (Context->hdrs[Context->v2r[i]]->tagged)
@@ -477,6 +475,7 @@
       safe_fclose (&fpout);
       if (mutt_wait_filter (thepid) != 0)
        rc = 1;
+      unset_option (OPTKEEPQUIET);
     }
   }
 
@@ -534,12 +533,13 @@
 
   switch (mutt_multi_choice (reverse ?
        /* L10N: The following three are the sort/reverse sort prompts.
-        * Capital letters must match the order of the characters in the third
-        * string.
+        * Letters must match the order of the characters in the third
+        * string.  Note that mutt now supports multiline prompts, so
+        * it's okay for the translation to take up to three lines.
         */
-                            _("Rev-Sort 
Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: ") :
-                            _("Sort 
Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: "),
-                            _("dfrsotuzcpl")))
+       _("Rev-Sort Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: 
") :
+       _("Sort Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: "),
+       _("dfrsotuzcpl")))
   {
   case -1: /* abort - don't resort */
     return -1;
@@ -734,8 +734,7 @@
 }
 
 /* returns 0 if the copy/save was successful, or -1 on error/abort */
-int mutt_save_message (HEADER *h, int delete, 
-                      int decode, int decrypt, int *redraw)
+int mutt_save_message (HEADER *h, int delete, int decode, int decrypt)
 {
   int i, need_buffy_cleanup;
   int need_passphrase = 0, app=0;
@@ -743,9 +742,6 @@
   CONTEXT ctx;
   struct stat st;
 
-  *redraw = 0;
-
-  
   snprintf (prompt, sizeof (prompt),
            decode  ? (delete ? _("Decode-save%s to mailbox") :
                       _("Decode-copy%s to mailbox")) :
@@ -793,17 +789,9 @@
   }
 
   mutt_pretty_mailbox (buf, sizeof (buf));
-  if (mutt_enter_fname (prompt, buf, sizeof (buf), redraw, 0) == -1)
+  if (mutt_enter_fname (prompt, buf, sizeof (buf), 0) == -1)
     return (-1);
 
-  if (*redraw != REDRAW_FULL)
-  {
-    if (!h)
-      *redraw = REDRAW_INDEX | REDRAW_STATUS;
-    else
-      *redraw = REDRAW_STATUS;
-  }
-
   if (!buf[0])
     return (-1);
  
diff -r 59a2125b49f2 -r 8904261ed212 compose.c
--- a/compose.c Mon May 22 18:18:29 2017 -0700
+++ b/compose.c Tue May 23 15:54:46 2017 -0700
@@ -110,7 +110,9 @@
 
 static void redraw_crypt_lines (HEADER *msg)
 {
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw (MuttIndexWindow, HDR_CRYPT, 0, TITLE_FMT, "Security: 
");
+  NORMAL_COLOR;
 
   if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
   {
@@ -119,13 +121,26 @@
   }
 
   if ((msg->security & (ENCRYPT | SIGN)) == (ENCRYPT | SIGN))
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_SECURITY_BOTH);
     addstr (_("Sign, Encrypt"));
+  }
   else if (msg->security & ENCRYPT)
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
     addstr (_("Encrypt"));
+  }
   else if (msg->security & SIGN)
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_SECURITY_SIGN);
     addstr (_("Sign"));
+  }
   else
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_SECURITY_NONE);
     addstr (_("None"));
+  }
+  NORMAL_COLOR;
 
   if ((msg->security & (ENCRYPT | SIGN)))
   {
@@ -150,20 +165,32 @@
 
   if ((WithCrypto & APPLICATION_PGP)
       && (msg->security & APPLICATION_PGP) && (msg->security & SIGN))
-    printw (TITLE_FMT "%s", _("sign as: "), PgpSignAs ? PgpSignAs : 
_("<default>"));
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_HEADER);
+    printw (TITLE_FMT, _("sign as: "));
+    NORMAL_COLOR;
+    printw ("%s", PgpSignAs ? PgpSignAs : _("<default>"));
+  }
 
   if ((WithCrypto & APPLICATION_SMIME)
-      && (msg->security & APPLICATION_SMIME) && (msg->security & SIGN)) {
-      printw (TITLE_FMT "%s", _("sign as: "), SmimeDefaultKey ? 
SmimeDefaultKey : _("<default>"));
+      && (msg->security & APPLICATION_SMIME) && (msg->security & SIGN))
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_HEADER);
+    printw (TITLE_FMT, _("sign as: "));
+    NORMAL_COLOR;
+    printw ("%s", SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
   }
 
   if ((WithCrypto & APPLICATION_SMIME)
       && (msg->security & APPLICATION_SMIME)
       && (msg->security & ENCRYPT)
       && SmimeCryptAlg
-      && *SmimeCryptAlg) {
-    mutt_window_mvprintw (MuttIndexWindow, HDR_CRYPTINFO, 40, "%s%s", 
_("Encrypt with: "),
-               NONULL(SmimeCryptAlg));
+      && *SmimeCryptAlg)
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_HEADER);
+    mutt_window_mvprintw (MuttIndexWindow, HDR_CRYPTINFO, 40, "%s", _("Encrypt 
with: "));
+    NORMAL_COLOR;
+    printw ("%s", NONULL(SmimeCryptAlg));
   }
 }
 
@@ -175,8 +202,10 @@
   int c;
   char *t;
 
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   /* L10N: "Mix" refers to the MixMaster chain for anonymous email */
   mutt_window_mvprintw (MuttIndexWindow, HDR_MIX, 0, TITLE_FMT, _("Mix: "));
+  NORMAL_COLOR;
 
   if (!chain)
   {
@@ -243,7 +272,9 @@
 
   buf[0] = 0;
   rfc822_write_address (buf, sizeof (buf), addr, 1);
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw (MuttIndexWindow, line, 0, TITLE_FMT, Prompts[line]);
+  NORMAL_COLOR;
   mutt_paddstr (W, buf);
 }
 
@@ -253,10 +284,17 @@
   draw_envelope_addr (HDR_TO, msg->env->to);
   draw_envelope_addr (HDR_CC, msg->env->cc);
   draw_envelope_addr (HDR_BCC, msg->env->bcc);
+
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw (MuttIndexWindow, HDR_SUBJECT, 0, TITLE_FMT, 
Prompts[HDR_SUBJECT]);
+  NORMAL_COLOR;
   mutt_paddstr (W, NONULL (msg->env->subject));
+
   draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
+
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw (MuttIndexWindow, HDR_FCC, 0, TITLE_FMT, 
Prompts[HDR_FCC]);
+  NORMAL_COLOR;
   mutt_paddstr (W, fcc);
 
   if (WithCrypto)
@@ -273,7 +311,7 @@
   NORMAL_COLOR;
 }
 
-static int edit_address_list (int line, ADDRESS **addr)
+static void edit_address_list (int line, ADDRESS **addr)
 {
   char buf[HUGE_STRING] = ""; /* needs to be large for alias expansion */
   char *err = NULL;
@@ -287,12 +325,6 @@
     *addr = mutt_expand_aliases (*addr);
   }
 
-  if (option (OPTNEEDREDRAW))
-  {
-    unset_option (OPTNEEDREDRAW);
-    return (REDRAW_FULL);
-  }
-
   if (mutt_addrlist_to_intl (*addr, &err) != 0)
   {
     mutt_error (_("Warning: '%s' is a bad IDN."), err);
@@ -305,8 +337,6 @@
   rfc822_write_address (buf, sizeof (buf), *addr, 1);
   mutt_window_move (MuttIndexWindow, line, HDR_XOFFSET);
   mutt_paddstr (W, buf);
-  
-  return 0;
 }
 
 static int delete_attachment (MUTTMENU *menu, short *idxlen, int x)
@@ -476,6 +506,54 @@
         (unsigned long) menu, 0);
 }
 
+typedef struct
+{
+  HEADER *msg;
+  char *fcc;
+} compose_redraw_data_t;
+
+static void compose_menu_redraw (MUTTMENU *menu)
+{
+  char buf[LONG_STRING];
+  compose_redraw_data_t *rd = menu->redraw_data;
+
+  if (!rd)
+    return;
+
+  if (menu->redraw & REDRAW_FULL)
+  {
+    menu_redraw_full (menu);
+
+    draw_envelope (rd->msg, rd->fcc);
+    menu->offset = HDR_ATTACH;
+    menu->pagelen = MuttIndexWindow->rows - HDR_ATTACH;
+  }
+
+  menu_check_recenter (menu);
+
+  if (menu->redraw & REDRAW_STATUS)
+  {
+    compose_status_line (buf, sizeof (buf), 0, MuttStatusWindow->cols, menu, 
NONULL(ComposeFormat));
+    mutt_window_move (MuttStatusWindow, 0, 0);
+    SETCOLOR (MT_COLOR_STATUS);
+    mutt_paddstr (MuttStatusWindow->cols, buf);
+    NORMAL_COLOR;
+    menu->redraw &= ~REDRAW_STATUS;
+  }
+
+#ifdef USE_SIDEBAR
+  if (menu->redraw & REDRAW_SIDEBAR)
+    menu_redraw_sidebar (menu);
+#endif
+
+  if (menu->redraw & REDRAW_INDEX)
+    menu_redraw_index (menu);
+  else if (menu->redraw & (REDRAW_MOTION | REDRAW_MOTION_RESYNCH))
+    menu_redraw_motion (menu);
+  else if (menu->redraw == REDRAW_CURRENT)
+    menu_redraw_current (menu);
+}
+
 
 /* return values:
  *
@@ -505,6 +583,10 @@
   /* Sort, SortAux could be changed in mutt_index_menu() */
   int oldSort, oldSortAux;
   struct stat st;
+  compose_redraw_data_t rd;
+
+  rd.msg = msg;
+  rd.fcc = fcc;
 
   mutt_attach_init (msg->content);
   idx = mutt_gen_attach_list (msg->content, -1, idx, &idxlen, &idxmax, 0, 1);
@@ -516,22 +598,20 @@
   menu->tag = mutt_tag_attach;
   menu->data = idx;
   menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, 
ComposeHelp);
+  menu->custom_menu_redraw = compose_menu_redraw;
+  menu->redraw_data = &rd;
+  mutt_push_current_menu (menu);
 
   while (loop)
   {
     switch (op = mutt_menuLoop (menu))
     {
-      case OP_REDRAW:
-       draw_envelope (msg, fcc);
-       menu->offset = HDR_ATTACH;
-       menu->pagelen = MuttIndexWindow->rows - HDR_ATTACH;
-       break;
       case OP_COMPOSE_EDIT_FROM:
-       menu->redraw = edit_address_list (HDR_FROM, &msg->env->from);
+       edit_address_list (HDR_FROM, &msg->env->from);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
        break;
       case OP_COMPOSE_EDIT_TO:
-       menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
+       edit_address_list (HDR_TO, &msg->env->to);
        if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
        {
          crypt_opportunistic_encrypt (msg);
@@ -540,7 +620,7 @@
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
       case OP_COMPOSE_EDIT_BCC:
-       menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc);
+       edit_address_list (HDR_BCC, &msg->env->bcc);
        if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
        {
          crypt_opportunistic_encrypt (msg);
@@ -549,7 +629,7 @@
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
        break;
       case OP_COMPOSE_EDIT_CC:
-       menu->redraw = edit_address_list (HDR_CC, &msg->env->cc);
+       edit_address_list (HDR_CC, &msg->env->cc);
        if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
        {
          crypt_opportunistic_encrypt (msg);
@@ -574,7 +654,7 @@
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
       case OP_COMPOSE_EDIT_REPLY_TO:
-       menu->redraw = edit_address_list (HDR_REPLYTO, &msg->env->reply_to);
+       edit_address_list (HDR_REPLYTO, &msg->env->reply_to);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
        break;
       case OP_COMPOSE_EDIT_FCC:
@@ -587,7 +667,6 @@
          mutt_paddstr (W, fcc);
          fccSet = 1;
        }
-       MAYBE_REDRAW (menu->redraw);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
       case OP_COMPOSE_EDIT_MESSAGE:
@@ -666,12 +745,6 @@
          FREE (&idx[idxlen]);
 
        menu->redraw |= REDRAW_STATUS;
-
-       if (option(OPTNEEDREDRAW))
-       {
-         menu->redraw = REDRAW_FULL;
-         unset_option(OPTNEEDREDRAW);
-       }
        
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
@@ -687,7 +760,7 @@
          numfiles = 0;
          files = NULL;
 
-         if (_mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 
0, 1, &files, &numfiles) == -1 ||
+         if (_mutt_enter_fname (prompt, fname, sizeof (fname), 0, 1, &files, 
&numfiles) == -1 ||
              *fname == '\0')
            break;
 
@@ -739,7 +812,7 @@
            mutt_pretty_mailbox (fname, sizeof (fname));
          }
 
-         if (mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 
1) == -1 || !fname[0])
+         if (mutt_enter_fname (prompt, fname, sizeof (fname), 1) == -1 || 
!fname[0])
            break;
 
          mutt_expand_path (fname, sizeof (fname));
@@ -1164,7 +1237,6 @@
       case OP_SAVE:
        CHECK_COUNT;
        mutt_save_attachment_list (NULL, menu->tagprefix, menu->tagprefix ?  
msg->content : idx[menu->current]->content, NULL, menu);
-       MAYBE_REDRAW (menu->redraw);
         /* no send2hook, since this doesn't modify the message */
        break;
 
@@ -1250,7 +1322,7 @@
        if (idxlen)
          msg->content = idx[0]->content;
        if (mutt_enter_fname (_("Write message to mailbox"), fname, sizeof 
(fname),
-                             &menu->redraw, 1) != -1 && fname[0])
+                             1) != -1 && fname[0])
        {
          mutt_message (_("Writing message to %s ..."), fname);
          mutt_expand_path (fname, sizeof (fname));
@@ -1288,7 +1360,7 @@
           crypt_opportunistic_encrypt (msg);
           redraw_crypt_lines (msg);
        }
-       msg->security = crypt_pgp_send_menu (msg, &menu->redraw);
+       msg->security = crypt_pgp_send_menu (msg);
        redraw_crypt_lines (msg);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
@@ -1321,7 +1393,7 @@
           crypt_opportunistic_encrypt (msg);
           redraw_crypt_lines (msg);
        }
-       msg->security = crypt_smime_send_menu(msg, &menu->redraw);
+       msg->security = crypt_smime_send_menu(msg);
        redraw_crypt_lines (msg);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
@@ -1330,25 +1402,15 @@
 #ifdef MIXMASTER
       case OP_COMPOSE_MIX:
       
-       mix_make_chain (&msg->chain, &menu->redraw);
+       mix_make_chain (&msg->chain);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
 #endif
 
     }
-
-    /* Draw formatted compose status line */
-    if (menu->redraw & REDRAW_STATUS) 
-    {
-        compose_status_line (buf, sizeof (buf), 0, MuttStatusWindow->cols, 
menu, NONULL(ComposeFormat));
-       mutt_window_move (MuttStatusWindow, 0, 0);
-       SETCOLOR (MT_COLOR_STATUS);
-       mutt_paddstr (MuttStatusWindow->cols, buf);
-       NORMAL_COLOR;
-       menu->redraw &= ~REDRAW_STATUS;
-    }
   }
 
+  mutt_pop_current_menu (menu);
   mutt_menuDestroy (&menu);
 
   if (idxlen)
diff -r 59a2125b49f2 -r 8904261ed212 configure.ac
--- a/configure.ac      Mon May 22 18:18:29 2017 -0700
+++ b/configure.ac      Tue May 23 15:54:46 2017 -0700
@@ -374,7 +374,7 @@
 
 AC_CHECK_FUNCS(fgetpos memmove setegid srand48 strerror)
 
-AC_REPLACE_FUNCS([setenv strcasecmp strdup strsep strtok_r wcscasecmp])
+AC_REPLACE_FUNCS([strcasecmp strdup strsep strtok_r wcscasecmp])
 AC_REPLACE_FUNCS([strcasestr mkdtemp])
 
 AC_CHECK_FUNC(getopt)
@@ -710,6 +710,11 @@
             AC_CHECK_DECLS([SSL_set_mode, SSL_MODE_AUTO_RETRY],,
               AC_MSG_ERROR([Unable to find decent SSL header]), [[#include 
<openssl/ssl.h>]])
 
+            AC_CHECK_DECL([X509_V_FLAG_PARTIAL_CHAIN],
+              AC_DEFINE(HAVE_SSL_PARTIAL_CHAIN,1,[ Define if OpenSSL supports 
partial chains. ]),
+              ,
+              [[#include <openssl/x509_vfy.h>]])
+
             AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ])
             AC_DEFINE(USE_SSL_OPENSSL,1,[ Define if you want support for SSL 
via OpenSSL. ])
             LIBS="$saved_LIBS"
diff -r 59a2125b49f2 -r 8904261ed212 crypt-gpgme.c
--- a/crypt-gpgme.c     Mon May 22 18:18:29 2017 -0700
+++ b/crypt-gpgme.c     Tue May 23 15:54:46 2017 -0700
@@ -4031,6 +4031,7 @@
   menu->make_entry = crypt_entry;
   menu->help = helpstr;
   menu->data = key_table;
+  mutt_push_current_menu (menu);
 
   {
     const char *ts;
@@ -4139,10 +4140,9 @@
         }
     }
   
+  mutt_pop_current_menu (menu);
   mutt_menuDestroy (&menu);
   FREE (&key_table);
-
-  set_option (OPTNEEDREDRAW);
   
   return k;
 }
@@ -4701,7 +4701,7 @@
   init_smime ();
 }
 
-static int gpgme_send_menu (HEADER *msg, int *redraw, int is_smime)
+static int gpgme_send_menu (HEADER *msg, int is_smime)
 {
   crypt_key_t *p;
   char input_signas[SHORT_STRING];
@@ -4806,7 +4806,6 @@
 
         msg->security |= SIGN;
       }
-      *redraw = REDRAW_FULL;
       break;
 
     case 'b': /* (b)oth */
@@ -4853,14 +4852,14 @@
   return (msg->security);
 }
 
-int pgp_gpgme_send_menu (HEADER *msg, int *redraw)
+int pgp_gpgme_send_menu (HEADER *msg)
 {
-  return gpgme_send_menu (msg, redraw, 0);
+  return gpgme_send_menu (msg, 0);
 }
 
-int smime_gpgme_send_menu (HEADER *msg, int *redraw)
+int smime_gpgme_send_menu (HEADER *msg)
 {
-  return gpgme_send_menu (msg, redraw, 1);
+  return gpgme_send_menu (msg, 1);
 }
 
 static int verify_sender (HEADER *h, gpgme_protocol_t protocol)
diff -r 59a2125b49f2 -r 8904261ed212 crypt-gpgme.h
--- a/crypt-gpgme.h     Mon May 22 18:18:29 2017 -0700
+++ b/crypt-gpgme.h     Tue May 23 15:54:46 2017 -0700
@@ -48,8 +48,8 @@
 int pgp_gpgme_verify_one (BODY *sigbdy, STATE *s, const char *tempfile);
 int smime_gpgme_verify_one (BODY *sigbdy, STATE *s, const char *tempfile);
 
-int pgp_gpgme_send_menu (HEADER *msg, int *redraw);
-int smime_gpgme_send_menu (HEADER *msg, int *redraw);
+int pgp_gpgme_send_menu (HEADER *msg);
+int smime_gpgme_send_menu (HEADER *msg);
 
 int smime_gpgme_verify_sender (HEADER *h);
 
diff -r 59a2125b49f2 -r 8904261ed212 crypt-mod-pgp-classic.c
--- a/crypt-mod-pgp-classic.c   Mon May 22 18:18:29 2017 -0700
+++ b/crypt-mod-pgp-classic.c   Tue May 23 15:54:46 2017 -0700
@@ -61,9 +61,9 @@
   return pgp_verify_one (sigbdy, s, tempf);
 }
 
-static int crypt_mod_pgp_send_menu (HEADER *msg, int *redraw)
+static int crypt_mod_pgp_send_menu (HEADER *msg)
 {
-  return pgp_send_menu (msg, redraw);
+  return pgp_send_menu (msg);
 }
 
 static BODY *crypt_mod_pgp_encrypt_message (BODY *a, char *keylist, int sign)
diff -r 59a2125b49f2 -r 8904261ed212 crypt-mod-pgp-gpgme.c
--- a/crypt-mod-pgp-gpgme.c     Mon May 22 18:18:29 2017 -0700
+++ b/crypt-mod-pgp-gpgme.c     Tue May 23 15:54:46 2017 -0700
@@ -85,9 +85,9 @@
   return pgp_gpgme_verify_one (sigbdy, s, tempf);
 }
 
-static int crypt_mod_pgp_send_menu (HEADER *msg, int *redraw)
+static int crypt_mod_pgp_send_menu (HEADER *msg)
 {
-  return pgp_gpgme_send_menu (msg, redraw);
+  return pgp_gpgme_send_menu (msg);
 }
 
 static BODY *crypt_mod_pgp_encrypt_message (BODY *a, char *keylist, int sign)
diff -r 59a2125b49f2 -r 8904261ed212 crypt-mod-smime-classic.c
--- a/crypt-mod-smime-classic.c Mon May 22 18:18:29 2017 -0700
+++ b/crypt-mod-smime-classic.c Tue May 23 15:54:46 2017 -0700
@@ -61,9 +61,9 @@
   return smime_verify_one (sigbdy, s, tempf);
 }
 
-static int crypt_mod_smime_send_menu (HEADER *msg, int *redraw)
+static int crypt_mod_smime_send_menu (HEADER *msg)
 {
-  return smime_send_menu (msg, redraw);
+  return smime_send_menu (msg);
 }
 
 static void crypt_mod_smime_getkeys (ENVELOPE *env)
diff -r 59a2125b49f2 -r 8904261ed212 crypt-mod-smime-gpgme.c
--- a/crypt-mod-smime-gpgme.c   Mon May 22 18:18:29 2017 -0700
+++ b/crypt-mod-smime-gpgme.c   Tue May 23 15:54:46 2017 -0700
@@ -70,9 +70,9 @@
   return smime_gpgme_verify_one (sigbdy, s, tempf);
 }
 
-static int crypt_mod_smime_send_menu (HEADER *msg, int *redraw)
+static int crypt_mod_smime_send_menu (HEADER *msg)
 {
-  return smime_gpgme_send_menu (msg, redraw);
+  return smime_gpgme_send_menu (msg);
 }
 
 static BODY *crypt_mod_smime_build_smime_entity (BODY *a, char *certlist)
diff -r 59a2125b49f2 -r 8904261ed212 crypt-mod.h
--- a/crypt-mod.h       Mon May 22 18:18:29 2017 -0700
+++ b/crypt-mod.h       Tue May 23 15:54:46 2017 -0700
@@ -53,7 +53,7 @@
 typedef void (*crypt_func_pgp_extract_keys_from_attachment_list_t) 
                                            (FILE *fp, int tag, BODY *top);
 
-typedef int (*crypt_func_send_menu_t) (HEADER *msg, int *redraw);
+typedef int (*crypt_func_send_menu_t) (HEADER *msg);
 
  /* (SMIME) */
 typedef void (*crypt_func_smime_getkeys_t) (ENVELOPE *env);
diff -r 59a2125b49f2 -r 8904261ed212 cryptglue.c
--- a/cryptglue.c       Mon May 22 18:18:29 2017 -0700
+++ b/cryptglue.c       Tue May 23 15:54:46 2017 -0700
@@ -246,10 +246,10 @@
 }
 
 
-int crypt_pgp_send_menu (HEADER *msg, int *redraw)
+int crypt_pgp_send_menu (HEADER *msg)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, send_menu))

Reply via email to