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
Richard Russon [Fri, 4 Nov 2016 14:59:07 +0000 (14:59 +0000)]
merge: upstream fixes (mutt/default)
* Add a --disable-doc configuration option.
* Make ncurses and ncursesw header checking the same.
* Attempt to silence a clang range warning. (closes #3891)
* Fixed issue from changeset 4da647a80c55. (closes #3892)
* Define PATH_MAX, it's missing on the GNU Hurd. (closes #3815)
Richard Russon [Fri, 28 Oct 2016 15:01:14 +0000 (16:01 +0100)]
merge: upstream fixes (mutt/default)
* Add root-message function to jump to root message in thread.
* Updated French translation.
* Prevent an integer overflow in mutt_mktime() (closes #3880)
* Fix pager segfault when lineInfo.chunks overflows. (closes #3888)
* Perform charset conversion on text attachments when piping. (closes #3773) (see #3886)
Kevin McCarthy [Sun, 23 Oct 2016 22:11:56 +0000 (15:11 -0700)]
Perform charset conversion on text attachments when piping. (closes #3773) (see #3886)
When piping a text attachment, there is no reliable way to know the
charset used.
Vincent Lefèvre says:
It was decided in the past that when there is no information on the
charset in a transmission to an external command (e.g. as for mail
composing), texts are expected to be transmitted in the local
charset.
Add a MUTT_CHARSET flag to enable charset conversion on text
attachments for both when $attach_split is set and unset.
Kevin McCarthy [Sun, 23 Oct 2016 21:46:37 +0000 (14:46 -0700)]
Fix pager segfault when lineInfo.chunks overflows. (closes #3888)
The reporter had an html attachment with extremely long lines,
combined with a color pattern of "color body default default ."
This overflowed the lineInfo.chunks, causing a segfault.
Kevin McCarthy [Wed, 19 Oct 2016 20:21:16 +0000 (13:21 -0700)]
Add root-message function to jump to root message in thread.
This seems like a useful feature that was brought up for discussion on
mutt-users. Proposed solutions involved collapsing/uncollapsing
threads, but it's not hard to modify the mutt_parent_message()
function to return the root instead.
Richard Russon [Fri, 28 Oct 2016 10:13:24 +0000 (11:13 +0100)]
merge: upstream fixes (mutt/default)
* Fix POP3 SASL authentication mechanism DIGEST-MD5. (closes #3862)
* Add a few explanatory comments to pop_auth_sasl(). (see #3862)
* Fix GPGME signature zero timestamp and locale awareness issues. (closes #3882)
* Handle presence of '--' delimiter in $sendmail. (closes #3168)
* Allow IPv6 literal addresses in URLs. (closes #3681)
* Fix gpgme segfault in create_recipient_set().
* Use mutt_strlen and mutt_strncmp in sidebar.c.
* Change sidebar to only match $folder prefix on a $sidebar_divider_char. (closes #3887)
* Actually fix gpgme segfault in create_recipient_set().
Kevin McCarthy [Mon, 17 Oct 2016 18:22:13 +0000 (11:22 -0700)]
Actually fix gpgme segfault in create_recipient_set().
Changeset 6e44bfa16096 did not fix the segv. (Sorry, I made the fix
based off a report on IRC but didn't trigger the segv myself: it was
caused by an out-of-tree patch).
The actual problem was that the rset was only resized on a successful
gpgme_get_key(). However, on error, the array still needs to be
NULL-terminated before calling free_recipient_set().
Move the resize so it always takes place. This obviates the need for
the NULL check added in 6e44bfa16096.
Kevin McCarthy [Sun, 16 Oct 2016 22:44:17 +0000 (15:44 -0700)]
Change sidebar to only match $folder prefix on a $sidebar_divider_char. (closes #3887)
The reporter had a $spoolfile of ~/Mailbox and a $folder of ~/Mail.
The sidebar was truncating the spoolfile to "ox" because it only
looked at a substring prefix match.
Kevin McCarthy [Sun, 16 Oct 2016 21:16:47 +0000 (14:16 -0700)]
Fix gpgme segfault in create_recipient_set().
If gpgme_get_key() errors on the first key, the rset will not be
allocated yet. Attempting to null-terminate (and then free) the array
causes a segfault.
Kevin McCarthy [Thu, 13 Oct 2016 01:10:35 +0000 (18:10 -0700)]
Handle presence of '--' delimiter in $sendmail. (closes #3168)
If the delimiter exists, additional sendmail flags will be inserted
before the delimiter. Any arguments after the delimiter will be
preserved as recipients.
Fix GPGME signature zero timestamp and locale awareness issues. (closes #3882)
GPGME signature information has two minor problems.
[-- Begin signature information --]
*BAD* signature from: Name <user@example.com>
aka: Name <user@example.org>
created: Thu Jan 1 09:00:00 1970
[-- End signature information --]
First, the created timestamp is incorrect when the message is not
verified successfully.
Second, as the code itself has some "TODO" comments, "aka" and
"created" lines are not properly-aligned when LC_MESSAGES != English.
sasl_client_step() returns SASL_OK after the fourth step: server auth
confirmation. However, the protocol requires the client send one more
blank line to the server, to which the server then replies with "+OK".
See https://tools.ietf.org/html/rfc5034#section-6.
The code currently only sends a final response if sasl_client_step
returns data to send. Change it to always send a final client message
after the SASL_OK.
Ismaël Bouya [Thu, 20 Oct 2016 12:37:47 +0000 (14:37 +0200)]
notmuch: Add a fake "Folder" header to viewed emails
When viewing an email from a virtual folder, you can't tell where the
real email lives. This commit adds a fake header, "Folder:" showing
that location.
Richard Russon [Sun, 23 Oct 2016 17:18:08 +0000 (18:18 +0100)]
Possible fix for random pager crashes.
The crashes have been observed:
- in both local and remote mailboxes
- with/without notmuch
- always are some time has passed
- always have an invalid header pointer
Scenario:
- The Context holds an array of HEADER pointers.
- The pager is given a HEADER to display.
- Time passes and the mailbox changes.
mx_check_mailbox() adds new mails to the end of the Context's array,
calling mx_alloc_memory() if necessary. The Context's totals are
updated by mx_update_context().
The only way a HEADER pointer could become invalid is if they email were
deleted/moved. If we detect this has happened, we leave the pager.
Richard Russon [Mon, 10 Oct 2016 16:03:39 +0000 (17:03 +0100)]
fix updates when pager is open
This is an update to #19 - new-mail doesn't fire if pager open
Issue #19 changed NeoMutt so that it would notify the user of incoming
mail, even when they were in the pager. However, there was one case
where it didn't work -- new mail arriving in the current mailbox.
Richard Russon [Mon, 10 Oct 2016 08:51:05 +0000 (09:51 +0100)]
forgotten-attachment: fix empty regex expression
The original regex was of the form "abc(|def)" to check for both "abc"
and "abcdef". Unfortunately, the regex libraries on BSDs/MacOS don't
like this use of an empty sub-expression.
Expanding the regex to: "(abc|abcdef)" fixes the problem.
Richard Russon [Sun, 9 Oct 2016 10:39:58 +0000 (11:39 +0100)]
merge: upstream fixes (mutt/default)
* Preserve forwarded attachment names in d_filename.
* Updated Czech translation.
* Mark IMAP fast-trash'ed messages as read before copying. (see #3860)
* automatic post-release commit for mutt-1.7.1
Kevin McCarthy [Thu, 6 Oct 2016 19:35:38 +0000 (12:35 -0700)]
Mark IMAP fast-trash'ed messages as read before copying. (see #3860)
Regular copying/saving messages in mutt via a UID COPY first calls
imap_sync_message(). However that function is designed to sync all
flags (including deleted), and so isn't useful for the fast-trash
code.
As an easier solution, instead add a UID STORE to set \\Seen for the
same msgset as the trashed messages.
Kevin McCarthy [Tue, 4 Oct 2016 18:13:24 +0000 (11:13 -0700)]
Preserve forwarded attachment names in d_filename.
When forwarding an attachment with an non-ascii name, mutt_copy_body()
mangles the filename when calling mutt_adv_mktemp. Preserve
the original attachment filename in d_filename.
Remove the double copy of b->filename, which is a memory leak.
Kevin Velghe [Sun, 14 Aug 2016 22:24:20 +0000 (00:24 +0200)]
notmuch: Synchronise tags to flags
Currently, flags are synced to tags, but the reverse isn't true. If you
mark a mail as unread "the mutt way", you'll be able to find this mail
using tag:unread, however if you remove the tag unread, the flags aren't
adjusted, and it's still marked unread in mutt.
This functionality is provided by notmuch, but means that any mail has
to be synced to disc when the labels are modified, which conflicts with
the way synchronisation to disk works in mutt.
To solve this properly, it's best to just check if the changes performed
in the tags involve some flags handled by mutt, and if so, update the
header in mutt. When mutt syncs to disc, the flags will be adjusted on
disc as well.
Some remarks:
- The parsing code is currently duplicated. I'll fix this.
- The labels are currently hard-coded. It seems like notmuch doesn't
allow customisation of these labels, but mutt-kz does for unread.
- The draft and passed labels are currently ignored, as they aren't
handled by mutt.
Richard Russon [Thu, 6 Oct 2016 14:01:20 +0000 (15:01 +0100)]
fix: crash handling keywords/labels
When an email is read by NeoMutt the labels are stored in linked list of
strings. These strings are used as keys in a hash table of all labels.
If NeoMutt reads another email with the same label, it's given a
reference to the same hash.
Now imagine that the first email is deleted -- the list of labels is
also deleted, so that hash now has invalid keys.
This commit maintains a linked list of all labels and uses that for the
hash table keys. It's not very efficient, but it avoids having to
change the hash table code.
Note: dgc (the keywords author) has created a new version which will
supplant this one, soon.
Richard Russon [Sun, 2 Oct 2016 15:05:55 +0000 (16:05 +0100)]
merge: upstream fixes (mutt/default)
* Fix gpgme segfault when querying candidates with a '+' in the address. (closes #3873)
* Use body color for gpgme output. (closes #3872)
* Check for NULL mx_ops in mx.c
* Mark some gpgme pgp menu keybinding translations as fuzzy. (closes #3874)
* Don't abort the menu editor on sigwinch. (closes #3875)
* Clear pager position when toggling headers.
* Reset invalid parsed received dates to 0. (closes #3878)
* RFC2047-decode mailto header values. (closes #3879)
* RFC2047-decode mailto url headers after RFC2822 parsing. (closes #3879)
* Ensure signatures exist when verifying multipart/signed emails. (closes #3881).
Kevin McCarthy [Sat, 1 Oct 2016 23:21:59 +0000 (16:21 -0700)]
Ensure signatures exist when verifying multipart/signed emails. (closes #3881).
TAKAHASHI Tamotsu reported that when gpg2 isn't in PATH, the
gpgme_op_verify() won't return an error, but instead will return a
result with no signatures.
verify_one() was only returning an error if a signature actually
failed, so in this case the function was defaulting to returning
success.
Other callers of gpgme_op_verify() check to make sure the
result->signatures exist before processing signatures. Add a check
for verify_one() too.
Kevin McCarthy [Sat, 1 Oct 2016 20:58:35 +0000 (13:58 -0700)]
RFC2047-decode mailto url headers after RFC2822 parsing. (closes #3879)
Commit 55819a7e6169 performed the RFC2047 decode before the parsing.
This works okay for headers such as subject, but for others such as
address fields could lead to parsing errors.
Change to perform a decode on envelope headers after all the calls to
mutt_parse_rfc822_line(), using the same list of fields as
mutt_read_rfc822_header().
Change the do_2047 parameter of mutt_read_rfc822_line() to true, so
that user headers are decoded if needed.
Kevin McCarthy [Sun, 25 Sep 2016 20:11:03 +0000 (13:11 -0700)]
Reset invalid parsed received dates to 0. (closes #3878)
The actual problem in the ticket would be solved by d3f31cf9239e (see
#3798). However there is still the bug that Mutt considers a
(hdr->received != 0) to be set and usable, despite not checking the
return value of mutt_parse_date().
Change mutt_read_rfc822_header() to unset an invalid received value
back to 0. We don't do this inside mutt_read_rfc822_line() because
that would cause the next received line to be parsed.
Kevin McCarthy [Fri, 23 Sep 2016 23:07:36 +0000 (16:07 -0700)]
Clear pager position when toggling headers.
It doesn't make sense to try to preserve the pager position when
toggling headers: the purpose of toggling headers is to see the
headers in full or weeded state. So, reset the position back to the
top.
Kevin McCarthy [Thu, 22 Sep 2016 21:07:18 +0000 (14:07 -0700)]
Don't abort the menu editor on sigwinch. (closes #3875)
getch() will return ERR on sigwinch when timeout() is called with a
positive value. mutt_getch() will therefore return ch==-2 for both a
timeout and a sigwinch in this case.
The imap code in km_dokey() exits out of the ImapKeepalive loop for a
SigWinch, and was skipping past the check for MENU_EDITOR and
tmp.ch==-2. Move this check below the gotkey: label so the
ImapKeepalive loop behaves the same as the Timeout code.
Thanks to nicop for reporting the problem and for the initial patch!
Antonio Radici [Thu, 22 Sep 2016 01:10:33 +0000 (18:10 -0700)]
Mark some gpgme pgp menu keybinding translations as fuzzy. (closes #3874)
Some translations for crypt-gpgme.c are marked as fuzzy but the keybindings
attached to these translations are not, this creates confusions for the users
who see the english message but have the keybindings for a message in their own
language available.
As long as the translations are fuzzy, the keybindings should stay fuzzy.