Commit Graph

1150 Commits

Author SHA1 Message Date
Robin Jarry 7edcc9f794 reply: use new-message template for non-quoted replies
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>
2022-01-27 09:16:54 +01:00
Ariel Costas 7c945149a6 doc: correct typo in man-pages
Fix a typo in the man page where it reads "maintained by by Robin"
instead of "maintained by Robin"

Signed-off-by: Ariel Costas <ariel@costas.dev>
2022-01-26 19:23:29 +01:00
Robin Jarry 59ecf93b9b github: add workflow to test on macos
We have some users on macOS. builds.sr.ht does not support proprietary
build images and will never do.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-25 09:35:08 +01:00
Adnan Maolood 6be78781a1 aerc: shutdown if socket communication fails
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.
2022-01-24 12:06:41 +01:00
inwit d922d7325c binds: Warning on unexistent account bindings
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>
2022-01-24 11:48:51 +01:00
Koni Marti cb3090956c dirlist: skip unnecessary change-folder action
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>
2022-01-24 09:51:32 +01:00
Koni Marti eafb537081 dirlist: improve change-folder responsiveness
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>
2022-01-24 09:51:29 +01:00
inwit 50b0436510 readme: fix typo in contribution guide
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>
2022-01-24 09:48:22 +01:00
Mark Dain e58194c7b5 build: check make install
Ensure that install works on all platforms.
2022-01-24 09:38:56 +01:00
Mark Dain 1864680bfc mk: add make checkinstall
Adds a quick way to ensure the install was successful.
2022-01-24 09:38:45 +01:00
Mark Dain b9e96751af build: replace archlinux by openbsd
This commit drops Arch Linux in favor of a BSD so there's more variety
in CI.

Link: https://lists.sr.ht/~rjarry/aerc-devel/%3C20220122033806.91728-1-ktprograms%40gmail.com%3E
2022-01-24 09:38:23 +01:00
Koni Marti e5ad877af5 msgstore: fetch missing headers in visual mode
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>
2022-01-22 17:07:50 +01:00
Robin Jarry 44f81c87e4 mk: syntax cleanup
Avoid multiline strings. Use dlv --build-flags.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-21 21:56:40 +01:00
Robin Jarry e97e0d8ab1 mk: be compatible with bsd make
ifeq is not supported by bsd make. We don't need this. Use a simple
shell command.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-21 21:56:40 +01:00
Robin Jarry 34d36bad0d Revert "mk: only install if files changed"
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>
2022-01-21 21:38:01 +01:00
Robin Jarry 0709115916 mk: avoid searching in hidden directories at the root
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-20 21:43:47 +01:00
Robin Jarry 561f8c19af Add .editorconfig file
Most of the go source files

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-20 21:43:47 +01:00
Robin Jarry 662a82e7db readme: add package links to debian and fedora
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-20 20:52:11 +01:00
Robin Jarry a46262ee57 build: add multiple distributions
Add build and test on debian, fedora and archlinux. Only check code
formatting on alpine.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-20 20:51:42 +01:00
Nguyễn Gia Phong bf4abd309e maildir,notmuch: pass in-memory message to callback
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>
2022-01-20 15:44:46 +01:00
Robin Jarry b96326517d bindings: fix ctrl-h binding not working
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>
2022-01-20 13:23:35 +01:00
Koni Marti 7f34cab5e5 terminal: fix nil pointer dereference in pty.Getsize
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>
2022-01-19 22:16:36 +01:00
Robin Jarry 22ad9e199a mk: only install if files changed
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-19 22:02:44 +01:00
Robin Jarry 877a94f5d9 compose: add default template for new messages
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>
2022-01-19 21:42:41 +01:00
Robin Jarry 92bf89c338 docs: mention missing -T options for compose and forward
A template file may be specified for compose and forward as well.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-19 21:29:16 +01:00
Robin Jarry f0f7cf347c templates: add x-mailer header in default files
This should serve as an example for new users.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-19 20:56:38 +01:00
Nguyễn Gia Phong 904ffacb0e maildir,notmuch: avoid leaking open files
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
2022-01-19 20:18:00 +01:00
Koni Marti beae17a6da imap: auto-reconnects on connection error
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>
2022-01-19 17:40:52 +01:00
Koni Marti 1ace50a6b9 imap: emits connection error on logout
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>
2022-01-19 17:34:42 +01:00
Koni Marti 022bf1a11f imap: fix panic when sending multiple connect cmds
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>
2022-01-19 17:34:41 +01:00
Robin Jarry f81d8871c7 Release version 0.7.1
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-15 12:14:32 +01:00
Robin Jarry 899d1cca3c Revert "imap: attempt automatic reconnection on error"
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>
2022-01-15 12:13:47 +01:00
Robin Jarry 4d7d01b3f0 Release version 0.7.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-14 21:23:18 +01:00
Robin Jarry c605ada3dd imap: attempt automatic reconnection on error
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>
2022-01-14 21:17:40 +01:00
Nguyễn Gia Phong 6f8c167e27 Stop wrapping OriginalText in default templates
Wrapping embeded code or patches could mess up the content.
2022-01-14 20:36:19 +01:00
Koni Marti 4782473064 fix segfault when copy-pasting into compose editor
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>
2022-01-14 20:35:07 +01:00
Parasrah 71eda7d37c completions: add support for completing multiple addresses
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.
2022-01-07 13:54:10 +01:00
Koni Marti b19b844a63 pgp: PGP/MIME encryption for outgoing emails
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>
2022-01-07 13:45:34 +01:00
Koni Marti 69d4e3895f pgp: PGP/MIME signing for outgoing emails
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>
2022-01-07 13:45:34 +01:00
Koni Marti 8813fadfe9 pgp: update openpgp packages (go-crypto and go-pgpmail)
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>
2022-01-07 13:45:34 +01:00
inwit bc593ac7cd recall: allow recalling messages from any folder
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>
2021-12-13 14:56:39 +01:00
psykose bc087d9b30 mk: remove version override
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
2021-12-13 14:56:22 +01:00
Robin Jarry b331371a65 format: reformat code with go 1.17
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>
2021-12-11 23:24:08 +01:00
Robin Jarry 6857ab7a71 build: add check for code formatting
Let's avoid pushing unformatted code.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-12-11 23:13:27 +01:00
Robin Jarry 0ef72dd575 config: fix code formatting
Tabs are required.

Fixes: 175d0efeb2 ("binds: add account specific bindings")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-12-11 23:13:27 +01:00
Robin Jarry 15a4cc7d0a imap: fix build on macos
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>
2021-12-11 21:45:51 +01:00
Jonathan Bartlett 175d0efeb2 binds: add account specific bindings
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>
2021-12-11 21:45:41 +01:00
Robin Jarry b84374a572 readme: add contribution guide
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>
2021-12-11 21:45:38 +01:00
Robin Jarry 5dfeff75f3 imap: add tcp connection options
Allow fine tuning tcp connection options.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-12-07 21:28:13 +01:00
Robin Jarry 33aaf94663 imap: use low level tcp connection
In preparation for tcp keepalive options, we need access to the
net.TCPConn object associated with an IMAP connection. The only way to
do this is to create the connection ourselves.

No functional change.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-12-07 21:27:41 +01:00