msg/reply: fix address comparison
Compare self address in lowercase, to avoid self-replying when people
put in uppercase versions of the mail.
Reported-By: helby on Freenode
notmuch: refresh dirlist in background
notmuch: emit DirInfo upon request
notmuch: add internal event loop
Request DirInfo whenever the unread count may have changed
Actions such as read / unread or the addition of new messages do change
the read/unread/recent count. Hence we request an update from the workers.
Workers going over the network should probably cache the information and invalidate
it only if necessary
dirlist: actually honor the DirInfo
Currently the dirlist ignores the counts provided by the dirInfo.
However some of the workers can actually provide accurate counts much quicker
than if we count the flags.
Eventually we will also want to enable displaying counts for background folders,
where the brute force counting won't work as none of the headers are fetched yet.
This commit models it in an opt-in manner, if the flag isn't set then we still
count the messages manually.
Only fetch the directory contents when we are switching directories
Previously, sending a DirectoryInfo assumed that a directory change
happened. However we don't want that if we only want to update the
unread message count.
imap: fix double closing idleStop
The idle restart code is at the end of handleMessage in the worker.
However if an unsupported msg comes in, we returned early, skipping the re-init.
That lead to a crash due to double closing idleStop in the next iteration.
notmuch: avoid stale DBs
Opening a notmuch DB gives you a snapshot of the stage at that specific time.
Prior to this, we only reopened the DB upon writing.
However, if say a mail sync program like offlineimap is fetching new mail,
we would never pick it up.
This commit caches a db for a while, so that we don't generate too much overhead
and does a reconnect cycle after that.
I hardcoded a value as I don't think that having an option would be beneficial.
Any write operation (meaning reading mail) anyhow flushes the DB by necessity.
(we need to close to commit tag changes, which changing the read state is)
lib: fix an out of bounds panic in the server
If the message doesn't contain ':', we don't properly discard the
message, so we end up slicing it like msg[:-1].
This can be reproduced if one runs 'aerc foo', as the server receives
'foo' as the message.
'aerc foo' still doesn't do anything very user friendly, but at least it
doesn't panic horribly.
While at it, do the 'got message' log at the very beginning, so that the
user can see what message the server got before reporting the command as
Signed-off-by: Daniel Martí <email@example.com>
Fix typo in message view section
Ensure we aren't selecting negative directories
When the list of directories is empty trying to navigate in the
directory list did previously lead to a crash. With this change we
instead return early before trying to change the directory.
> panic: runtime error: index out of range [-1]
> goroutine 1 [running]:
> git.sr.ht/~sircmpwn/aerc/widgets.(*DirectoryList).NextPrev(0xc000160680, 0xffffffffffffffff)
> source/aerc/widgets/dirlist.go:285 +0xd4
> git.sr.ht/~sircmpwn/aerc/commands/account.NextPrevFolder.Execute(0xc000191040, 0xc00025c210, 0x1, 0x1, 0x0, 0xc00016f420)
> source/aerc/commands/account/next-folder.go:44 +0xe0
> git.sr.ht/~sircmpwn/aerc/commands.(*Commands).ExecuteCommand(0xc0000101a8, 0xc000191040, 0xc00025c210, 0x1, 0x1, 0xc000020070, 0xb46d01)
> source/aerc/commands/commands.go:66 +0xa7
> main.execCommand(0xc000191040, 0xc0001ca190, 0xc00025c210, 0x1, 0x1, 0xc00025c210, 0xc0003fb080)
> source/aerc/aerc.go:60 +0xc7
> main.main.func3(0xc00025c210, 0x1, 0x1, 0x1, 0x1)
> source/aerc/aerc.go:162 +0x57
> git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).BeginExCommand.func1(0xc000201db0, 0xb)
> source/aerc/widgets/aerc.go:382 +0x83
> git.sr.ht/~sircmpwn/aerc/widgets.(*ExLine).Event(0xc0003be100, 0xb475a0, 0xc00023cba0, 0xc00023cba0)
> source/aerc/widgets/exline.go:79 +0x131
> git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Event(0xc000191040, 0xb475a0, 0xc00023cba0, 0x99ee01)
> source/aerc/widgets/aerc.go:202 +0x4c1
> git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).simulate(0xc000191040, 0xc000036f00, 0xd, 0x10)
> source/aerc/widgets/aerc.go:195 +0x8d
> git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Event(0xc000191040, 0xb475a0, 0xc00023c9c0, 0x9c5a60)
> source/aerc/widgets/aerc.go:218 +0x3e8
> git.sr.ht/~sircmpwn/aerc/lib/ui.(*UI).Tick(0xc0001ca190, 0xa99d00)
> source/aerc/lib/ui/ui.go:92 +0x190
> source/aerc/aerc.go:192 +0x5f2
worker/lib/parse: be more tolerant with parsing email addresses
dirlist: adapt to dynamic UIconfig
dirlist: remove not needed sort function
The docs of strings.Compare state:
> Compare is included only for symmetry with package bytes. It is usually
> clearer and always faster to use the built-in string comparison operators
> ==, <, >, and so on.
So let's do that.
config: Strongly type context type
The go compiler can't help much with untyped int constants.
Even though the only valid constants are 0-3 it will happily accept 4 as input.
Let's let the go compiler worry about correctness here. This also allows people
not very familiar with the code to use it properly via auto completion.
imap: emit messageinfo when changing read state.
We need to emit the changed msgInfo whenever we modify the state
Contextual UI Configuration
+ Adds parsing of contextual ui sections to aerc config.
+ Add GetUiConfig method for AercConfig that is used to get the
specialized UI config.
+ Add UiConfig method to AccountView to get specialized UI Config.
+ Modifies Aerc codebase to use specialized UIConfig instead.
+ Adds documentation for Contextual UI Configuration
Fix handling of multiple template-dirs
Before, while the docs stated that template-dirs was a colon-separated
list, a delimiter was not specified in the struct tag, so it was falling
back to the default for the ini library (a comma). Also added a note to
the docs to clarify that templates are configured in the [templates]