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>
Unless a template is specified with reply -T, use the new-message
template for non-quoted replies.
Fixes: 877a94f5d9 ("compose: add default template for new messages")
Signed-off-by: Robin Jarry <robin@jarry.cc>
When provided with a mailto argument, aerc tries to connect to an
existing instance via a unix socket. If that fails, it starts up a new
instance and tries again. However, if that fails again (e.g. if the
unix server could not be started) then the new instance will remain open
without any indication that an error occured. Instead, shutdown the new
instance so the user can see the error message.
After commit 175d0ef ("binds: add account specific bindings"), when
bindings are defined for an account not defined in accounts.conf, aerc
quits with an error. After this commit, a warning is logged and aerc
ignores those bindings.
Signed-off-by: inwit <inwit@sindominio.net>
when traversing the directory list, aerc will fetch the contents for
every directory even though the user might just move on to the next.
This causes an unnecessary delay (and load on the worker) and can be
avoided by skipping the old change-folder action when a newer one
arrives within a predefined time interval.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
improves change-folder responsiveness. When changing folders, the
highlighted directory is currently updated in a callback function to the
open-directory action. This creates an unpleasent lag in the ui until
the entire operation is done. Instead, we should provide an immediate
visual feedback of the selection to the user and keep loading the
directory contents in the background.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
git: 'sendemail' is not a git command. See 'git --help'.
The most similar command is
send-email
Fixes: b84374a572 ("readme: add contribution guide")
Signed-off-by: inwit <inwit@sindominio.net>
fetches missing headers when in visual selection mode. This prevents
large archive operations from panicking due to a nil pointer
dereference.
The archive command will return an error to the ui when a nil message is
encountered to signal that the message store is not ready yet.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
This reverts commit 22ad9e199a.
This breaks install on macOS:
install -m755 -D aerc /usr/local/bin/aerc
install: illegal option -- D
Signed-off-by: Robin Jarry <robin@jarry.cc>
This fixes piped full message (:pipe -m) being empty.
Fixes: 904ffacb0e ("maildir,notmuch: avoid leaking open files")
Signed-off-by: Nguyễn Gia Phong <mcsinyx@disroot.org>
For some unknown reason. tcell does not include the ctrl modifier for
the ctrl-h key event.
Fixes: 7a6c808c04 ("bindings: prepare for more modifers")
Fixes: https://todo.sr.ht/~rjarry/aerc/8
Signed-off-by: Robin Jarry <robin@jarry.cc>
pty.Getsize() is used in the Draw function of the terminal widget and wraps the
pty.GetsizeFull() function. However, pty.Getsize does not check the returned
error from pty.GetsizeFull before dereferencing the winsize struct. In case of
an error, this will cause a nil pointer deference and panic.
This has been reported in the upstream package, but in the meantime, we can
directly use pty.GetsizeFull.
References: https://todo.sr.ht/~rjarry/aerc/11
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Allow defining a default template to use when composing new messages.
Add an example to be used for new users.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Previously, Message.NewReader returned the wrapped buffered reader
without a reference to the opened file, so the files descriptors
were left unclosed after reading. Now, the file reader is returned
directly and closed on the call site. Buffering is not needed here
because it is an implementation detail of go-message.
Fixes: https://todo.sr.ht/~rjarry/aerc/9
if the worker emits a connection error, the ui will automatically send back a
reconnect command. The worker then establishes a new connection. Auto-reconnect
is disabled when the user sends the disconnect command.
Fixes: https://todo.sr.ht/~rjarry/aerc/1
Signed-off-by: Koni Marti <koni.marti@gmail.com>
implements a new connection error message. This allows the worker to emit a
connection-related error message to the ui when the imap client closes the
loggedOut channel.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
fixes the panic when the user sends multiple connect commands and is
already connected. The panic is caused by closing an already closed
channel. This happens when the idle re-init code is not executed, e.g.
when there's a return statement in the switch block. A defer func()
before the switch block will prevent this. The existing behavior of only
creating a new idleStop channel when properly connected is preseverd.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
This reverts commit c605ada3dd.
This breaks reading message bodies. I am not sure why, I'll take some
time to fix it later.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Attempt to reconnect to the server when there is an unexpected
disconnection or network error.
Use the Client.LoggedOut() channel which is closed when the connection
is closed.
This patch is rather flaky and is certainly bugged. However, it is
a start.
Signed-off-by: Robin Jarry <robin@jarry.cc>
fixes the segmentation fault when copy-pasting a large text into the
composer editor. The problem is a concurrent read of the vterm field in the
Terminal widget in its flushTerminal() method which can be avoided with a mutex.
Fixes: https://todo.sr.ht/~rjarry/aerc/12
Signed-off-by: Koni Marti <koni.marti@gmail.com>
as per the discussion https://lists.sr.ht/~sircmpwn/aerc/patches/15367
this handles completions in `completer/completer.go` by enabling the
completer to return a `prefix` that will be prepended to the selected
completion candidate.
implements PGP/MIME encryption with go-pgpmail. The Encrypt() function of
go-pgpmail requires a list of public keys which are taken from the
keystore. The keystore is searched for the email addresses of all
recipients (to, cc, and bcc).
If you want to be able to read the encrypted email afterwards, add
yourself as a recipient in either to, cc, or bcc as well.
Public keys can be exported from gpg into aerc as follows:
$ gpg --export >> ~/.local/share/aerc/keyring.asc
When composing a message, the encryption is enabled with the
":encrypt" command. This sets a bool flag in the Composer struct.
A reapted application of this command will toggle the flag.
The encrypted message can also be signed by using the ":sign"
command before or after ":encrypt".
References: https://todo.sr.ht/~rjarry/aerc/6
Signed-off-by: Koni Marti <koni.marti@gmail.com>
implements PGP/MIME signing with go-pgpmail. The Sign() function of
go-pgpmail requires a private (signing) key. The signing key which matches
the senders email address (from field in email header) is looked up
in aerc's copy of the keyring.
Private keys can be exported from gpg into aerc as follows:
$ gpg --export-secret-keys >> ~/.local/share/aerc/keyring.asc
A message is signed with the ":sign" command. The sign command sets
a bool flag in the Composer struct. Using the command repeatedly will
toggle the flag.
References: https://todo.sr.ht/~rjarry/aerc/6
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Replaces golang.org/x/crypto with github.com/ProtonMail/go-crypto
consistently and updates go-pgpmail to v0.2.0
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Recall fails when called outside of the "postpone" folder (usually
"Drafts"). This makes sense for postponed messages. However, sometimes
the user would like to re-edit and re-send an old, possibly sent,
message, which would serve as a basis for the new one.
This patch allows recall to work outside the postpone folder, thus
allowing for re-edition of any message.
In the original recall function, if the recalled message is found in the
"postpone" folder, once the message has been recalled, re-edited and
sent, the original draft is deleted. With this patch, when the message
is not in the "postpone" folder, the original message is not deleted.
Signed-off-by: inwit <inwit@sindominio.net>
some build systems build inside a git environment- most notably,
alpine aports is built inside an aports tree. this override prevents
a VERSION=$pkgver override from being passed at build time and makes
aerc think its version is an alpine version from aports:
< aerc -v
aerc v3.15.0.r122.gb306bc1c4c
There was a change in how build tags are formatted. Use this as new
reference.
Link: https://go.dev/doc/go1.17#gofmt
Signed-off-by: Robin Jarry <robin@jarry.cc>
Fix the following build error on mac os:
worker/imap/worker.go:368:29: undefined: syscall.TCP_KEEPCNT
worker/imap/worker.go:376:29: undefined: syscall.TCP_KEEPINTVL
These symbols are not defined on darwin.
Fixes: 5dfeff75f3 ("imap: add tcp connection options")
Signed-off-by: Robin Jarry <robin@jarry.cc>
When using aerc for multiple accounts often bindings might differ
slightly between accounts. For example:
* Account A archives to one directory (:archive)
* Account B archives to monthly directories (:archive month)
Add account specific bindings to allow the user to add a "context" to a
binding group using a context specifier and a regular expression.
Currently the only context specifier is 'account'.
The regular expression is validated against the accounts loaded from
accounts.conf and the configuration fails to load if there are no
matches.
Contextual bindings are merged with global bindings, with contextual
bindings taking precedence, when that context is active.
Bindings are be configured using a generic pattern of
'view:context=regexp'. E.g.:
# Globally Applicable Archiving
[messages]
A = :read<Enter>:archive<Enter>
# Monthly Archiving for 'Mailbox' Account
[messages:account=Mailbox$]
A = :read<Enter>:archive month<Enter>
In the above example all accounts matching the regular expression will
archive in the monthly format - all others will use the global binding.
Signed-off-by: Jonathan Bartlett <jonathan@jonnobrow.co.uk>
This has been requested numerous times. People are not all used to the
git email workflow. Also, I am quite anal about commit messages.
Signed-off-by: Robin Jarry <robin@jarry.cc>