Ian Zimmerman [Fri, 2 Dec 2016 13:14:26 +0000 (13:14 +0000)]
feature: $from_chars highlights differences in authorship
This adds a new variable $from_chars which works like $to_chars.
It will add a character prefix to the %F or %L field in $index_format.
The character is determined by the contents of the To/Cc/Bcc fields.
Pietro Cerutti [Fri, 18 Nov 2016 16:49:37 +0000 (16:49 +0000)]
build: enhance mutt_to_base64() (and callers)
- take chars and cast to unsigned chars inside, remove casts from callers
- return the number of characters written to the output buffers
- Doxygenize and verboize the documentation
Richard Russon [Sat, 26 Nov 2016 11:20:16 +0000 (11:20 +0000)]
fix: index in pager crash
The steps to reproduce this were:
- open a mail
- change the underlying maildir while the mail is open
- reply to the mail
I can't reproduce the original crash, but it happened when the index was
being redrawn. One of the "Context->hdrs" was NULL causing
index_make_entry to crash.
Richard Russon [Thu, 24 Nov 2016 20:00:59 +0000 (20:00 +0000)]
merge: upstream fixes (mutt/default)
* When $flag_safe is set, flagged messages cannot be deleted.
* Adds the '@' pattern modifier to limit matches to known aliases.
* Adds <mark-message> binding to create "hotkeys" for messages.
* Updated requirement on the C compiler.
* Updated French translation (except for 1 string).
* Make a string translatable. Add a missing space at the end.
* Make a string translatable.
* Updated French translation.
* Updated French translation.
* Fix mark-message translation and keybind menu.
* More openssl1.1 fixes: remove uses of X509->name in debugging. (closes #3870)
* Don't close stderr when opening a tunnel. (closes #3726)
* Minor resource and error logic cleanup in tunnel_socket_open()
* Make sure that the output of X509_NAME_oneline is null-terminated.
* Revert db13010a2e8d but add a comment. (see #3870)
* Corrected comment.
Kevin McCarthy [Mon, 21 Nov 2016 00:19:17 +0000 (16:19 -0800)]
Don't close stderr when opening a tunnel. (closes #3726)
Instead of closing stderr, redirect it to /dev/null in
tunnel_socket_open(). Otherwise a program can accidentally open a
file into handle 2 and then unknowingly use that when trying to print
to stderr.
Thanks to lotheac for the original patch, which I just modified
slightly.
Kevin McCarthy [Sun, 20 Nov 2016 03:35:07 +0000 (19:35 -0800)]
More openssl1.1 fixes: remove uses of X509->name in debugging. (closes #3870)
X509->name was a shortcut for the longer
name = X509_NAME_oneline (X509_get_subject_name (cert),
buf, sizeof (buf));
invocation. Change the debugging to print the cert name and chain
names in the ssl_check_certificate() loop instead.
Kevin McCarthy [Fri, 18 Nov 2016 23:54:27 +0000 (15:54 -0800)]
Fix mark-message translation and keybind menu.
Move the OP_MARK_MESSAGE and hotkey macro from MENU_GENERIC to the
MENU_MAIN keymap. Putting the macro under generic prevents it from
overriding a keybinding in the index (even if the function is bound to
noop). Additionally, the macro can only be executed from the index,
so it doesn't make sense as a generic keybinding.
Use the term "hotkey" in both the OPS and km_bind description.
Mark the km_bind description translatable.
Add L10N messages for the new translation strings.
David Champion [Thu, 17 Nov 2016 23:57:42 +0000 (15:57 -0800)]
Adds <mark-message> binding to create "hotkeys" for messages.
<mark-message>foo<enter> will create a new macro "'foo" which will
return to the current message by searching for that message's
message id. The initial character of the macro is defined by
$mark_macro_prefix, and defaults to "'" for verisimilitude vs. vi.
Serge Gebhardt [Sat, 19 Nov 2016 22:15:21 +0000 (23:15 +0100)]
$forward_references includes References: header on forwards
By default a forwarded message does not reference the messages it
contains. This commit introduces a new boolean option
`$forward_references`. When it is set, a forwarded message includes the
`In-Reply-To:` and `References:` headers, just like a reply would. Hence
the forwarded message becomes part of the original thread instead of
starting a new one.
Richard Russon [Thu, 24 Nov 2016 14:02:48 +0000 (14:02 +0000)]
merge: hcache refactor
* Support compilation of multiple hcache backends and run-time selection
* More hcache-related cleanup and consistency in autoconf land
* Hcache backends list
* Hcache backends list up tidying
* Implement mutt_hcache_free to dispose of header cache data
Pietro Cerutti [Thu, 10 Nov 2016 13:33:16 +0000 (13:33 +0000)]
Support compilation of multiple hcache backends and run-time selection
Backend specific APIs have been moved to hcache-backend.h
This commits introduces the support for multiple backends and an option to
configure the one to use at run time (header_cache_backend). Backends are not
mutual exclusive anymore, and several can be compiled in by specifying multiple
--with-<backend> configure options.
For backwards compatibility, the header_cache_backend option can be left empty,
in which case the first (configure.ac order) compiled-in backend is selected.
In the case of distros building with a single backend enabled - as they are
forced to do today - the hcache functionality is unchanged.
Richard Russon [Sat, 19 Nov 2016 01:39:44 +0000 (01:39 +0000)]
merge: upstream adoption of compress
* Compress patch from the neomutt repository.
* Compress: prefix external functions with "mutt_"
* Compress: remove buffy stats "improvisation".
* Compress: fix several logic and memory bugs.
* Compress: add delegate calls to open_append and close mx_ops functions.
* Compress: safe_fopen() the tempfile, to prevent tempfile attacks.
* Compress: pull the lock/unlock operations into the open,close,sync operations.
* Create mx_ops.sync operation. Refactor compress to use the mx_ops.sync.
* Compress: fix check_mailbox and sync_mailbox.
* Compress: escape single quotes when invoking the compress/decompress commands.
* Compress: check mailbox type if possible when appending.
* Ensure the compressed documentation is always built.
* Improve two compress translation messages.
* Revert "Compress: remove buffy stats "improvisation"."
Kevin McCarthy [Mon, 14 Nov 2016 04:02:36 +0000 (20:02 -0800)]
Compress: check mailbox type if possible when appending.
If an append hook isn't defined, then mutt has to decompress the
mailbox. In that case, we can check the type of the decompressed
mailbox instead of defaulting to DefaultMagic.
Kevin McCarthy [Mon, 14 Nov 2016 04:02:35 +0000 (20:02 -0800)]
Compress: fix check_mailbox and sync_mailbox.
Change check_mailbox to delegate to the child_ops->check_mailbox if
the compressed mailbox has changed. This allows the mailbox to
properly recover if both the decompressed mailbox and compressed file
have changed.
Change sync_mailbox to call check_mailbox before attempting to sync.
This will prevent overwriting external changes to the compressed
mailbox.
Kevin McCarthy [Mon, 14 Nov 2016 04:02:35 +0000 (20:02 -0800)]
Create mx_ops.sync operation. Refactor compress to use the mx_ops.sync.
Change compress.sync_mailbox() to lock the compressed mailbox around
both the tempfile sync and compress operations. This will prevent
changes made inbetween the two syncs from being overwritten.
Thanks to Damien Riegel for his original patch refactoring
mx_ops.sync, which this patch is partially based upon.
Kevin McCarthy [Mon, 14 Nov 2016 04:02:35 +0000 (20:02 -0800)]
Compress: pull the lock/unlock operations into the open,close,sync operations.
Some operations, such as open_append and sync, need an exclusive lock
across a longer period than a single compress/decompress. Remove it
from the execute_command and pull into the outer callers. Store lock
information inside compress_info.
Sync and check_mailbox need more fixes, which will be addressed in
subsequent patches.
Kevin McCarthy [Mon, 14 Nov 2016 04:02:34 +0000 (20:02 -0800)]
Compress: add delegate calls to open_append and close mx_ops functions.
The open_append and close were partially duplicating mbox open_append
and close operations internally. Change it to call the actual
delegate functions instead.
Inline the open_read() function inside open_mailbox(). Having it
split improved nothing and just complicated the code (i.e. added
error-handling checks in open_mailbox() that in reality could not
fail).
Kevin McCarthy [Mon, 14 Nov 2016 04:02:34 +0000 (20:02 -0800)]
Compress: fix several logic and memory bugs.
setup_paths leaks memory: realpath is already set in mx_open_mailbox()
restore_paths is unneeded. mx_fastclose_mailbox() will free stuff,
and nothing is looking at the path once we are closing or aborting.
Make a copy of the hooks. Otherwise 'unhook *' will leave dangling
pointers.
Add compress_info freeing inside mx_fastclose_mailbox(). Only free
inside compress.c when we want to prevent close() from doing anything.
close_mailbox() didn't preserve ctx->path on error.
execute_command() didn't return an error if the mutt_system() command
failed.
mx_open_mailbox_append() should check mutt_comp_can_append() only for
the case that the mailbox doesn't exist. When it exists,
mx_get_magic() has already looked at the file contents before checking
for matching open_hooks.
In open_append_mailbox() if no append hook is defined, it should't
call ci->open() if the mailbox doesn't exist. It should act just like
append and create a temporary file.
check_mailbox() needs more work. For now, at least have it properly
close the mailbox on error.
Kevin McCarthy [Mon, 14 Nov 2016 04:02:34 +0000 (20:02 -0800)]
Compress: remove buffy stats "improvisation".
Mutt doesn't support polling compressed mailboxes. This code creates
a false impression and dirties mutt_save_message() in the process. I
don't like it, so am taking it out.
The mx_fastclose_mailbox() calls mx_ops->close(), which invokes
mbox_close_mailbox().
Also, close the ctx->fp inside mbox_close_mailbox(). This way, the
(to be added) compress logic can call the mx_ops->close() instead of
"knowing" to close the fp before recompressing.
mx_fastclose_mailbox() will safe_fclose() the fp again, but I'm
leaving it there just in case I missed a usage of the fp in some other
part of the code.
Kevin McCarthy [Tue, 8 Nov 2016 02:10:27 +0000 (18:10 -0800)]
Chain %d->%F->%f in the attachment menu.
Previously, %d would use %f if there was no description set.
Place the new %F option in between %d and %f. This way, %d will fall
back on %F, which will fall back on %f. This allows the standard
attachment menu to show d_filename.
This is useful for forwarding attachments or editing draft files with
attachments. In these cases the actual filename is sanitized but the
attachment name is preserved in d_filename.
Damien Riegel [Tue, 8 Nov 2016 02:10:22 +0000 (18:10 -0800)]
compose: add operation to rename an attachment
As opposed to rename-file, which actually renames the underlying file
of the attachment, rename-attachment puts a value in d_filename, which
is used in the Content-Disposition header.
Thomas Adam [Wed, 26 Oct 2016 22:58:16 +0000 (23:58 +0100)]
hooks: define hooks for startup and shutdown
Having hooks which run when mutt first starts (startup-hook) but before the
fist mbox is opened, and when mutt closes the mbox (shutdown-hook) before
exiting, allows for those notmuch users to run commands to sync the state of
their caches, etc.
support GLOBALHOOK type
There's now a few hooks (startup/shutdown/timeout) which don't operate on a
mbox or pattern, but are instead global to mutt. Therefore, don't require the
hooks themselves to needlessly define these parameters.
Pietro Cerutti [Sun, 13 Nov 2016 16:52:13 +0000 (16:52 +0000)]
build: Improve discovery for the Berkeley Database
- Drop support for old BDB versions and fix autoconf discovery
- Be more verbose when looking for BDB
- Hardcode a couple of commonly used prefixes
- Workaround empty path component expansion
- Do not clobber LIBS with BDB libraries