Andres Freund [Tue, 21 May 2019 23:50:54 +0000 (16:50 -0700)]
Avoid redundant sort in entire-thread.
918885f added, indirectly, a mutt_sort_headers() call to
nm_read_entire_thread() (via mutt_mailbox_changed() ->
ctx_mailbox_changed() -> ctx_update()), but didn't remove the sort
after nm_read_entire_thread() in mutt_index_menu().
Andres Freund [Tue, 21 May 2019 23:13:10 +0000 (16:13 -0700)]
entire-thread: determine current position before resorting.
Previously oldcur was determined after nm_read_entire_thread(),
leading to entire-thread unintentionally jumping to the first message
in the thread.
Before 918885f32db41 that used to work, because mutt_sort_headers()
wasn't called from within nm_read_entire_thread().
Fix by moving determination of pre nm_read_entire_thread() count a few
lines up. Also reuse existing oldcount variable, rather than
'oc' (which could also be oldcur).
Richard Russon [Thu, 16 May 2019 11:55:40 +0000 (12:55 +0100)]
don't check for empty config strings
The config system stores empty strings as NULL.
Config variables must not be set directly, but using the config system
(this gives us validation and notifications).
Richard Russon [Thu, 16 May 2019 10:29:49 +0000 (11:29 +0100)]
merge: upstream fixes
* Fix sample neomuttrc to use better quoting practices.
* Add a "backticks in double quotes" example to the manual.
* Avoid undefined behaviour on huge integer in a RFC2231 header
* sync pgp_gpgme_invoke_import()
Vincent Lefevre [Wed, 15 May 2019 11:05:09 +0000 (13:05 +0200)]
Avoid undefined behaviour on huge integer in a RFC2231 header
The atoi() function was called on the index, which can potentially
be huge in an invalid message and can yield undefined behavior. The
mutt_atoi() function is now used for error detection.
Pietro Cerutti [Mon, 13 May 2019 11:42:37 +0000 (11:42 +0000)]
Do not cache a compiled regex to avoid leaks
glibc's implementation of the regex engine is a DFA which creates nodes
on the fly under the regex_t object. This will cause leakes if we keep
the compiled regular expression around, as it was the case before.
See also https://sourceware.org/bugzilla/show_bug.cgi?id=12567
Austin Ray [Fri, 10 May 2019 00:05:22 +0000 (20:05 -0400)]
feat: use mailbox description for spoolfile
'spoolfile' is limited to mailboxes paths so if one wants to use a
'named-mailboxes' or 'virtual-mailboxes' as the spoolfile, its path must
be duplicated in the 'spoolfile' assignment. 'virtual-mailboxes' has a
helper variable, 'virtual_spoolfile', for selecting the first
'virtual-mailboxes' entry as the spoolfile.
This commit allows one to use a mailbox description for the 'spoolfile,
which removes the need to duplicate a 'named-mailboxes' or
'virtual-mailboxes' path and makes 'virtual_spoolfile' defunct. The
configuration syntax is now more consistent.
It is important to note that mailbox descriptions are preferred to
paths.
To reflect the change, documentation was updated:
- Add note to 'spoolfile' about using a string to specify a
'named-mailboxes' or 'virtual-mailboxes' description.
- Add a note to the 'virtual_spoolfile' documentation saying that it is no
longer necessary since 'spoolfile' supports descriptions now.
Richard Russon [Fri, 10 May 2019 14:16:58 +0000 (15:16 +0100)]
merge: upstream fixes
* Add a test for NULL parameter attribute too
* Add a quick-starter config section to the manual.
* Add sample starter muttrc to contrib.
* Change sample muttrc path to match other manual references.
* Add note about %r for the pgp_list_*_command vars.
Kevin McCarthy [Thu, 9 May 2019 20:25:25 +0000 (13:25 -0700)]
Change sample muttrc path to match other manual references.
The other parts of the manual refer to /usr/local/share/doc in their
examples. For consistency, change the starter muttrc and manual entry
to do the same.
In the future, we may wish to have a config variable instead, so users
don't have to worry about system vs locally installed paths when
sourcing the gpg.rc, for instance.
Richard Russon [Mon, 6 May 2019 11:27:15 +0000 (12:27 +0100)]
merge: Upstream refactoring
* Change struct Mailbox->realpath to be const char *
* Convert struct Buffer->path to a struct Buffer
* Convert other users of struct Mailbox->pathbuf to use Buffers
* Add mutt_buffer_enter_fname()
* Convert change folder operations to use struct Buffer
* Increase prompt size to remove warning
* Convert migrated lib.c functions to use struct Buffer
* Add menu dialog helper to add rows
* Convert certficate prompts to use menu dialog helper and struct Buffer
* Convert pager help string to use struct Buffer
* Convert compress to use mutt_buffer_quote_filename()
* Convert remailer to use struct Buffer for Mixmaster invocation
* Revert "Fix truncation of long filenames in attachments."
* Handle the same secret key appearing in multiple public keyrings
* Change mutt_parse_mailboxes() to use the path struct Buffer argument
* Convert mutt_parse_adrlist() to use struct Buffer for simple parsing
* Add note about $mailcap_path generation to the documentation
* Add $imap_fetch_chunk_size to allow FETCHing new headers in chunks
* Enable the use of toggle-write from the pager
* Add note about IMAP browser and trailing delimiters
* Add $forward_attachments quadoption for inline-forward mode
* Note the other parts of generated message-ids in the manual
* Fix mailbox search to not recompile for a repeated search
* Corrected minor errors in text related to $forward_attachments
* Update French translation
* Write rfc2231 parameter continuations for long parameters
* Add a manual section on OpenPGP and S/MIME configuration.
* build: fix tests
* tidy code
Kevin McCarthy [Thu, 2 May 2019 19:31:29 +0000 (12:31 -0700)]
Write rfc2231 parameter continuations for long parameters
Previously, Mutt would truncate long attachment filenames, to avoid
writing an illegal length header line. This commit is a followup to 4dcb3ba1, where I reverted an incorrect fix for the problem.
rfc2231_encode_string() now returns a list of continuations, with
encoding and continuation number suffixes already appended to the
attribute. The function tries to keep the line length less than 78
characters, but the code is a bit imprecise as a trade off for
simplicity and readability.
Modify mutt_write_mime_header() to loop through the continuations.