2797 Commits

Author SHA1 Message Date
Robin Jarry
3273f8071d commands: add settle
Signed-off-by: Robin Jarry <robin@jarry.cc>
2025-09-09 09:18:59 +02:00
Robin Jarry
06a5ead1fc worker: uint64 message ids
Signed-off-by: Robin Jarry <robin@jarry.cc>
2025-09-09 09:18:58 +02:00
Robin Jarry
767287718e workers: rework cancellable
Signed-off-by: Robin Jarry <robin@jarry.cc>
2025-09-09 09:18:18 +02:00
Robin Jarry
1ec34824d3 worker: fix potential race in post action
Signed-off-by: Robin Jarry <robin@jarry.cc>
2025-09-09 09:17:18 +02:00
Robin Jarry
14eef02ecc worker: remove post message callback argument
Signed-off-by: Robin Jarry <robin@jarry.cc>
2025-09-09 09:17:16 +02:00
Robin Jarry
47ed279078 reload: trigger upon SIGHUP signal reception
When receiving the SIGHUP signal, reload all configuration.

Changelog-added: `:reload` is now invoked when `SIGHUP` is received
 by the `aerc` process.
Suggested-by: Anachron <gith@cron.world>
Signed-off-by: Robin Jarry <robin@jarry.cc>
2025-09-08 12:25:42 +02:00
Robin Jarry
0211c9bf23 reload: fix crash when reloading via IPC
When reloading the configuration with :reload, global variables in the
config package are reset to their startup values and then, the config is
parsed from disk. While the parsing is done, these variables are
temporarily in an inconsistent and possibly invalid state.

When commands are executed interactively from aerc, they are handled by
the main goroutine which also deals with UI rendering. No UI render will
be done while :reload is in progress.

However, the IPC socket handler runs in an independent goroutine. This
has the unfortunate side effect to let the UI goroutine to run while
config parsing is in progress and causes crashes:

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6bb142]

goroutine 1 [running]:
git.sr.ht/~rjarry/aerc/lib/log.PanicHandler()
	lib/log/panic-logger.go:51 +0x6cf
panic({0xc1d960?, 0x134a6e0?})
	/usr/lib/go/src/runtime/panic.go:783 +0x132
git.sr.ht/~rjarry/aerc/config.(*StyleConf).getStyle(0xc00038b908?, 0x4206b7?)
	config/style.go:386 +0x42
git.sr.ht/~rjarry/aerc/config.StyleSet.Get({0x0, 0x0, 0x0, {0x0, 0x0, 0x0}}, 0x421a65?, 0x0)
	config/style.go:408 +0x8b
git.sr.ht/~rjarry/aerc/config.(*UIConfig).GetStyle(...)
	config/ui.go:379
git.sr.ht/~rjarry/aerc/lib/ui.(*TabStrip).Draw(0xc000314700, 0xc000192230)
	lib/ui/tab.go:378 +0x15b
git.sr.ht/~rjarry/aerc/lib/ui.(*Grid).Draw(0xc000186fc0, 0xc0002c25f0)
	lib/ui/grid.go:126 +0x28e
git.sr.ht/~rjarry/aerc/app.(*Aerc).Draw(0x14b9f00, 0xc0002c25f0)
	app/aerc.go:192 +0x1fe
git.sr.ht/~rjarry/aerc/lib/ui.Render()
	lib/ui/ui.go:155 +0x16b
main.main()
	main.go:310 +0x997

Make the reload operation safe by changing how config objects are
exposed and updated. Change all objects to be atomic pointers. Expose
public functions to access their value atomically. Only update their
value after a complete and successful config parse. This way the UI
thread will always have access to a valid configuration.

NB: The account configuration is not included in this change since it
cannot be reloaded.

Fixes: https://todo.sr.ht/~rjarry/aerc/319
Reported-by: Anachron <gith@cron.world>
Signed-off-by: Robin Jarry <robin@jarry.cc>
2025-09-08 12:19:51 +02:00
Robin Jarry
5549850fac Release version 0.21.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
0.21.0
2025-08-28 11:34:18 +02:00
Robin Jarry
d26be1c834 mod: update all dependencies
Patch generated by:

	go get -u -t ./...
	go mod tidy

Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Karel Balej <balejk@matfyz.cz>
2025-08-28 11:28:30 +02:00
Robin Jarry
fcf59fecb0 app: improve hook debug logs
Add extra debug logs.

