changeset: 7102:02c6dd3a30cc user: Kevin McCarthy <ke...@8t8.us> date: Wed Jul 12 12:38:22 2017 -0700 link: http://dev.mutt.org/hg/mutt/rev/02c6dd3a30cc
Fix crash when $postponed is on another server. imap_mxcmp() translates NULL to "INBOX". When $postponed points to a URL with an empty or "INBOX" path, this will end up matching against a NULL idata->mailbox in imap_status(). This resulted in a crash because idata->ctx is also NULL. Thanks to Olaf Hering for the detailed bug report and suggested fix. changeset: 7103:51d22025190a user: Kevin McCarthy <ke...@8t8.us> date: Wed Jul 12 12:39:28 2017 -0700 link: http://dev.mutt.org/hg/mutt/rev/51d22025190a merge stable diffs (truncated from 118026 to 950 lines): diff -r 826efa89631f -r 51d22025190a addrbook.c --- a/addrbook.c Mon Jun 26 15:44:35 2017 -0700 +++ b/addrbook.c Wed Jul 12 12:39:28 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 826efa89631f -r 51d22025190a browser.c --- a/browser.c Mon Jun 26 15:44:35 2017 -0700 +++ b/browser.c Wed Jul 12 12:39:28 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 826efa89631f -r 51d22025190a buffy.c --- a/buffy.c Mon Jun 26 15:44:35 2017 -0700 +++ b/buffy.c Wed Jul 12 12:39:28 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 826efa89631f -r 51d22025190a color.c --- a/color.c Mon Jun 26 15:44:35 2017 -0700 +++ b/color.c Wed Jul 12 12:39:28 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 826efa89631f -r 51d22025190a commands.c --- a/commands.c Mon Jun 26 15:44:35 2017 -0700 +++ b/commands.c Wed Jul 12 12:39:28 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 826efa89631f -r 51d22025190a compose.c --- a/compose.c Mon Jun 26 15:44:35 2017 -0700 +++ b/compose.c Wed Jul 12 12:39:28 2017 -0700 @@ -70,33 +70,104 @@ HDR_ATTACH = (HDR_FCC + 5) /* where to start printing the attachments */ }; -#define HDR_XOFFSET 10 -#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */ -#define W (MuttIndexWindow->cols - HDR_XOFFSET) +int HeaderPadding[HDR_CRYPTINFO + 1] = {0}; +int MaxHeaderWidth = 0; + +#define HDR_XOFFSET MaxHeaderWidth +#define W (MuttIndexWindow->cols - MaxHeaderWidth) static const char * const Prompts[] = { - "From: ", - "To: ", - "Cc: ", - "Bcc: ", - "Subject: ", - "Reply-To: ", - "Fcc: " + /* L10N: Compose menu field. May not want to translate. */ + N_("From: "), + /* L10N: Compose menu field. May not want to translate. */ + N_("To: "), + /* L10N: Compose menu field. May not want to translate. */ + N_("Cc: "), + /* L10N: Compose menu field. May not want to translate. */ + N_("Bcc: "), + /* L10N: Compose menu field. May not want to translate. */ + N_("Subject: "), + /* L10N: Compose menu field. May not want to translate. */ + N_("Reply-To: "), + /* L10N: Compose menu field. May not want to translate. */ + N_("Fcc: "), +#ifdef MIXMASTER + /* L10N: "Mix" refers to the MixMaster chain for anonymous email */ + N_("Mix: "), +#endif + /* L10N: Compose menu field. Holds "Encrypt", "Sign" related information */ + N_("Security: "), + /* L10N: + * This string is used by the compose menu. + * Since it is hidden by default, it does not increase the + * indentation of other compose menu fields. However, if possible, + * it should not be longer than the other compose menu fields. + * + * Since it shares the row with "Encrypt with:", it should not be longer + * than 15-20 character cells. + */ + N_("Sign as: ") }; static const struct mapping_t ComposeHelp[] = { { N_("Send"), OP_COMPOSE_SEND_MESSAGE }, { N_("Abort"), OP_EXIT }, - { "To", OP_COMPOSE_EDIT_TO }, - { "CC", OP_COMPOSE_EDIT_CC }, - { "Subj", OP_COMPOSE_EDIT_SUBJECT }, + /* L10N: compose menu help line entry */ + { N_("To"), OP_COMPOSE_EDIT_TO }, + /* L10N: compose menu help line entry */ + { N_("CC"), OP_COMPOSE_EDIT_CC }, + /* L10N: compose menu help line entry */ + { N_("Subj"), OP_COMPOSE_EDIT_SUBJECT }, { N_("Attach file"), OP_COMPOSE_ATTACH_FILE }, { N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION }, { N_("Help"), OP_HELP }, { NULL, 0 } }; +static void calc_header_width_padding (int idx, const char *header, int calc_max) +{ + int width; + + HeaderPadding[idx] = mutt_strlen (header); + width = mutt_strwidth (header); + if (calc_max && MaxHeaderWidth < width) + MaxHeaderWidth = width; + HeaderPadding[idx] -= width; +} + + +/* The padding needed for each header is strlen() + max_width - strwidth(). + * + * calc_header_width_padding sets each entry in HeaderPadding to + * strlen - width. Then, afterwards, we go through and add max_width + * to each entry. + */ +static void init_header_padding (void) +{ + static short done = 0; + int i; + + if (done) + return; + done = 1; + + for (i = 0; i <= HDR_CRYPT; i++) + calc_header_width_padding (i, _(Prompts[i]), 1); + + /* Don't include "Sign as: " in the MaxHeaderWidth calculation. It + * doesn't show up by default, and so can make the indentation of + * the other fields look funny. */ + calc_header_width_padding (HDR_CRYPTINFO, _(Prompts[HDR_CRYPTINFO]), 0); + + for (i = 0; i <= HDR_CRYPTINFO; i++) + { + HeaderPadding[i] += MaxHeaderWidth; + if (HeaderPadding[i] < 0) + HeaderPadding[i] = 0; + } +} + static void snd_entry (char *b, size_t blen, MUTTMENU *menu, int num) { mutt_FormatString (b, blen, 0, MuttIndexWindow->cols, NONULL (AttachFormat), mutt_attach_fmt, @@ -110,7 +181,10 @@ static void redraw_crypt_lines (HEADER *msg) { - mutt_window_mvprintw (MuttIndexWindow, HDR_CRYPT, 0, TITLE_FMT, "Security: "); + SETCOLOR (MT_COLOR_COMPOSE_HEADER); + mutt_window_mvprintw (MuttIndexWindow, HDR_CRYPT, 0, + "%*s", HeaderPadding[HDR_CRYPT], _(Prompts[HDR_CRYPT])); + NORMAL_COLOR; if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0) { @@ -119,13 +193,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 +237,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 ("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO])); + 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 ("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO])); + 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 +274,10 @@ int c; char *t; - /* L10N: "Mix" refers to the MixMaster chain for anonymous email */ - mutt_window_mvprintw (MuttIndexWindow, HDR_MIX, 0, TITLE_FMT, _("Mix: ")); + SETCOLOR (MT_COLOR_COMPOSE_HEADER); + mutt_window_mvprintw (MuttIndexWindow, HDR_MIX, 0, + "%*s", HeaderPadding[HDR_MIX], _(Prompts[HDR_MIX])); + NORMAL_COLOR; if (!chain) { @@ -243,7 +344,10 @@ buf[0] = 0; rfc822_write_address (buf, sizeof (buf), addr, 1); - mutt_window_mvprintw (MuttIndexWindow, line, 0, TITLE_FMT, Prompts[line]); + SETCOLOR (MT_COLOR_COMPOSE_HEADER); + mutt_window_mvprintw (MuttIndexWindow, line, 0, + "%*s", HeaderPadding[line], _(Prompts[line])); + NORMAL_COLOR; mutt_paddstr (W, buf); } @@ -253,10 +357,19 @@ draw_envelope_addr (HDR_TO, msg->env->to); draw_envelope_addr (HDR_CC, msg->env->cc); draw_envelope_addr (HDR_BCC, msg->env->bcc); - mutt_window_mvprintw (MuttIndexWindow, HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT]); + + SETCOLOR (MT_COLOR_COMPOSE_HEADER); + mutt_window_mvprintw (MuttIndexWindow, HDR_SUBJECT, 0, + "%*s", HeaderPadding[HDR_SUBJECT], _(Prompts[HDR_SUBJECT])); + NORMAL_COLOR; mutt_paddstr (W, NONULL (msg->env->subject)); + draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to); - mutt_window_mvprintw (MuttIndexWindow, HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC]); + + SETCOLOR (MT_COLOR_COMPOSE_HEADER); + mutt_window_mvprintw (MuttIndexWindow, HDR_FCC, 0, + "%*s", HeaderPadding[HDR_FCC], _(Prompts[HDR_FCC])); + NORMAL_COLOR; mutt_paddstr (W, fcc); if (WithCrypto) @@ -273,26 +386,20 @@ 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; mutt_addrlist_to_local (*addr); rfc822_write_address (buf, sizeof (buf), *addr, 0); - if (mutt_get_field (Prompts[line], buf, sizeof (buf), MUTT_ALIAS) == 0) + if (mutt_get_field (_(Prompts[line]), buf, sizeof (buf), MUTT_ALIAS) == 0) { rfc822_free_address (addr); *addr = mutt_parse_adrlist (*addr, buf); *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 +412,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 +581,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 +658,12 @@ /* Sort, SortAux could be changed in mutt_index_menu() */ int oldSort, oldSortAux; struct stat st; + compose_redraw_data_t rd; + + init_header_padding (); + + 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 +675,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 +697,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 +706,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); @@ -562,7 +719,7 @@ strfcpy (buf, msg->env->subject, sizeof (buf)); else buf[0] = 0; - if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) + if (mutt_get_field (_("Subject: "), buf, sizeof (buf), 0) == 0) { mutt_str_replace (&msg->env->subject, buf); mutt_window_move (MuttIndexWindow, HDR_SUBJECT, HDR_XOFFSET); @@ -574,12 +731,12 @@ 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: strfcpy (buf, fcc, sizeof (buf)); - if (mutt_get_field ("Fcc: ", buf, sizeof (buf), MUTT_FILE | MUTT_CLEAR) == 0) + if (mutt_get_field (_("Fcc: "), buf, sizeof (buf), MUTT_FILE | MUTT_CLEAR) == 0) { strfcpy (fcc, buf, fcclen); mutt_pretty_mailbox (fcc, fcclen); @@ -587,7 +744,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 +822,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 +837,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 +889,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 +1314,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 +1399,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 +1437,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 +1470,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 +1479,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 826efa89631f -r 51d22025190a configure.ac --- a/configure.ac Mon Jun 26 15:44:35 2017 -0700 +++ b/configure.ac Wed Jul 12 12:39:28 2017 -0700 @@ -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 826efa89631f -r 51d22025190a crypt-gpgme.c --- a/crypt-gpgme.c Mon Jun 26 15:44:35 2017 -0700 +++ b/crypt-gpgme.c Wed Jul 12 12:39:28 2017 -0700 @@ -3365,6 +3365,40 @@ return ret; } +enum +{ + KIP_NAME = 0, + KIP_AKA, + KIP_VALID_FROM, + KIP_VALID_TO,