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.
Kevin McCarthy [Fri, 19 Jul 2019 19:54:32 +0000 (12:54 -0700)]
Add autocrypt line to the compose menu.
Remove the hardcoded HDR_ATTACH offset calcuation, and add an explicit
enum for the "-- Attachments" line to make loops and padding array
sizes easier.
Add security and recommendataion fields on the line.
Add mutt_autocrypt_ui_recommendation, following the autocrypt spec
guidelines.
Kevin McCarthy [Fri, 12 Jul 2019 01:06:56 +0000 (18:06 -0700)]
Add autocrypt header parsing to mutt_parse_rfc822_line().
Convert parse_parameters() for autocrypt header usage:
* change to use a BUFFER to accomodate large autocrypt keydata
attribute values.
* Autocrypt header parameters are not rfc2231 compliant. Rather
than rolling another very similar function, just change the
existing one to allow space separation.
Kevin McCarthy [Sun, 28 Jul 2019 17:13:22 +0000 (10:13 -0700)]
Add a comment to the OPTIGNOREMACROEVENTS km_dokey() change.
The option was added in commit 53900afa, and its actual purpose was
to separate out an "unget" event buffer from the "macro" buffer, to
solve a problem with certificate prompts.
The safest approach in a low-level function like km_dokey() was to
return an error if new macros were generated when the option is set.
However, this results in an unbuffered username/password prompt being
aborted.
Currently the only users of unbuffered input are the SSL certificate
prompts, which use menu->dialog mode (and thus mutt_getch() directly)
and username/password prompts. So the only affected cases are
editor-menu prompts, and returning the pressed keys is likely less
surprising than aborting the prompt.
If other unbuffered menus are created in the future, we may want to
add a check for which menu mode is being used.
Kevin McCarthy [Fri, 26 Jul 2019 01:18:08 +0000 (18:18 -0700)]
Fix accidental fall-through for <quote-char> if aborted.
If <quote-char> was aborted, it was falling through to the
<transpose-chars> function.
This problem was introduced 19 years when the <transpose-chars> case
was moved below <quote-char>. Previously it fell through to the
default case which beeped.
Andrew Marks [Fri, 5 Jul 2019 15:44:21 +0000 (08:44 -0700)]
Added * option to unattachments command
The * option clears all previous attachments settings. A
list_free_generic method is added to muttlib to enable generic freeing
of specific LIST structures. free_attachments_data is used with
list_free_generic to clear four LISTs which manage allowed and excluded
inline and attached "attachments"
The User-Agent: header can be fun and interesting and useful for
debugging, but it also leaks quite a bit of information about the user
and their software stack.
This represents a potential security risk (attackers can target the
particular stack) and also an anonymity risk (a user trying to
preserve their anonymity by sending mail from a non-associated account
might reveal quite a lot of information if their choice of mail user
agent is exposed).
Users who want to configure `user_agent` to `yes` can still do so, but
it makes sense to have safer defaults.
Kevin McCarthy [Thu, 27 Jun 2019 22:35:12 +0000 (15:35 -0700)]
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.
Kevin McCarthy [Thu, 27 Jun 2019 18:06:19 +0000 (11:06 -0700)]
Convert $header_cache_pagesize to type DT_LNUM.
Prior to commit 4bc76c2f there was no LNUM type, and so the workaround
was to store it as a string, converting in the hcache_open_gdbm()
call.
This will not affect the user interface or config file, because DT_NUM
and DT_LNUM read in a string from the config file and convert to a
number. Quotes are used for escaping style, not passed through to the
variable setter.
So essentially this simply moves the conversion to parse_set(), and
provides feedback for a non-numeric type immediately.
Kevin McCarthy [Tue, 25 Jun 2019 21:25:33 +0000 (14:25 -0700)]
Convert Commands to use the union pointer_long_t too.
As with MuttVars, Commands was using an unsigned long to hold pointers
as well as enums. Convert to use the same union type of MuttVars.
Adjust command functions data parameter type to the union. Since
these are used outside init.c, relocate the union definition to
mutt.h.
Although the number of functions affected was long, most of them did
not need much adjustment. Many of them made no use of the parameter.
Those that did were easily cast into an added "data" variable at the
top.
Kevin McCarthy [Tue, 25 Jun 2019 01:07:54 +0000 (18:07 -0700)]
Convert MuttVars.data and .init to use a union type.
They were using an "unsigned long" and casting to a pointer when
needed. Obviously this has "worked" for a long time, but it's not
correct to assume a pointer can fit in unsigned long.
Replace with a union contain "void *p" and "long l". Fortunately, the
only parts making direct use of MuttVars are in init.h and init.c, so
we just need to update those manipulation functions.
In general I don't like single letter variables, but brevity is worth
it in this case.