Co-authored-by: Simon Martin <simon@nasilyan.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
2025-08-28 10:19:57 +02:00
Simon Martin
d7b097f317 imap: always consider recently received unread messages as recent
We rely on IMAP's \Recent flag to trigger the new email hook, making it
unreliable since not all providers support that flag (it's been
deprecated in RFC 9051).

This patch implements the following heuristic to force the \Recent flag
on messages, regardless of what the server says, and "fixes" this
inconsistency across providers: a message is always considered having
the \Recent flag if:
 - The IMAP header cache is enabled, and
 - The message is not in the header cache, and
 - It's not marked as read, and
 - It's been received less than `check-mail` in the past

Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-28 10:16:02 +02:00
Karel Balej
bf678f18d0 app: support color scheme change notifications
Some applications may request being notified of changes to the color
scheme of their host terminal so that they could redraw themselves
appropriately. Pass such notifications provided by Vaxis to virtual
terminal widgets that may be open inside aerc to facilitate these
notifications for the applications running in them.

Cc: Tim Culverhouse <tim@timculverhouse.com>
Signed-off-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-28 09:58:16 +02:00
Martin Dosch
1c998d75fa stylesets: add solarized-dark
Add a solarized-dark styleset which is based on the solarized
styleset. It is supposed to better suit terminal emulators which are
configured to use the dark solarized palette.

Signed-off-by: Martin Dosch <martin@mdosch.de>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-28 09:56:54 +02:00
Moritz Poldrack
ef2516a992 account-wizard: show correct configuration path
The account-wizard only shows the default path for the configuration and
does not account for a modified XDG_CONFIG_HOME. Dynamically generate
the message to embed the correct path.

Changelog-fixed: The account wizard now always shows the correct path
 for the account configuration.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-28 09:56:02 +02:00
Moritz Poldrack
d9cd1f6338 doc: document msglist pill as scrollbar
Since pill is ambiguous and an uncommon name for it, mention that the
pill is what is commonly referred to as a scrollbar in the
documentation.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-28 09:55:36 +02:00
Moritz Poldrack
cba509b4da msgviewer: use three dots to indicate an ongoing process
During Review of another patch, this jumped at me and just looked wrong.
Change it to show three dots.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Reviewed-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-28 09:54:44 +02:00
Robin Jarry
13e9ee3b40 lib: vendor-in the jwz library
The maintainer of this library has gone AWOL. We are depending on
a patch that has never been merged. Let's vendor the library to avoid
future issues.

This patch has been made with the following steps:

git clone https://github.com/konimarti/jwz lib/jwz
git -C lib/jwz checkout fix-missing-messages
mv lib/jwz/test/testdata/ham lib/jwz/testdata
sed -i 's#test/testdata#testdata#' lib/jwz/jwz_test.go
rm -rf lib/jwz/.* lib/jwz/docs lib/jwz/examples lib/jwz/test
sed -i 's#github.com/gatherstars-com/jwz#git.sr.ht/~rjarry/aerc/lib/jwz#' \
	lib/threadbuilder.go
go mod tidy
git add --intent-to-add lib/jwz
make fmt

Along with some manual adjustments to fix the linter warnings. Also, to
make the patch smaller, I only kept 93 test emails from the test data
fixture.

Changelog-changed: The JWZ library used for threading is now vendored.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
2025-08-28 09:28:16 +02:00
Robin Jarry
abe5bb884b viewer: prevent crash when headers are nil
Prevent the following error from happening:

Error: runtime error: invalid memory address or nil pointer dereference

panic({0x11206c0?, 0x18dd700?})
	runtime/panic.go:792 +0x132
git.sr.ht/~rjarry/aerc/lib/auth.New.CreateParser.func1(0x0, {0x0, 0x0, 0x0})
	                                               ^^^
	git.sr.ht/~rjarry/aerc/lib/auth/auth.go:77 +0xdb
git.sr.ht/~rjarry/aerc/app.NewMessageViewer.func2(...)
	git.sr.ht/~rjarry/aerc/app/msgviewer.go:93 +0x517
git.sr.ht/~rjarry/aerc/app.HeaderLayout.grid(...)
	git.sr.ht/~rjarry/aerc/app/headerlayout.go:39 +0x19e
