Mehdi Abaakouk [Fri, 9 Nov 2018 14:26:50 +0000 (15:26 +0100)]
imap: when opening mailbox, reset Mailbox attrs
We currently only reset vcount and msg_count.
But imap_read_headers() call from imap_mbox_open() reload all
messages and then call mx_update_context(). So attributes that have not
been reseted will grow from previous values.
This does the reset of size, msg_unread, msg_flagged, msg_new.
Austin Ray [Tue, 6 Nov 2018 02:02:09 +0000 (21:02 -0500)]
browser: search on description if it exists
The browser searches on mailbox paths; however, with the introduction of
`named-mailboxes` and merging of `virtual-mailboxes`, it is necessary to
search of descriptions. If not, it may be impossible to find a mailbox
that is named.
For example, if we have `named-mailboxes "Test" "+work"` and searched
for "Test", it would not match because the path does not contain "Test".
Searching "work" would match the "Test" mailbox.
This commit modifies `select_file_search(...)` to use the description if
one exists. This way we can properly match searches for
`named-mailboxes` and `virtual-mailboxes` without know their underlying
mailbox paths.
Mehdi Abaakouk [Tue, 6 Nov 2018 21:48:59 +0000 (22:48 +0100)]
imap: add missing free_edata pointer
imap sometimes crashes when changing folder or quiting neomutt.
#1 0x000055555563833f in mutt_email_free (e=0x555555b0cb50) at email/email.c:55
#2 0x00005555555bb4e9 in mx_fastclose_mailbox (ctx=ctx@entry=0x555555980050) at mx.c:407
#3 0x00005555555bd593 in mx_mbox_close (pctx=0x5555558a69b0 <Context>, index_hint=index_hint@entry=0x7fffffffa074) at mx.c:727
...
This change adds the missing free_edata pointer to imap_free_edata.
Austin Ray [Fri, 2 Nov 2018 18:02:25 +0000 (14:02 -0400)]
format: use description by default
Changes the default of status_format and folder_format to display
descriptions instead of file path.
With the inclusion of named-mailboxes, we should try to use descriptions
since they fall back to file path. Otherwise, there would not be a
distinction between mailboxes and named-mailboxes with the defaults.
Austin Ray [Thu, 1 Nov 2018 22:30:33 +0000 (18:30 -0400)]
sidebar: unify virtual-mailboxes
Removed all notmuch specific code from `sidebar.c` This allows for
virtual-mailboxes to appear alongside every other mailbox, and reduces
coupling in sidebar.
In order to facilitate this, the command sidebar-virtual-toggle was
removed as it is no longer necessary. Some users may have utilized this
method so an alternative should be considered.
Austin Ray [Thu, 1 Nov 2018 21:13:13 +0000 (17:13 -0400)]
browser: unify mailboxes and virtual-mailboxes
Merged change-vfolder into change-folder so all mailboxes will be
displayed on the same screen. This removes the special cases needed to
display virtual-mailboxes.
To prevent breaking user's configurations, change-vfolder executes
change-folder. However, since vfolder_format and folder_format have
different default, user's will need to update the format.
Austin Ray [Wed, 31 Oct 2018 00:55:07 +0000 (20:55 -0400)]
notmuch: count flagged messages
`nm_nonctx_get_count(...)` did not count flagged messages. This means
they could not display flagged message counts in the sidebar _unless_ it
was the active mailbox.
This commit introduces NmFlaggedTag, mirrored from NmUnreadTag, and will
query the database for flagged messages.
Austin Ray [Tue, 30 Oct 2018 19:36:23 +0000 (15:36 -0400)]
notmuch: rework progress update math
After architectural changes, NeoMutt was not updating the progress when
opening `virtual-mailboxes`. The math was out of date.
This commit corrects the math involved and removes the unnecessary
counting logic. If counting is necessary, use `nm_nonctx_get_count(...)`
in a future commit.
Austin Ray [Tue, 30 Oct 2018 16:06:33 +0000 (12:06 -0400)]
notmuch: respect limits when counting messages
When NeoMutt counts the number of returned messages for a notmuch query,
it does not consider user specified limits. This affects both `limit=`
and `nm_db_limit` specifications.
This commit modifies `nm_nonctx_get_count(...)` to return the query's
limit if `get_count(...)` exceeds the limit. The check ensures that the
limit is non-zero so we don't return empty mailboxes.
Austin Ray [Mon, 29 Oct 2018 20:26:30 +0000 (16:26 -0400)]
notmuch: use existing open database if possible
When this portion of the code was migrated to use `NmAccountData`
instead of `NmMboxData` the check for an existing database handle was
removed. NeoMutt would lock-up trying to open another instance of the
database.
Austin Ray [Tue, 30 Oct 2018 00:39:20 +0000 (20:39 -0400)]
notmuch: duplicate `uri` during sync
The subsystem reused `ctx->mailbox->path` to store the absolute path for
an email so that it modify the maildir flags. In order to facilitate
this behavior, the subsystem copies the `uri` and uses it to replace the
absolute path after filename modification.
However, the `uri` variable is just a pointer to `ctx->mailbox->path` so
it is overwritten with the physical path.
This commit uses `mutt_str_strdup(...)` to duplicate the `uri` so it can
replace the physical path. Without this duplication, a
`virtual-mailboxes` will lose its notmuch query when modifying tags
corresponding to maildir flags. This results in a `virtual-mailboxes`
disappearing during runtime.
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`.