ref: 0.3.0 aerc/worker d---------
Parse Reply-To header while parsing envelope
worker/imap: Fix seqMap race condition

When deleting a message, sometimes FetchDirectoryContents will fire.
FetchDirectoryContents will return a smaller set of UIDs since messages
have been deleted. This operation races with fetching from the seqMap in
client.ExpungeUpdate. Only recreate the seqMap if it can grow so that
messages will continue to be expunged.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
Notmuch: be resilient to config errors

Right now notmuch panics if something goes wrong in the configure event.
This patch checks for that and returns an error instead, so that we can at least
get the UI up and running (and all the other accounts)

The experience will be completely degraded until another configure event occurs.
notmuch: ignore comments and blank lines when processing query-map file

A segmentation fault occurs when using the notmuch backend and a `query-map`
file that contains blank lines or comments.
Fix: oauthbearer runtime error

Configure an oauthbearer source without a token_endpoint
parameter would panic due to nil pointer dereference

    source-cred-cmd=pass oatuh2 frode.aa@gmail.com

token_endpoint is not required as it will use the provided
password as access_token when it is not set
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.
notmuch: add sort functionality
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.
Add basic searching to the maildir backend

Basic searching is supported with the following:
- read messages
- unread messages
- from addresses
- text in body
- text in subject
- text in all

The implementation loops through all messages in the selected directory.
It tries to be smart by detecting which parts of each message the search
query needs to use and only loads these from the filesystem.
notmuch: implement ModifyLabels
notmuch: sync maildir flags

Syncs back special notmuch tag like unread to the underlying maildir store
notmuch: extract all notmuch db operations.

For some reason the current code frequently segfaults due to an
invalid C memory address. This commit mediates that by never keeping an object
alive longer than absolutely necessary.
Add modify-labels command

This adds the event type as well as the command implementation, but no backend
supports it yet.
Add new search behaviour for imap

This patch adds search behaviour to allow searching in the body of the
messages, the entire text (body + header), and searching just the from
all: rewrite references to strings.Index to strings.Contains

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
notmuch: add search / filter capabilities
extract search criteria parsing into the backends
Notmuch: use adhoc write connection.

Notmuch only allows a single write connection, all other clients trying to
modify the db block. Hence we should only open one when we actually need it.

Apparently we also need to refresh the RO DB connection upon modification,
else we get stale message tag results
imap worker: do not copy mailbox status mutex

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
maildir: Preserve flags when copying messages