git.sr.ht/~rjarry/aerc/app.NewMessageViewer(...)
	git.sr.ht/~rjarry/aerc/app/msgviewer.go:72 +0x185
git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute.func1(...)
	git.sr.ht/~rjarry/aerc/commands/account/view.go:68 +0x95
git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView.func1(...)
	git.sr.ht/~rjarry/aerc/lib/messageview.go:80
git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView(...)
	git.sr.ht/~rjarry/aerc/lib/messageview.go:127 +0x3e5
git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute(...)
	git.sr.ht/~rjarry/aerc/commands/account/view.go:57 +0x3c5
git.sr.ht/~rjarry/aerc/commands.ExecuteCommand(...)
	git.sr.ht/~rjarry/aerc/commands/commands.go:218 +0x73d
main.execCommand(...)
	git.sr.ht/~rjarry/aerc/main.go:45 +0x69
git.sr.ht/~rjarry/aerc/app.(*Aerc).BeginExCommand.func1(...)
	git.sr.ht/~rjarry/aerc/app/aerc.go:645 +0x5e
git.sr.ht/~rjarry/aerc/app.(*ExLine).Event(...)
	git.sr.ht/~rjarry/aerc/app/exline.go:92 +0xb82
git.sr.ht/~rjarry/aerc/app.(*Aerc).Event(...)
	git.sr.ht/~rjarry/aerc/app/aerc.go:344 +0x87e
git.sr.ht/~rjarry/aerc/app.(*Aerc).simulate(...)
	git.sr.ht/~rjarry/aerc/app/aerc.go:315 +0x2ae
git.sr.ht/~rjarry/aerc/app.(*Aerc).Event(...)
	git.sr.ht/~rjarry/aerc/app/aerc.go:377 +0xc45
git.sr.ht/~rjarry/aerc/lib/ui.HandleEvent(...)
	git.sr.ht/~rjarry/aerc/lib/ui/ui.go:188 +0x5e9
main.main()
	git.sr.ht/~rjarry/aerc/main.go:298 +0x11b4

Do not try to build an auth header set if the message headers are nil.

Reported-by: Moritz Poldrack <moritz@poldrack.dev>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Simon Martin <simon@nasilyan.com>
2025-08-05 11:52:47 +02:00
Nilesh Patra
d635e5a3da mk: use SOURCE_DATE_EPOCH if available to set DATE
SOURCE_DATE_EPOCH is a standard environment variable set by
distributions so build tools can consume it to generate reproducible
binaries.

Link: https://reproducible-builds.org/docs/source-date-epoch/
Signed-off-by: Nilesh Patra <nilesh@riseup.net>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:51:58 +02:00
Jakub Růžička
1996098b9d ui: list exact matches first when filtering
If the fuzzy-complete option is used, then list strings containing exact
match first followed by the fuzzy matches.

Changelog-changed: Results of filtering when `fuzzy-complete` is
 enabled list exact matches first.
Signed-off-by: Jakub Růžička <jakub.ruzicka@matfyz.cz>
Tested-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:48:51 +02:00
Moritz Poldrack
4d57c0157c unsubscribe: validate DKIM signatures before parsing unsubscribe links
According to RFC 8058, a List-Unsubscribe header must have a valid DKIM
signature. This is currently not checked for.

Implement a DKIM check before acting upon a subscribe link.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:48:13 +02:00
Moritz Poldrack
b1dca58421 unsubscribe: autoselect method if only one is available
If there is only one option to unsubscribe, select that method
automatically.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:48:10 +02:00
Moritz Poldrack
20443b89fe unsubscribe: properly send unsubscribe requests
According to RFC 8058, links in the List-Unsubscribe headers should have
a POST request sent to them. This is not possible in the current setup,
as links are only opened in a browser.

Change the default behaviour to match the RFC and keep an "Open in
Browser" option for non-compliant senders.

Link: https://datatracker.ietf.org/doc/html/rfc8058
Changelog-fixed: `:unsubscribe` now follows RFC 8058.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:47:53 +02:00
chupson
084b71d12f binds: throw error on unknown modifier key
Throw an error when a binding with an unknown modifier key is defined.
Previously, when a binding was defined using an unknown modifier (for
example <M-s>) aerc would return no errors and function as if that
binding was defined without the unknown modifier (`<M-s>` would act like
`s`)

