Richard Russon [Mon, 21 Oct 2019 16:39:09 +0000 (17:39 +0100)]
eliminate MuttIndexWindow from create_filter()
`mutt_create_filter_fd()` uses the screen width to set the environment
variable $COLUMNS. This allows certain filters / mailcap programs to
adjust their output.
$COLUMNS is set/reset in the smallest scope possible.
Richard Russon [Sun, 27 Oct 2019 00:34:32 +0000 (01:34 +0100)]
merge: upstream Buffer refactoring
* Convert hcache fetch and store raw to use buffer pool
* Convert mutt_parse_hook() to use buffer pool
* Convert set/reset and source_rc to use buffers for paths
* Convert main() to use buffers for paths
* Convert mbox_mbox_sync() to use buffer pool
* Change ssl_init to use buffer pool for rand filename
* Convert mutt_save_confirm() to use buffer pool
* Convert mx_mbox_close() to use buffer pool
* Convert pgp_app_handler to use buffer pool
* Convert pgp_check_traditional_one_body() to use buffer pool
* Convert pgp_class_verify_one() to use buffer pool
* Convert pgp_extract_keys_from_attachment() to use buffer pool
* Convert pgp_decrypt_part() to use buffer pool
* Convert pgp_class_sign_message to use buffer pool
* Convert pgp_class_encrypt_message() to use buffer pool
* Convert pgp_class_traditional_encryptsign() to use buffer pool
* Convert pgp_select_key() to use buffer pool
* Convert pgp_class_make_key_attachment() to use buffer pool
* Convert pop_fetch_message() to use buffer pool
* Convert mutt_num_postponed() maildir check to use buffer pool
* Convert attach_fmt %f to use buffer pool
* Convert attach_forward_bodies to use buffer pool
* Convert attach_forward_msgs() to use buffer pool
* Convert mutt_attach_reply() to use buffer pool
* Convert mailcap_lookup() to use buffer pool for path
* Convert send_message() to use buffer pool
* Convert fcc to a buffer
Kevin McCarthy [Wed, 16 Oct 2019 07:42:54 +0000 (15:42 +0800)]
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.
Kevin McCarthy [Wed, 9 Oct 2019 04:59:41 +0000 (12:59 +0800)]
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.
Kevin McCarthy [Sun, 6 Oct 2019 05:37:14 +0000 (13:37 +0800)]
Convert mutt_parse_hook() to use buffer pool
Remove the path variable, as this is not needed:
mutt_buffer_expand_path() and mutt_check_simple() can operate directly
on the pattern/command buffers.
Austin Ray [Sat, 26 Oct 2019 02:55:39 +0000 (22:55 -0400)]
fix: abort entire-thread if database lacks message
If the notmuch database is missing a message, abort <entire-thread>
before causing a segfault. When <entire-thread> executes on a message
missing from the database, it segfaults. This happens because the
vfolder returned is empty and not in an properly initialized state for
the notmuch-backend. As such, the notmuch-backend segfaults.
To prevent a segfault, display a warning and pre-maturely exit
<entire-thread>. While the user is left in an empty vfolder, this is
consistent behavior for <entire-thread>. Ordinarily, you're left with
just the notmuch thread, which doesn't exist in this case.
The location of the abort is perfect for adding behavior to handle the
missing message. In the future, we can automatically run 'notmuch new'
after encountering a missing message. That is outside the scope of this
commit.
Richard Russon [Wed, 23 Oct 2019 10:41:16 +0000 (11:41 +0100)]
merge: eliminate uses of MuttIndexWindow
* eliminate MuttIndexWindow from mutt_copy_message()
* eliminate MuttIndexWindow from deep functions
* eliminate MuttIndexWindow from mutt_make_string_flags()
* eliminate MuttIndexWindow from Mixmaster
* eliminate MuttIndexWindow from mutt_display_message()
Richard Russon [Mon, 21 Oct 2019 11:34:04 +0000 (12:34 +0100)]
eliminate MuttIndexWindow from mutt_make_string_flags()
`mutt_make_string_flags()`, and its macro wrapper `mutt_make_string()`,
use `mutt_expando_format()` and `index_format_str()` to expand strings.
Some of the callers expect the string to be truncated at the screen
width. These functions now have an extra paramter to avoid using
`MuttIndexWindow` directly.
Richard Russon [Wed, 2 Oct 2019 22:58:39 +0000 (23:58 +0100)]
fix read-only mbox
If an mbox Mailbox doesn't have write privs, try opening it read-only.
Before the architectural changes, there could be multiple open Mailbox
objects representing a single folder.
By default a folder would be given a read-only Mailbox. When the folder
needed to be written to, another Mailbox would be opened read-write.
This lead to synchronisation problems between the two Mailboxes.
Beck, Andre [Fri, 11 Oct 2019 11:17:58 +0000 (19:17 +0800)]
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.
Darren Kenny [Mon, 2 Sep 2019 11:34:26 +0000 (12:34 +0100)]
Add ability to limit levels hidden with toggle-quoted command
Closes: #1802
By setting the configuration variable `toggle_quoted_show_levels`, when you
execute the `toggle-quoted` command, the specified number of levels
will continue to be visible.
Richard Russon [Tue, 8 Oct 2019 22:34:59 +0000 (23:34 +0100)]
merge: upstream refactoring
* Re-enable and cleanup format-flowed space stuffing
* Remove manual note about space-stuffing only once
* Reuse the static space_stuff function for unstuffing
* Convert crypt-gpgme to use struct Buffer for tempfiles
* Convert crypt_extract_keys and signed handler to use buffers
* Convert edit_one_message() to use buffer pool
* Convert run_decode_and_handler() to use buffer pool
* Convert hcache db4 lockfile to buffer
* Convert hcache_open to use buffer pool
* Fix built-in pager checks for help and attachments
* Convert mutt_edit_headers() to use buffer pool
* Convert mutt_help() to use buffer for tempfile
* Convert save-hook and fcc-hook to use buffer pool internally
* Fix mutt_write_mime_body() application/pgp-encrypted handling
* Convert imap_open_new_message() to use buffer pool
* Convert imap fetch_new and fetch_message tempfiles to buffer pool
* Convert imap_cachepath() and callers to use buffers
* Convert parse_path_(un)list to use buffer pool for path
* Convert start_debug() to use buffer pool
It would blindly overwrite any attachment with that type, as if it
were the version label part of a multipart/encrypted message.
However attachments with extenstion .gpg are labeled that type if
$mime_type_query_command is set to "xdg-mime query filetype". This
would cause the attachment to be overwritten too.
Add a check for a missing body->filename, which should only be the
case for the manually constructed part.