Clean up pager change folder aborts to return to pager.

Changing folder from within the pager behaved inconsistently when
aborting, or upon a normal error.  It would sometimes return the pager
and other times return to the index.

Ensure it returns to the pager, except in the case where
mx_close_mailbox() fails due to a new mail or reopen event.  In that
case we likely want to be in the index - the message we were viewing
could have disappeared or relocated.
Remove menu->menu hack when redirecting pager ops through index.

As noted in commit a327386c, this causes problems when redirecting ops
that open new menus.  There is no need to change the menu->menu type,
as a flag works perfectly well with no such side effects.

This also removes the need for comments explaning the hack before
mutt_folder_hooks() when changing folders, or before displaying a
message in the pager.
Merge branch 'stable'
Stable branch quick fix for pager change-mailbox push/exec bug.

The menu functions mutt_push/pop_current_menu() keep track of the menu
stack, automatically setting CurrentMenu when exiting menus.

The only gotcha was the function sharing between the index and pager
menus.  The index uses a hack, setting menu->menu to MENU_PAGER for
operations redirecting through the index and back to the pager
afterwards.

I thought this was covered by the restoration of the menu before
returning to the pager, or when exiting the index switch.  However it
is not: invoking other menus, such as the browser, will result in
CurrentMenu being set to the Pager when exiting those (by
mutt_pop_current_menu()).  This can result in folder hooks failing for
unshared functions.

A better fix is to remove the hack of using menu->menu, because this
can easily cause a problem in the future in other situations.  (I will
make this fix in master next.)  For the stable branch, I am explicitly
setting/restoring CurrentMenu before invoking the folder hooks.
Convert pgp_app_handler to use buffer pool.

Rename the pgp_copy_checksig() and mutt_wait_filter() return code
variables to provide more clarity, and to make the purpose and
assignment of rc more obvious.

Change tmpfname creation failure to be like pgpoutfile and
pgperrfile, by going to the cleanup point.
Convert msg_search to use buffer.

Avoid the buffer pool because of the long life cycle (across the
invocation of mutt_body_handler().
Convert mx_close_mailbox() to use buffer pool.
Reduce line buffer size in mx_get_magic().

tmp is only used for mbox and mmdf iniital line examination.  That
only needs to look at 6 characters from the first line.
Convert mutt_save_confirm() to use buffer pool.

These are prompts, so don't really need the larger, dynamic
capability, but it might not hurt for a larger path.
Removed unused mutt_expand_link()
Change ssl_init to use buffer pool for rand filename.
Convert mbox_sync_mailbox() to use buffer pool.

Rewrite return(-1) to a new fatal target to ensure cleanup.

Remove some repetitive unlink(tempfile) operations by adding a new
flag pointing when to start and stop that during a bail.
Update mime fields when piping a message with $pipe_decode set.

Programs that process the message may get confused if the original
mime fields are in the output.  Add the CH_MIME flag to strip mime
headers and CH_TXTPLAIN to add decoded text mime headers in their
place, just as <decode-copy> does.

However, make sure not to add the flags when printing, as printers
highly likely won't care and users probably don't want to see those
headers in their printout.
Merge branch 'stable'
937a1eb1 — Beck, Andre 6 days ago
Clear connection input buffer when closing.

An RFC-violating reply from the Dovecot SMTP submission service
uncovered a bug in Mutt.  Mutt was not clearing out the input buffer
when closing the connection.

Dovecot was including an extra 250 response after data submission:

  DATA
  354 OK
  Subject: Test 3

  Test 3
  .
  250 2.0.0  223 byte chunk, total 223
  250 2.0.0 OK id=1iIqT1-0004wS-Ac
  quit
  221 2.0.0 Bye

The multiline 250 reply requires a hyphen in the first response.  Mutt
closes the connection after the quit, but ends up leaving the
unexpected second line in the input buffer.  This causes an error in
the next usage of the connection.

Clean out bufpos and available when closing the socket.
Add new browse-mailboxes function in index and pager.

This allows direct access to the mailboxes list in the folder menu.
This is useful, for instance, if $browser_sticky_cursor is set and the
current directory does not contain the open mailbox.  The macro
version will lose the current mailbox while toggling to the mailboxes
list.
Convert main() to use buffers for paths.

Convert fpath (used for checking and creating $folder.

Convert expanded_infile and tempfile which are used for the -i,-H, and
-E options.  We allocate buffers, rather than use the pool, because
they are used for the duration of the compose/send operation.
Add sticky browser behavior for sorting.

The menu isn't rebuilt after sorting, so the selected mailbox was not
sticky for that operation.

Refactor the sticky cursor setting out so it can be explicitly called
after sorting too.
Convert start_debug() to use buffer pool.
Convert set/reset and source_rc to use buffers for paths.
Next