ref: 1687e558d3fae4d5622677c031bb9365a8c3e261 aerc/worker/maildir d---------
notmuch/maildir: remove double emit of the dirinfo

There was some bug which could be worked around by double emitting an event.
However that proofed to be brittle:

We send the first message here from the worker goroutine:

Then Tick() is waked in the main goroutine and calls ProcessMessage:

ProcessMessage in the main goroutine reads types.Message state with
msg.getId() and msg.InResponseTo():

Meanwhile in the worker goroutine we call PostMessage for a second
time with a pointer that points to the *same* previous message that
ProcessMessage is reading:

The second PostMessage call makes writes to message while
ProcessMessage in the main goroutine is possibly reading:

This led to a data race in the event loop

Reported-By: Wagner Riffel <w@104d.net>
maildir: don't read the full file into memory
Add support for :rmdir

The `:rmdir` command removes the current directory (`-f` is required if
the directory is not empty).

This is not supported on the notmuch backend.

An issue with the maildir backend is that some sync programs (e.g.
offlineimap) may recover the directory after it is deleted.  They need
to specifically be configured to accept deletions, or special commands
need to be executed (e.g. `offlineimap --delete-folder`) to properly
delete folders.

A danger of using this on the IMAP backend is that it is possible for a
new message to be added to the directory and for aerc to not show it
immediately (due to a slow connection) - using `:rmdir` at this moment
(with `-f` if the directory already contains messages) would delete the
directory and the new message that just arrived (and all other
contents).  This is documented in aerc(1) so that users are aware of
possible risks.
maildir: Provide nicer error message on invalid url

If accounts.conf contains an invalid maildir url, return a nice
error instead of panicking.

Log a couple of different error cases to provide extra
information about the error to the user.
Remove hard coded bodystruct path everywhere

Aerc usually used the path []int{1} if it didn't know what the proper path is.
However this only works for multipart messages and breaks if it isn't one.

This patch removes all the hard coding and extracts the necessary helpers to lib.
494bd674 — Tobias Wölfel 1 year, 1 month ago
Add flag based search options

Provide search and filter with the option to specify more flag based
Use '-x <flag>' to search for messages with a flag (seen, answered,
flagged) and '-X <flag>' to search for messages without a flag.
Only send directory info once from maildir

The directory info only needs to be sent once for all the messages, this
reduces unnecessary messages being sent which could lock up the ui.
Add additional flagging functionality

More mail flags can now be set, unset, and toggled, not just the
read/seen flag.

This functionality is implemented with a new `:flag` and `:unflag`
command, which are extensions to the matching `:read` and `:unread`
commands, adding support for different flags.  In fact, the
`read`/`unread` commands are now recognized aliases to `flag`/`unflag`.
The new commands are also well documented in aerc(1).

The change mostly extends the previous read/unread setting functionality
by adding a selection for the flag to change.
Set AnsweredFlag on successful reply
maildir: remove read handling from FetchMessageBodyPart
9a520c40 — Grégoire Delattre 1 year, 4 months ago
Allow maildir subdirectories
Count recent messages in maildir exists total too
Mark sent messages as "seen" in maildir

- Add maildir flags to complement a messages imap flags
- Set the "seen" flag on sent messages when using the maildir backend
- Cleanup AppendMessage interface to use models.Flag for both IMAP and
Update DirectoryInfo handling for maildir

This ensures that the directory info is up to date on events in the
maildir worker. This also sets up the initial dirinfo for other
directories and updates them when using built-in commands.

FS events are still only watched for the selected directory. This should
be changed in a future patch to watch other directories too in order to
cover UI updates for folders when an event occurs in a non-selected
Make search more lenient

When we fail to read a single message we don't need to fail the whole
search, just log the error and we can still get results back.
Ensure new directory exists before unwatching old
Add labels to index format (%g)

Exposes the notmuch tags accordingly, stubs it for the maildir worker.
Change search flags

This changes the search flags for maildir and imap backends.

They now no longer use -t for searching all text. This seems to make
more sense as being the targeted recipient. I have similarly added Cc
for -c. The text search now resides under -a for all text.
Add sorting functionality

There is a command and config option. The criteria are a list of the
sort criterion and each can be individually reversed.

This only includes support for sorting in the maildir backend currently.
The other backends are not supported in this patch.
Add directory info messages

This populates the directory info model properly when requested,
allowing the fields to be relied upon elsewhere.

This also sends the dirinfo when new messages come in.