mutt/commands.c -rw-r--r-- 31.1 KiB
Add "headers" parameter to mx_open_message().

This will allow some operations to retrieve only headers, such as ~h
pattern matching or the new list menu.

Modify the IMAP and POP3 implementation to retrieve only headers when
the parameter is set.

Headers-only will use the message cache if one exists, but will not
populate the message cache (since the body of the message is not
Add a mutt_error() when copy/save messages fails.

Avoid using "part" translations for the tag/untagged copy/save
combinations, even though that makes the code longer.
Remove relative path expansion for some cases.

Some paths, such as the folder browser, or certain hook values,
should be expanded for shortcuts, but not for relative paths.

Configuration variables that hold commands that search by PATH should
also not be expanded.

Create a separate call, and a separate data type for config vars.
Create $copy_decode_weed, $pipe_decode_weed, $print_decode_weed.

$weed covers a bit too much functionality.  It makes sense for it to
control the display of messages in the pager, along with forwarding
and replying.  But (in my opinion) piping and copy/save-decode are
something users might like to set differently without affecting the
rest of Mutt's behavior.

$copy_decode_weed affects the <decode-copy> and <decode-save>
functions.  I've defaulted this *unset*, despite that it breaks
backward compatibility, because I believe the header weeding is
surprising to users and loses important information when copy/saving a

$pipe_decode_weed affects <pipe-message> when $pipe_decode is set.
I've default this *set* for backward compatibility.

$print_decode_weed affects <print-message> when $print_decode is set.
I've default this *set* for backward compatibility.
Clean up Editor Menu interface inside Mutt.

enter_filename() api:

* Rename enter_fname() to _enter_fname()

* Rename mutt_buffer_enter_mailbox() to mutt_enter_mailbox()

* Rename mutt_buffer_enter_filenames() to mutt_enter_filenames()

* Remove 'multiple' and 'fname buffer' parameters from
  mutt_enter_filenames().  Create a temp buffer, and enable multiple
  automatically.  This removes the possibility of mistakenly looking
  at an unpopulated 'fname' parameter for the result.

* Create mutt_enter_filename().  This isn't used currently, but it
  makes sense to have a "single filename" api already set up with
  correct parameters.

get_field() api:

* Rename _mutt_buffer_get_field() to a static _get_field() function.

* Remove _mutt_get_field() and make mutt_get_field() an actual

* Remove the multiple/files/numfiles parameters, since this
  should only be done through mutt_enter_filenames().

_mutt_enter_string() api:

Add comments to mutt_enter_string() and _mutt_enter_string() headers.
Noting that they should generally not be called directly.  List the
functions that should be used inside Mutt.  Note the behavior of the
multiple parameter.
Separate mailbox vs buffy-incoming for the "enter_fname" functions.

Create mutt_buffer_enter_mailbox(), which turns on the MUTT_MAILBOX
flag (renamed from MUTT_EFILE).  This uses the mailbox history file
category, and turns on MUTT_SEL_FOLDER in the select_file browser.

Add a do_incoming paramter and a new separate flag MUTT_INCOMING, so
that buffy-completion can be enabled optionally for mailboxes.  It
only makes sense for the change-folder operation, so disable it in
other contexts (such as saving/copying a message, prompting for an Fcc
mailbox, or an autocrypt scan mailbox).

Change saving/copying a message to use the mailbox function, so that
it shares the history file with other mailbox operations.  It would
previously use the "file" history category.

Create mutt_buffer_enter_filenames() to replace the enter_fname()
prompt for files.

Since nothing directly uses the _mutt_buffer_enter_fname() function
anymore, rename and make it static.
Convert "non-fatal" handler errors to return 1 instead of -1.

When displaying a message, display a mutt_error() to warn of
incomplete rendering.

Fix mutt_copy_message() to check for ferror and feof errors on partial
decode too.

Clean up _mutt_append_message() to not pass a partial-decode along as
a success.

Modify the crypt handlers to return 1 if any kind of state message is
displayed.  There is some fuzzyness about what a "fatal" error is, but
for now just consider a handler error that notifies by
state_attach_puts() as "non-fatal".
Print progress meter when copying/saving tagged messages.

When copying from local to IMAP, it would previously only display a
percentage count for each individual message.  Suppress that by
passing MUTT_QUIET.

Note, this is only for "regular" copies.  IMAP server-side copies
happen in a single command and can't display a progress meter.
Convert LastSaveFolder to buffer.
Convert mutt_parse_rc_line() to use real buffer to hold the line.

Previously, the parameter converted into a kind of read-only buffer,
pointing to the char *line passed in.  The problem is that
mutt_extract_token() backtick processing allocates and assigns a new

As a result, buffer->destroy was added, whose sole purpose is to keep
track of the read-only token buffer being reallocated so that it can
be properly freed inside mutt_parse_rc_line().  (The char *line is
allocated and freed in source_rc()).

Remove the token parameter, and convert line to a const char *.  Copy
that into a buffer-pool buffer, so the buffer can be modified

Create a mutt_buffer_rc_buffer() function taking the line buffer
parameter.  To make the source_rc() just a tiny bit faster, have it
directly manage and call mutt_parse_rc_buffer() itself.

Other callers likely don't need the speed, so remove their cumbersome
creation/free of that parameter.

The next commit will deal with removing buffer->destroy and fixing up
backtick handling.
Convert mutt_pipe_message() to use buffer pool.
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.
Fix mutt_save_message() "enter_fname()" to use buffer version.

Commit be632f11 converted this function to use the buffer pool, but
accidentally used the non-buffer prompt when there was already a
buffer-converted version.
Convert mutt_save_message() to use buffer pool.

Change imap_copy_messages() dest parameter to const char *.

mutt_default_save() will be converted to use a buffer next, removing
the dptr fixups.
Convert mutt_display_message() to buffer pool.

Remove an unused mime-type string generation at the top of the
function too.  The code using the mime type was removed a long time
ago in commit 246198ae.
Fix process_gossip_headers() to look at the right envelope.
Add gossip header processing.
Remove unnecessary "" checks for DT_STR and DT_PATH MuttVars.

MuttVars of those types are set via safe_strdup(), which returns NULL
if the original is "".  Thus Var implies *Var.

A good portion of the code relies on that axiom, but over the years
some (Var && *Var) checks have crept in, including from me.

This was partially because of the INITVAL("") that were in the code,
which implied (incorrectly) the initial value could be "".  Commit
2f91d43e removed those to make it more clear.

This commit removes the *Var checks to make it even clearer, and help
avoid them creeping back in again.
Increase prompt size to remove warning.
a7e1572d — Aaron Schrab 1 year, 10 months ago
Generate version string during make not configure

Switch to generating the version string during make process rather than
at configure time.  This makes it easier to keep the detailed version
string accurate when doing development which doesn't require that the
configure script be rerun.
Clean up formatting.

Add spaces after if, else, while, for, switch.

Unify the brace placement style.  The vast majority of the code uses
Allman style so convert the relatively few K&R braces over.