Signed-off-by: chupson <chupson@chupson.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:47:08 +02:00
Erin John
f0769d3309 compose: read VISUAL before EDITOR
Historically UNIX programs read VISUAL before EDITOR. The former
is to be set to a screen editor like 'vi' and the latter to a line
editor like 'ed'.

Aerc should correctly read VISUAL first if both are defined.

Signed-off-by: Erin John <unrealapex@disroot.org>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:47:07 +02:00
Moritz Poldrack
fc5b6896ff chore: switch to using stdlib helper functions
Go has evolved significantly over the years and has introduced some
handy helper functions that make the code easier to read.

Use helper functions like slices.Contains, map.Copy, and
strings.CutPrefix, when appropriate.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:47:05 +02:00
Simon Martin
7df7d31e40 imap: consistently fetch gmail labels and improve logging
The various handleFetchXYZ functions do not consistently request
X-GM-LABELS when interacting with GMail, and the in-memory "label state"
can easily get out-of-sync with the server.

This patch fixes this, and also ensures that we only log that we're
attaching a label to a message when we actually do (and if so, puts the
account name in the log line).

Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:27:30 +02:00
Simon Martin
96ed6a9505 imap: add support for :modify-labels / :tag for gmail and proton
As part of my effort to properly support labels in IMAP for providers
that have this notion, this patch takes care of the case of GMail and
Proton, and gracefully errors for all others.

To do so, it detects the actual provider we're connected to by analyzing
the target URL, and implements label addition / removal (toggling is not
supported right now [1]) according to the documentation:
 - For GMail, it leverages the IMAP STORE command.
 - For Proton, it leverages moving the message across (virtual) folders.

[1] There's nothing fundamental preventing supporting toggling, but
getting the current "label state" from there in the code is not trivial.
It could be done in a second step if there's demand).

Changelog-added: Support :modify-labels command for GMail and Proton.
Signed-off-by: Simon Martin <simon@nasilyan.com>
Tested-by: Jan Černohorský <jan@grsc.cz>
Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:27:27 +02:00
Karel Balej
7ec71db2d6 app: handle Vaxis FocusIn and FocusOut events
Pass the focus changes to the content of the currently active tab if it
wants to be notified of them.

Signed-off-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:03:46 +02:00
Tim Culverhouse
784ea1c1b5 deps: update vaxis to v0.14.1
Update to latest Vaxis tag, which includes support for focus events in
the terminal widget.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-08-04 12:03:42 +02:00
GregTheMadMonk
d31995f1e2 ui: implement C-left/C-right cursor controls for textinput
When typing inside textinput, Ctrl+Left places the cursor at the start
of the current word, and Ctrl+Right goes to the start of the next one.

Ctrl+Left uses the same code `deleteWord()` function used (which is now
split into a separate function), and Ctrl+Right uses similar lookup in
the other direction.

Implements: https://todo.sr.ht/~rjarry/aerc/231
Signed-off-by: GregTheMadMonk <yagreg7@gmail.com>
Tested-by: skejg <grolleman@zoho.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-30 11:05:30 +02:00
Moritz Poldrack
16c8e869a2 make: dump core on development build crash
During development, generating coredumps can be very helpful when
debugging crashes. Add runtime environment variable to dev target to
dump core by default on dev builds.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-25 16:46:42 +02:00
Simon Martin
9a967f1795 imap: always use negotiated x-gm-ext-1 value
While it negotiates the X-GM-EXT-1 capability with GMail, aerc defaults
to not using it because the use-gmail-ext configuration knob defaults to
false.

This patch simply dismantles that knob, so that GMail users always
benefit from all its capabilities.

Changelog-added: Always use `X-GM-EXT-1` extension if negotiated
 with GMail.
Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-25 16:46:15 +02:00
Moritz Poldrack
4c294387d2 mark: make recipient switch target all recipients
Contrary to popular belief, not all recipients of a mail are listed in
it's To: header. They may also be included in the Cc: or Bcc: headers.
Include them in the list when filtering.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-20 09:36:52 +02:00
Jan Černohorský
0fc3481862 imap: add rudimentary readonly support for labels in gmail
Use the GMail IMAP extension to fetch labels for messages when
use-gmail-ext is enabled. Labels are automatically fetched when fetching
headers for a message and when fetching flags for a message. They should
be correctly cached.

