Kevin McCarthy [Sun, 13 Oct 2019 08:25:54 +0000 (16:25 +0800)]
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.
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.
Kevin McCarthy [Thu, 10 Oct 2019 07:03:05 +0000 (15:03 +0800)]
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.
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.
Kevin McCarthy [Tue, 1 Oct 2019 01:50:27 +0000 (18:50 -0700)]
Memcpy header cache fetch values to ensure alignment.
While testing the hcache buffer pool changes, I noticed a misaligned
pointer warning when using LMDB.
The other header cache backends must ensure alignment of the pointer
they return, but LMDB apparently does not.
Instead of directly assigning and dereferencing the pointer fetched,
use memcpy to the appropriate type, just as the header cache restore
operation does.
Kevin McCarthy [Wed, 25 Sep 2019 22:28:30 +0000 (15:28 -0700)]
Convert crypt-gpgme to use BUFFER for tempfiles.
Use the pool where possible, but when the function calls other
long-running functions (such as mutt_body_handler() or
mutt_do_pager()), allocate the buffer.
smime_gpgme_decrypt_mime() was not freeing the "cur" BODY generated on
error. Add a call to mutt_free_body(cur) in the error handling.
Kevin McCarthy [Sun, 22 Sep 2019 01:34:51 +0000 (18:34 -0700)]
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.
Kevin McCarthy [Sun, 15 Sep 2019 22:41:42 +0000 (15:41 -0700)]
Improve sidebar indentation and shortpath behavior.
The previous implementation only enabled $sidebar_folder_indent for
mailboxes underneath $folder. Change indentation to be based upon the
previous common-path mailbox in the list. Indent one more than the
common-path mailbox, rather than the number of delimiters after
$folder.
Change $sidebar_short_path to shorten based on the previous mailbox in
the list too.
Invoke mutt_buffer_pretty_mailbox() to prefix the mailbox with '~' or
'=' characters. This changes the output for the case where mailbox
equals $folder, but provides uniform display behavior across mutt.
Thanks to Christopher Zimmermann (@madroach) for the original patch,
which this commit is based upon.
Kevin McCarthy [Wed, 11 Sep 2019 22:55:01 +0000 (15:55 -0700)]
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.
Kevin McCarthy [Tue, 10 Sep 2019 01:32:59 +0000 (18:32 -0700)]
Fix mutt_write_mime_body() application/pgp-encrypted handling.
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.
Kevin McCarthy [Sun, 8 Sep 2019 19:09:51 +0000 (12:09 -0700)]
Rename browser fields to display_name and full_path.
Mailbox and Folder view don't make use of the desc field. They store
an abbreviated version in the name field and expand it when selecting
or testing it.
IMAP stores the full URL in name, and stores an abbreviated
version (possibly with a trailing slash) in the desc field.
The asymetricity makes it awkward, and interferes with a smart-cursor
option in the next commit. So instead rename the fields to
"display_name" and "full_path".
In Mailfox and Folder view, store the fully expanded path, which we
have while iterating, in "full_path", and the shortened version in
"display_name".
Likewise in IMAP, store the full URL in "full_path" and the shortened
version in "display_name".
Simplify the code in browser.c to use the full_path instead of
concatenating and expanding.
Kevin McCarthy [Mon, 2 Sep 2019 02:10:23 +0000 (19:10 -0700)]
Fix memory leak when attaching messages.
Setting actx->idx[]->content->parts to NULL causes a memory leak,
because message attachments store a BODY there that needs to be freed.
I looked through the various use cases of ci_send_message() and
actually believe content->parts will be NULL for all other cases
except message attachments. From the comment added to
delete_attachment():
Other ci_send_message() message constructors are careful to free
any body->parts, removing depth:
- mutt_prepare_template() used by postponed, resent, and draft files
- mutt_copy_body() used by the recvattach menu and $forward_attachments.
I believe it is safe to completely remove the "content->parts =
NULL" statement. But for safety, am doing so only for the case
it must be avoided: message attachments.
Kevin McCarthy [Sat, 31 Aug 2019 20:37:16 +0000 (13:37 -0700)]
Re-enable and cleanup format-flowed space stuffing.
Commit 04cb5bde tried to fix re-stuffing a postponed message more than
once, but unfortunately broke the normal case of composing a new
message. So actually, space-stuffing has been turned off the past 7
years.
Move format=flowed parameter setting below the standard message
pre-processing block. It shouldn't be performed for draft-files even
with $resume_draft_files set. Moving out of the block makes that
clearer.
Create mutt_rfc3676_space_(un)stuff() functions, which check the
content type and stuff/unstuff apprpropriately. Note that the
stuff/unstuff does not depend on $text_flowed, which is only in charge
of setting the format=flowed parameter. This parameter can also come
from resumed/resent/draft messages and should still be respected.
Add unstuffing to mutt_prepare_template(). This is called by
postponed, resent, and draft files. This will prevent double-stuffing
in those cases.
Unstuff/restuff around editing the message in the compose menu, to
keep everything transparent to the user. I originally put the
stuffing *after* the compose menu, but previewing the messages in the
compose menu did not work properly in that case. It's cleaner this
way too.
Change the stuff/unstuff functions to preserve the original
hdr->content->filename. The "hack" previously used would interact
poorly with editable body files (mutt -i -E). Fortunately space
stuffing was pretty much disabled except in unusual cases before.
Kevin McCarthy [Wed, 28 Aug 2019 21:41:26 +0000 (14:41 -0700)]
Fix inotify configure test.
AC_CHECK_FUNCS executes "action-if-found" or "action-if-not-found" for
each function in the list. If a system has some but not all of the
functions, both will end up being executed.
This caused a build failure on an older system with exactly that
situation.
Change to only define USE_INOTIFY if all functions exist.
Olaf Hering [Wed, 28 Aug 2019 20:22:10 +0000 (20:22 +0000)]
de.po: proper translation for term collapse
The intention of the term "collapse" is something like opening and
closing an item. The initial translation which was added two decades
ago means something like "breaks by weakness", which does not fit in
the context of mutt.
Use a term which means literally "opening and closing an item, like a
book".
Kevin McCarthy [Tue, 20 Aug 2019 22:17:31 +0000 (15:17 -0700)]
Update autocrypt keyring documentation.
Recommend setting $autocrypt_dir to your normal keyring directory if
you want to use your existing key.
Trying to copy it over leads to signature verification issues. Even
if I reversed the order (which is much less clean), that would just
lead to missing key signature errors for Autocrypt messages instead.
Kevin McCarthy [Fri, 28 Jun 2019 22:09:51 +0000 (15:09 -0700)]
Add size display configuration variables.
Although it would be nice to "open this up" more, performance and
security/stability issues would arise.
Based on the thread in mutt-dev, I hope these vars will satisfy most
customization needs:
$size_show_bytes
$size_show_mb
$size_show_fractions
$size_units_on_left
Kevin McCarthy [Thu, 8 Aug 2019 01:34:58 +0000 (18:34 -0700)]
Turn off macro processing during autocrypt initialization.
The muttrc can push events into the macro buffer, with the assumption
that mailbox will be opened next. This will interfere with the
prompts uses during first run. The only issue is that macros won't
work inside the folder browser, if invoked.
Kevin McCarthy [Thu, 8 Aug 2019 01:24:15 +0000 (18:24 -0700)]
Allow nested setting of OPTIGNOREMACROEVENTS.
This will be needed for the first-run of autocrypt initialization.
The initialization involves a number of prompts, and can even use the
folder browser. The browser could in turn connect to IMAP which might
invoke a certificate prompt, login prompt, etc.