When a signature contains a line that starts with an url, the url is not
highlighted properly:
--
Foobar
[38;2;255;255;175mmhttps://foobar.org
The trailing m of the signature color start \x1b[38;2;175;135;255m is
considered as part of the URL scheme (i.e. mhttps:// instead of
https://). Colorize the URLs first before wrapping with the signature
color.
Fixes: df8c129235 ("filters: port colorize to awk")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Will expand a user-provided custom sharedir, XDG_CONFIG_HOME and
XDG_DATA_HOME if necessary. Will not alter those strings if they do not
begin with a tilde.
Signed-off-by: Daniel Patterson <me@danielpatterson.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
We should use the Makefile value of SHAREDIR when searching for config
files and templates etc.
This is important for systems which do not use the standard file
hierarchy or which do not have a consistent location for installing
program files, for example NixOS, which will have a different install
location with every update.
Signed-off-by: Daniel Patterson <me@danielpatterson.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
* All patches must be signed-off.
* All patches must receive at least one independent review and approval
before being applied.
* Remove the --in-reply-to= option for git send-email. This breaks
lists.sr.ht UI.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: akspecs <akspecs@gmail.com>
Some MUAs (namely Outlook) use localized prefixes for replied-to and
forwarded mail. With this patch aerc replaces known localized prefixes
and repetitions with the common Re: prefix.
Link: https://office-watch.com/2014/outlook-reply-forward-prefixes/
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
Extract the vertical scrolling ability into its own Scrollable struct
that can be embedded and reused across any ui element that relies on
scrolling.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
The kept socket after crashes or unclean exits can lead to a unexpected
behaviour. This commit just removes dangling sockets if they exist.
Since the "does not exist" error is the best case scenario error
handling was deemed unnecessary.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
When building with BSD make, running `make` after updating a source file
will not cause the binary to be rebuilt. After inspection, it appears
that the GOSRC variable only contains "go.mod go.sum". The aerc target
does not depend on .go source files.
The $(shell) construct is GNU make specific. BSD make has a special
assignment operator (!=) which evaluates a shell command. Since GNU make
4.0, the BSD != operator is supported for compatibility.
Use a syntax that is available in both make flavours.
Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
Running make with different values for GOFLAGS or VERSION does not cause
aerc to be rebuilt whereas it should.
Write the go build command line into a file and force aerc to be rebuilt
if the command line has changed.
Use the BSD make compatible != operator to run the command. This
operator is also available in GNU make since version 4.0.
Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
When messages are marked, pipe their contents into the specified
command. The messages are ordered according to their respective
Message-Id headers. This allows applying complete patch series with
a single command.
When piping more than one message, make sure to write them in the mbox
format as git am expects them to be.
Link: https://en.wikipedia.org/wiki/Mbox
Link: https://github.com/git/git/blob/v2.35.1/builtin/mailsplit.c#L15-L44
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Tested-by: akspecs <akspecs@gmail.com>
aerc.SelectedAccount() is used in lots of places. Most of them without
checking the return value.
In some cases, the currently selected tab is not related to any account
(widget.Terminal for example). This can lead to unexpected crashes when
accessing account specific configuration.
When possible, return an error when no account is currently selected.
If no error can be returned, fallback to non-account specific
configuration.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
implement message threading on the message store level using the
jwz algorithm. Build threads on-the-fly when new message headers arrive.
Use the references header to create the threads and the in-reply-to
header as a fall-back option in case no references header is present.
Does not run when the worker provides its own threading (e.g. imap
server threads).
Include only those message headers that have been fetched and are
stored in the message store.
References: https://www.jwz.org/doc/threading.html
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Inwit <inwit@sindominio.net>
Tested-by: akspecs <akspecs@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
add the expand-folder and collapse-folder commands to navigate the
directory tree view. Provide keybinds for a vi-like folder navigation
experience.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
implement a foldable tree for the directory list. Expand all parent
directories when a hidden directory is selected with the change-folder
command.
folders-sort considers the top-level directories only. The folders and
foldersexclude filters work with the full directory path.
Enable tree view by adding 'dirlist-tree=true' to the config file.
Implements: https://todo.sr.ht/~sircmpwn/aerc2/228
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Add an extra attribute to the status line. When non-empty, display it
after the current status.
Set that extra status after a successful :search or :filter. Remove it
after :clear.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Python is not available on all systems. Port the colorize filter to awk
as it is a more widespread POSIX utility.
Users are free to copy the filter into their home dir and tweak the
colors to their needs. The highlighted items are:
=============== ======= ======= ========= =================
Item Red Green Blue Color
=============== ======= ======= ========= =================
quoted text 1 95 175 255 Blue
quoted text 2 255 135 0 Orange
quoted text 3 175 135 255 Purple
quoted text 4 255 95 215 Pink
quoted text * 128 128 128 Grey
diff meta 255 255 255 White bold
diff chunk 205 0 205 Cyan
diff added 0 205 0 Red
diff removed 205 0 0 Green
signature 175 135 255 Purple
header 175 135 255 Purple
url 255 255 175 Yellow
=============== ======= ======= ========= =================
This assumes a terminal emulator with true color support and with
a dark/black background.
Link: https://github.com/termstandard/colors
Signed-off-by: Robin Jarry <robin@jarry.cc>
This script is referenced by some users configuration. Restore it to
avoid breaking existing setups.
Fixes: bca93cd915 ("filters: add a more complete plaintext filter")
Signed-off-by: Robin Jarry <robin@jarry.cc>
This filter script is not compatible with the previous one. Rename it to
avoid issues with existing configs.
Fixes: bca93cd915 ("filters: add a more complete plaintext filter")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Start the reconnect cycle when the initial connect fails. Make the
connection observer send a connection error when the imap client is nil.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Parse the terminal capabilities from the TERM environment variable
instead of using a hard coded list of terminals.
tcell does not expose the status line capabilities. Use another library
for this: github.com/xo/terminfo
Signed-off-by: Robin Jarry <robin@jarry.cc>
; is a special character for the INI format. It starts a comment and
apparently cannot be escaped nor quoted. This causes the default
text/plain filter to be truncated and causes this obscure error when
viewing a message:
sh: 1: Syntax error: Unterminated quoted string
Debugging shows that the filter command is:
sh -c "sed 's/^>\\+.*/\\x1b[2"
Remove the explicit dim style. It should be the default anyway.
Fixes: 7c3ce816c8 ("config: set a default filter for text/plain")
Signed-off-by: Robin Jarry <robin@jarry.cc>
The status is not cleared. It is annoying.
Fixes: c37f1eaaea ("filter/search: display current search/filter arguments")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Avoid the following issue when running aerc with the default
configuration:
No filter configured for this mimetype ('text/plain')
Use a very basic sed command to replace the default plaintext filter.
Fixes: bb0f180140 ("config: do not hardcode sharedir")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Add an XDG desktop file to handle mailto: links, to make it easier to
reply to mailing list threads and compose emails with aerc in general.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Make the statusbar message after search and filter completion more
informative by showing the full call that was used.
Signed-off-by: inwit <inwit@sindominio.net>
Fix the parsing of internationalized headers (RFC 6532). Enable
unsubscribe to work with regular and encoded headers.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
waits an increasing amount of time before attempting a reconnect.
Wait is capped at 16s. Prevents many reconnect attemps in a short time period.
Fixes commit 05ad96a30c ("imap: improve reconnect stability") that
improved the reliability of the reconnect mechanism but did not
implement controls to prevent the triggering of too many reconnects
within a short period of time.
Fixes: 05ad96a30c ("imap: improve reconnect stability")
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Instead of using a static SHAREDIR at compile time, use a list of
standard paths to use at runtime for templates, config files and
stylesets.
This implies removing all default filters in the default configuration.
Replace them with basic commands. New users can configure the filters as
they wish.
Signed-off-by: Robin Jarry <robin@jarry.cc>
improves the robustness of the imap reconnect feature which was
introduced in commit beae17a6da ("imap: auto-reconnects on connection
error").
If a connection error is emitted, the message list is cleared and a
corresponding error message is shown in the ui. Status bar is updated as
well. Upon reconnect, the directories and the message list will be
re-fetched (same behavior as the connect command).
Reconnect can be enabled and disabled with the connect and the
disconnect commands.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
re-opens the review UI when the postpone operation fails. Before, the
composer would close, even on error, and we would lose the email draft.
Now, the user can decide on how to proceed when postponing fails.
References: https://lists.sr.ht/~rjarry/aerc-devel/patches/28824
Signed-off-by: Koni Marti <koni.marti@gmail.com>
This channel has not received much activity and all development
discussions are happening on #aerc. No need to multiply channels.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Some messages contain invalid headers, textproto.ReadHeader fails with
an error:
malformed MIME header key: From nobody Fri Jan 14 19
And all other messages of the selected folder are ignored.
Return an explicit error message to the UI and continue processing other
messages. This is consistent with what the maildir worker does.
Signed-off-by: Robin Jarry <robin@jarry.cc>
It is not obvious by reading the license text that aerc is distributed
under the MIT license. Explicitly state it.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Parse the actual user bindings to determine what shortcuts are available
in the compose::review stage. Add a predefined list of commands for
which we want to display the keyboard shortcuts.
Fixes: https://todo.sr.ht/~rjarry/aerc/14
Signed-off-by: Robin Jarry <robin@jarry.cc>
Do not use this to run the debugger. Instead, build a non-optimized
binary and display what command should be executed to attach to
a running program.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Introduce an option in aerc.conf to disable the auto-including
of your own address when replying to your own emails (address
replies to the original To: and Cc: instead); default to true
(allow the auto-including)
Since commit 01c96e78df ("Update DirectoryInfo handling for maildir"),
flags are checked for every message of a folder when entering it.
Iterating over all messages of a folder takes a long time for large
collections of emails.
Only count the number of messages and state that the directory info
counts are not accurate. Defer the parsing of message flags in
a goroutine to have a more responsive UI.
Fixes: https://todo.sr.ht/~rjarry/aerc/16
Suggested-by: Koni Marti <koni.marti@gmail.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
1 second is a bit excessive. Use 200ms which should cover most quick
folder changes.
Add an option to make that delay configurable by the users.
References: https://todo.sr.ht/~rjarry/aerc/16
Fixes: cb3090956c ("dirlist: skip unnecessary change-folder action")
Suggested-by: Koni Marti <koni.marti@gmail.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
implements a recover command that searches the local temp dir for aerc
emails. If a file is found and selected, a new composer tab will open
with the file contents as the message body. No header data is stored in
the temp file and thus this information cannot be recovered.
Recover will not remove the temporary file unless the force flag (-f) is
explicitly used.
This recovery method only works when the editor buffer is saved to
disk and the Close() function of the composer has not been called yet.
Sending, postponing or quitting will call the Close() function which
removes the temporary file completely. After Close() is called, no
recovery is possible anymore.
Signed-off-by: Koni Marti <koni.marti@gmail.com>