Link: https://developers.google.com/workspace/gmail/imap/imap-extensions
Changelog-added: Readonly support for GMail labels.
Signed-off-by: Jan Černohorský <jan@grsc.cz>
Tested-by: Vojtěch Káně <vojta001@vkane.cz>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-20 09:30:44 +02:00
Jörg Thalheim
d9a1acf27a pipe: add support for piping messages in compose review mode
Allow piping composed messages that are about to be sent in the compose
review mode. This enables users to process or inspect messages before
sending them.

Update documentation to reflect this new capability.

Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-20 09:02:01 +02:00
Jörg Thalheim
ca9be2ba9a pipe: refactor to move out doExec/doTerm functions
Move doExec and doTerm functions to package level. Both functions now
accept parameters for command, reader, name, and callback. doTerm
additionally accepts a silent flag.

This refactoring is a preparation to add COMPOSE_REVIEW to the supported
contexts.

Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-20 09:02:01 +02:00
inwit
7b841edb90 forward: allow cross-account forwarding
When forwarding an email using edit-headers=true, using :switch-account
alone is not enough to properly switch the account since you have to
change the From header manually. Add the -x [account] option to :forward
in order to switch the account before opening the composer, to remove
this friction when we already know we want to forward with a different
account.

Changelog-added: Forward with a different account than the current
 one with `:forward -x <account>`.
Signed-off-by: inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-20 09:02:01 +02:00
Simon Martin
c65a1db7c3 imap: workaround o365 bug upon new email
inwit reported on IRC that when receiving a new email (on his O365
account) in the currently selected folder, the unread counter is updated
as it should, but that the message list won't show the new mail until
navigating out of then back into the directory.

