Ian Zimmerman [Thu, 18 Oct 2018 09:14:21 +0000 (02:14 -0700)]
Try adding status indicator R for my address in Reply-To
It adds a new "R" flag for the 3rd position of the index %Z field, for when user's own address is in the Reply-To header unless none of the other flags for that field is applicable.
Some mailing lists now do the following transformation of the headers: rewrite the From header to the list address, and add a Reply-To header with the poster address. This feature helps highlight my own posts in folders dedicated to such lists. Of course if you are _subscribed_ to the list (in the Mutt sense) you'll get the "L" flag instead, but in that case you don't care about hightlighting your posts anyway.
Austin Ray [Thu, 11 Oct 2018 20:16:02 +0000 (16:16 -0400)]
format: add `%D` - mailbox description
Added the `%D` expando, which displays the mailbox's description, to
sidebar_format and status_format. If the mailbox does not have a
description, fallback to the path.
This behavior is same as `%f` and `%B` for `virtual-mailboxes`. This
was done to prevent breaking existing configurations as `notmuch`
queries have unsightly paths.
This lays the ground work for introducing `named-mailboxes`.
Austin Ray [Thu, 11 Oct 2018 18:18:40 +0000 (14:18 -0400)]
mailbox: try to find existing description
`mx_mbox_open(...)` creates a new `Context`, which requires creating new
`Mailbox` instances. Modified `mailbox_new(...)` to try and find an
existing description that matches the mailbox `path`.
Austin Ray [Thu, 11 Oct 2018 15:38:50 +0000 (11:38 -0400)]
notmuch: count messages in queried threads
`count_query` did not handle counting all messages in `type=threads`
queries. It returned the number of messages matching the `query=`
qualifier. Refactored `count_query` into two methods handling
`type=threads` and `type=messages`, respectively.
This makes `sidebar_format`'s `%S` display the same value as
`pager_format`'s `%m`.
Richard Russon [Wed, 10 Oct 2018 22:10:59 +0000 (23:10 +0100)]
merge: upstream fixes
* Fix gnutls (a)lways to properly save for all certerr values.
* Change gnutls certificate_file processing and interactive prompts.
* Add a comment about gnutls date bits in certstat.
Kevin McCarthy [Tue, 9 Oct 2018 21:39:09 +0000 (14:39 -0700)]
Change gnutls certificate_file processing and interactive prompts.
Accept a saved cert at any point in the chain, except for those
revoked or with invalid dates.
The INSECUREALG processing was a bit goofed up. It was skipping the
prompt for every chain except the host, and was only displaying an
error for entry 1 (the host being 0, root being len-1). Instead
prompt at any point, and display a warning as with the other errors.
Add a CERTERR_OTHER type to capture other bits. Recently GnuTLS has
added additional certificate_status_t types. We may want to improve
the prompts in the future for those, but for now at least make sure
it's recorded in certerr.
Kevin McCarthy [Tue, 9 Oct 2018 20:28:15 +0000 (13:28 -0700)]
Fix gnutls (a)lways to properly save for all certerr values.
For the case of SIGNERNOTCA, INSECUREALG, or a newer unhandled value,
the "(a)ccept always" prompt was allowed, but the cert saving was
prevented by a check only against NOTTRUSTED. This ended up giving a
strange error message saying the cert was not saved.
Fix to save the cert for all errors except HOSTNAME (which is handled
separately).
Richard Russon [Tue, 9 Oct 2018 14:32:46 +0000 (15:32 +0100)]
merge: upstream refactoring
* Add buffer pool functions.
* Convert imap_rename and pgp_invoke_list_keys to use buffer pool.
* Create mutt_buffer_add_printf().
* Convert mix_send_message to use buffer pool.
* Convert buffy_maildir_check_dir to use struct Buffer.
* Convert maildir_parse_dir to use struct Buffer.
* Convert _maildir_commit_message to use struct Buffer.
* Convert maildir_sync_message to use BUFFERs.
* Convert maildir_canon_filename() and callers to use struct Buffer.
Austin Ray [Sat, 6 Oct 2018 19:55:26 +0000 (15:55 -0400)]
notmuch: simplify uri creation logic
If `mdata` does not exist in `mailbox`, try to create a default instance
of `NmMboxData`. Using a default instance removes two conditionals from
`nm_uri_from_query(...)`, moving them to `nm_get_default_data(...)`.
This reduces the number of `snprintf(...)` to maintain, and allows query
parsing for type meta-data.
An extra variable keeps track of default data usage for freeing
allocated memory.
Josh Poimboeuf [Thu, 31 May 2018 21:58:02 +0000 (16:58 -0500)]
notmuch: use global settings for vfolder-from-query
When the <vfolder-from-query> command is run while already in a vfolder,
it takes the current vfolder as context. That means the global settings
(nm_query_type, nm_db_limit, nm_default_uri) are ignored in favor of the
current vfolder's settings. This is confusing behavior because the new
vfolder is otherwise independent from the old one.
Set the nm_uri_from_query() context to NULL so that it uses the global
settings instead.
Austin Ray [Sat, 18 Aug 2018 22:15:38 +0000 (18:15 -0400)]
Notmuch: Parse `type=` statements from query
Implemented a function that will parse `type=` statements from a notmuch
query and set the appropriate query type in `NmCtxData`.
This change allows a user to change the query type for a single query
without affecting other queries. The primary use is for executing
`vfolder-from-query`.
This commit ensures notmuch integration behavior conforms to NeoMutt's
notmuch documentation.
Austin Ray [Sat, 18 Aug 2018 22:14:04 +0000 (18:14 -0400)]
Implement substring removal function
Implemented a method that removes all instances of a substring from a
given string. The method has protections against trying to remove a
non-existent substring.
Austin Ray [Sat, 18 Aug 2018 21:21:14 +0000 (17:21 -0400)]
Implement case-insensitive substring search
Implemented a portable case-insensitive substring search since the C
standard does not provide one. A C implementation may include one as an
extension, but there is no way to ensure portability.
This implementation does a byte-by-byte in-place comparison so it will
return unspecified results for multibyte locales.
Included alongside this implementation are tests for NULL input, empty
string inputs, non-existent needles, and different size haystacks.
Austin Ray [Wed, 22 Aug 2018 03:06:17 +0000 (23:06 -0400)]
Notmuch: Change default window to be open ended
Change the default query window to be open ended, allowing for mail
from the future to appear in a query. This may occur if the sender's
time settings are improperly configured.
Richard Russon [Mon, 1 Oct 2018 22:34:23 +0000 (23:34 +0100)]
merge: upstream fixes
* Increase buffer sizes for some IMAP commands.
* Change imap_rename_mailbox to use a BUFFER.
* Convert pgp_invoke_list_keys and mix_send_message to use BUFFERs.
Kevin McCarthy [Fri, 28 Sep 2018 22:08:19 +0000 (15:08 -0700)]
Convert pgp_invoke_list_keys and mix_send_message to use BUFFERs.
Both repetitively perform a lot of copying back in forth, which is
much cleaner with a BUFFER.
Note that in pgp_invoke_list_keys, if there are no hints uids->data
would be NULL. However, the pgp_invoke() checks and wraps all the
format substitutions with NONULL.
Kevin McCarthy [Fri, 28 Sep 2018 00:29:16 +0000 (17:29 -0700)]
Increase buffer sizes for some IMAP commands.
Use to ensure assembled IMAP commands fit in the resultant buffer to
be imap_exec()'ed.
RFC2683 suggested a limit of 1000, but asked servers to accept up to
8000. Furthermore, RFC7162 bumped the client limit suggestion up to
8192. So I don't believe any issues will be caused by this.
Most of these are increases are just to remove theoretical truncation
warned about by the compiler; I don't believe we've had reports of
actual command truncation due to a mailbox 1024 characters long.
Kevin McCarthy [Wed, 26 Sep 2018 02:03:56 +0000 (19:03 -0700)]
Fix non-threaded $sort_aux "reverse-" sorting.
The secondary sort was looking at (Sort & SORT_REVERSE) instead
of (SortAux & SORT_REVERSE), so wasn't even performing the reverse
based on the correct flag.
Additionally, afterwards, the primary sort was improperly applying a
reverse when the secondary sort returned non-zero.
Change SORTCODE() to look at SortAux when we are inside a secondary
sort.
Change AUXSORT() to return the result if the secondary sort returns
non-zero. It is ugly to put a return inside the macro, but the check
for non-zero needs to be performed inside the AUXSORT if branch.
If the secondary sort returns 0, then the primary sort can still
compare index and apply a reverse as needed.
Richard Russon [Tue, 25 Sep 2018 13:03:59 +0000 (14:03 +0100)]
merge: upstream fixes
* Change imap_conn_find() to always return an authenticated conn.
* Free queries and alias_queries before exiting.
* Remove purpose checks in smime_keys.pl verify step.
* Send imap keepalives for interactive filters.
* Add output during smime_keys purpose flag checking.
* Increase user/pass field sizes in auth_login.
Kevin McCarthy [Tue, 18 Sep 2018 02:40:22 +0000 (19:40 -0700)]
Send imap keepalives for interactive filters.
When viewing attachments externally with a (non-copiousoutput) mailcap
entry missing %s, the command is invoked as a filter, with the
attachment piped into stdin. However, unlike a filter, the user
interacts with the command, instead of just displaying the output in
the pager.
Just as with the mutt_system() command, Mutt needs to send imap
keepalives to keep those connections from closing during the
potentially extended invocation.
Thanks to John Hawkinson for the bug report, and his suggested patch,
which this commit is based upon.
Kevin McCarthy [Fri, 14 Sep 2018 21:23:04 +0000 (14:23 -0700)]
Remove purpose checks in smime_keys.pl verify step.
The purpose checks are subsequently performed, and added as a field to
the .index. In any case, it turns out passing multiple '-purpose'
arguments isn't even correct: openssl appears to just use the last
one.
Thanks to David J. Weller-Fahy for reporting the problem, and for
including a possible patch.
Kevin McCarthy [Thu, 13 Sep 2018 01:23:00 +0000 (18:23 -0700)]
Change imap_conn_find() to always return an authenticated conn.
With the flag MUTT_IMAP_CONN_NONEW, it was already ensured the
connection would be authenticated. However, without that flag, an
error in opening the connection or authentication would still return
an idata.
The callers that didn't bother to check the state were still assuming
authenticated, because they were all subseqeuently issuing an
"authenticated state" command to the server.
Rather than add state checks to every caller, just change the function
to return NULL if the idata did not end up in an authenticated state.
Remove the now redundant state checks in imap_open_mailbox() and
imap_get_mailbox().