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 <>
Correct capitalization in quoted_reply
Add some defaults for template options
Add Templates with Parsing

+ Changes NewComposer to return error.
+ Add lib to handle templates using "text/template".
+ Add -T option to following commands
    - compose.
    - reply
    - forward
+ Quoted replies using templates.
+ Forwards as body using templates
+ Default templates are installed similar to filters.
+ Templates Config in aerc.conf.
    - Required templates are parsed while loading config.
+ Add aerc-templates.7 manual for using template data.
widgets/msgviewer: Don't crash if pager is nil

Signed-off-by: Kevin Kuehler <>
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.
331b9151 — Luke Drummond 16 days ago
Add support for AUTH LOGIN submission

`go-sasl` upstream added support [1] for the obsolete [2] AUTH LOGIN
method which enables aerc to send email via servers which remain common
in the wild.

Fixes ~sircmpwn/aerc2#263

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.
widgets/msgview: Reap the filter command

The filter command shells out and returns almost immediately. Call
Wait() so the filter process gets reaped. Prior to this patch, aerc
creates a zombie process for every email that is viewed.

Signed-off-by: Kevin Kuehler <>
Cleanup pager processes after closing a msgviewer

A pager is spawned every time an email is viewed but not killed off when
quitting the msgviewer, thus leading to process leakage. This patch
fixes this by adding a Close method to the msgview widget, which is
called in the close command.

Signed-off-by: Kevin Kuehler <>
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

token_endpoint is not required as it will use the provided
password as access_token when it is not set
lib/msgstore: fix invalid callback invocation

creating a directory must not invoke the callback, as this is meant for the
completion of the move
Fix tab refocus on remove

Previously removing a tab would always pop from the history of tabs.
This checks to see if the closing tab is the one selected, if it is then
we use the history, otherwise we only need to change the selected tab if
it was after (to the right of) the closing tab, in which case we just
decrement the selected index.
Fix pushing invalid tabs to history

A tab can now only be pushed onto the history if it is a selectable tab.
Revert "Show spinner when fetching contents"

This reverts commit 1339faf7881f33762c6e0a4915404e362fc51de1.
Preserve sorting order in search results

This ensures that the search results follow the order of the current
sort so that cycling throught the results proceeds in displayed order.
Show spinner when fetching contents

The spinner should be shown when fetching the contents as we don't know
at that point whether there are some messages or not.
Fix selected account to return for messageviewer

This ensures that the selectedaccount is returned if currently selected
tab is a messageviewer. This also makes it more extensible for adding
other ways of getting the selected account.
Open mailto links in a new aerc instance if needed.

Aerc tries to open mailto:// links via the socket of the already running aerc

If no socket exists this silently errored out.
This commit starts up a new aerc instance if it can't connect to the socket
(which I think is the most common error) and if not sets up a new aerc instance
and retries to open the compositor.

This fixes by implementing the desired
Print success to socket if no error was thrown

When Reto Brunners patch is applied (which works really well for me), the user gets to see the message
returned by AercServer. Since this is nil if no errors were thrown it
prints "result: <nil>" to the cmd. This patch fixes that by just
returning success instead of the error message when err != nil.