Traces that we captured together [1] show that O365 notifies aerc of the
update with a MailboxUpdate message, but does NOT report a different
UIDNEXT (I believe it's a bug; other providers do). It does however
report that the folder has more messages, and we can use this to force a
refetch (we'd have done so if they'd reported a different UIDNEXT).

[1] Lines 9-10 from https://paste.sr.ht/~inwit/8b7696456de831adc8e169e7f34b9f08c0a8971b

Reported-by: inwit <inwit@sindominio.net>
Signed-off-by: Simon Martin <simon@nasilyan.com>
Tested-by: Inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-20 09:02:01 +02:00
Simon Martin
3625e0f04a imap: workaround list-status issue with zoho
I've been working with skejg on a regression from 0.20 that he's seeing
with his Zoho account: when receiving a new email, the unread counter is
incremented but the message list is not updated.

The change in scope is 96603ea04e, that uses the directory name
instead of "" when LIST STATUS'ing a single directory, which improves
overall performance, especially for accounts with many folders.

The problem is that Zoho does not give an error in such a case, but also
does not return *any* status, making the CheckMail command virtually a
no-op.

This patch works this around (while not removing the performance benefit
to "normal providers") by always restricting the LIST STATUS' ref if a
single directory is required, and in case it returns neither a status
nor an error, do another LIST STATUS with "" as ref.

Fixes: 96603ea04e ("imap: only restrict list-status to a single directory when we can")
Reported-by: skejg <grolleman@zoho.com>
Signed-off-by: Simon Martin <simon@nasilyan.com>
Tested-by: skejg <grolleman@zoho.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-20 09:02:01 +02:00
Terrance
c9e3c1e919 app: expose toggle-headers command for open split
This adds support for the :toggle-headers command from the message list,
which will flip the config value and refresh the split if open.

Signed-off-by: Terrance <git@terrance.allofti.me>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-20 09:01:57 +02:00
Simon Martin
63e6a018ae grid: fix possible crash on startup due to unsynchronized access
I've encountered a few crashes when starting aerc while also playing
with the mouse; see for instance
  https://paste.sr.ht/~simartin/e71203c56daebec1dd6e96916f88a229d8b41b2b

This is due to a race between Grid.MouseEvent and grid.reflow: the
latter modifies the grid without taking the associated mutex, while it
should.

Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-19 12:23:32 +02:00
Simon Martin
53b1d30515 imap: fix comment typo
The only think worse than no documentation is incorrect documentation...

Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-12 11:36:47 +02:00
Simon Martin
de2006bbd3 config: allow controlling whether :delete is allowed from any folder
It's currently possible to delete mails (*not* move to Trash) from any
folder. What a delete action does depends on the mail client, and it is
often synonymous to "Move to trash", and aerc's behaviour can surprise
users (who will find out too late, when their mail is gone forever...).

This patch adds a configuration setting to control whether deletes are
allowed from any folder, or are restricted to the Trash and Junk
folders.

Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-11 10:12:16 +02:00
Simon Martin
2b6aeb5446 ui: allow message split viewer to automatically mark messages as read
Users can specify that messages should be marked as read when they're
viewed, but not when they're previewed in a message list split.

This patch makes it possible via two configuration knobs: one stating
whether the split message viewer should mark messages as read (off by
default), and one specifying the delay after which to do it.

Fixes: https://todo.sr.ht/~rjarry/aerc/126
Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-11 10:12:16 +02:00
Simon Martin
55e9db303e imap: do not ignore delete notifications linked to move actions
As part of my analysis about read/unread, I noticed a bug in 8fc6ddd2:
the worker bit wrongly assumes that we can only have an ExpungeHandler
for deletes, and that MessageUpdates for messages in the ExpungeHandler
should therefore be ignored (because another one will arrive later).

This assumption is however wrong, and we should NOT ignore those updates
if the ExpungeHandler was built for a move action.

Fixes: 8fc6ddd292 ("imap: support various provider policies for expunge calls")
Signed-off-by: Simon Martin <simon@nasilyan.com>
Tested-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-11 10:12:09 +02:00
Simon Martin
77758cc37c imap: use sequence to handle deletions not found in expungehandler
As part of my analysis about read/unread, I noticed another bug in
8fc6ddd2: if we're notified of a deletion that we are unable to resolve
in the ExpungeHandler, we should revert to using the sequence instead of
erroring out.

Fixes: 8fc6ddd292 ("imap: support various provider policies for expunge calls")
Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-11 10:11:42 +02:00
Simon Martin
4cfc71b1be imap: improve seen count management
While investigating a reported slowness when marking messages (un)read,
I noticed an issue with commit 7cb8e0e7ce: it systematically updates
the Seen count using the unsolicited message's status. This is wrong
because we might receive that message long after we updated things on
our end, or at the next action on the message (e.g. opening it).

We need to compare the status reported by the server with ours, and only
if they differ update the counter with what the server states.

Doing so also allows to fix the reported slowdown by reflecting Seen
flag updates right after an explicit :[un]read command, instead of
deferring to the confirmation by the IMAP server, and paying the
(unnecessary) latency of a round-trip. It is safe because we will only
do it after a successful UidStore call, hence confirmation from the IMAP
server of the flag change.

Fixes: 7cb8e0e7ce ("imap: properly handle out-of-band Unseen flag updates")
Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3CDACPBQ04UHUF.30CJJ4QKJDYLY@zoho.com%3E
Reported-by: skejg <grolleman@zoho.com>
Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-11 10:11:16 +02:00
Folker Schwesinger
0d46a43a14 maildir: fix filename encoded UID removal when moving messages
Recently, in the process of updating the codebase to go-maildir v0.6.0
the logic to strip potential UID parts from the message filenames was
dropped. However, maildir synchronizer isync/mbsync encodes the UID
within the filename of the email and cannot recover if the UID is
preserved during a move.

Re-add the UID stripping logic to remove the "U=xxx" part from message
filenames.

Fixes: 730624ce ("mod: update go-maildir")
Link: https://lists.sr.ht/~rjarry/aerc-devel/patches/34893
Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3CDACSXDU86DC3.LPLLI44C0QAK@sbinet.org%3E
Signed-off-by: Folker Schwesinger <dev@folker-schwesinger.de>
Tested-by: Sebastien Binet <s@sbinet.org>
Acked-by: Robin Jarry <robin@jarry.cc>
2025-06-05 12:44:08 +02:00
Robin Jarry
3023b3a4e5 pipe: fix deadlock when piping large messages to less
We have the ability to pipe data to a QuickTerm via its stdin argument.
This function creates a virtual terminal and uses its OnStart callback
to read from stdin and write it to the created command pipe.

The OnStart callback is invoked in app.Terminal.Draw but in that case,
it waits until all data has been read and copied before returning which
prevents the main thread from actually rendering less displaying that
data on screen which blocks everything.

Keep the data copying completely async and out of the main thread to
avoid dead locking.

Reported-by: Simon Martin <simon@nasilyan.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Simon Martin <simon@nasilyan.com>
2025-06-03 08:55:43 +02:00