Commit Graph

1027 Commits

Author SHA1 Message Date
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
Robin Jarry cc432eefd3 imap: move connect procedure into a dedicated function
This will prepare for extra tcp connection options support and for
automatic reconnect. No functional change.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-12-07 21:26:56 +01:00
Robin Jarry abcd327359 maildir: watch for message renames
Messages flags can also be changed without changing directories.
Changing flags in maildirs means renaming the message files. Also take
renames into account.

Link: https://cr.yp.to/proto/maildir.html
Fixes: f4d3c8fc77 ("maildir: watch for external changes")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-12-06 23:50:04 +01:00
Robin Jarry f4d3c8fc77 maildir: watch for external changes
When a maildir is synchronized by an external process while aerc is
running (e.g. mbsync), some emails may be moved out of "new" to "cur" or
completely deleted.

These deletions are ignored and aerc may assume these messages are still
here, leading to errors.

Take file deletions into account. Also, add "cur" to the watched
folders since these can be modified as well.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-12-06 20:54:29 +01:00
Dian M Fay f776fb8246 style: customize vertical and horizontal border characters
New border-char-horizontal and border-char-vertical config settings in
aerc.conf allow users to modify border appearance from the default
1-wide/tall blank space. In stylesets, border.fg now affects the
foreground color when custom characters are defined.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-30 15:05:33 +01:00
Dian M Fay ad5f65b927 doc: fix typo in stylesets-dirs 2021-11-29 21:05:02 +01:00
Robin Jarry 6ddfc23e61 imap: fix segfault when disconnecting
Do not set client = nil, it breaks almost all message handlers:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8c7e51]
goroutine 25 [running]:
  git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleListDirectories
    worker/imap/list.go:32
  git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleMessage
    worker/imap/worker.go:174
  git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).Run
    worker/imap/worker.go:264
  created by git.sr.ht/~rjarry/aerc/widgets.NewAccountView
    widgets/account.go:85 +0x518

Simply leave the disconnected client object, it already returns explicit
error messages.

Fixes: e41ed82cf3 ("imap: add manual {dis,}connect support")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-22 21:32:56 +01:00
Robin Jarry ec58090474 doc: fix default values for dynamic date formats
These settings now have a default value.

Fixes: fe7ed940d3 ("config: use dynamic time format for default config")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-13 15:46:17 +01:00
Kalyan Sriram 402612fd97 notmuch: allow sort by file order
When using the notmuch backend, it often makes more sense to sort
folders (actual virtual folders, or queries) by the order specified in
the query-map file, rather than alphabetically. This patch introduces a
configuration option (disabled by default) that allows this.

Additionally, due to the notmuch backend previously using maps (which
are order-undefined) to store the list of queries, default query
selection on aerc startup fluctuated. This patch fixes that by using
slices to store query order.
2021-11-13 15:25:04 +01:00
Kalyan Sriram 88d28908d2 binds: add escape to clear search 2021-11-13 15:20:54 +01:00
Kalyan Sriram d7bda10f3e notmuch: allow empty searches
Don't error on empty search terms, just don't filter
by anything and return all items matching the current querymap
2021-11-13 15:20:54 +01:00
y0ast dc2a2c2dfd messages: allow displaying email threads
Display threads in the message list. For now, only supported by the
notmuch backend and on IMAP when the server supports the THREAD
extension.

Setting threading-enable=true is global and will cause the message list
to be empty with maildir:// accounts.

Co-authored-by: Kevin Kuehler <keur@xcf.berkeley.edu>
Co-authored-by: Reto Brunner <reto@labrat.space>
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-13 15:05:59 +01:00
Robin Jarry c303b95336 Release version 0.6.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-09 21:10:17 +01:00
Robin Jarry 44ad5f9a25 doc: update authors
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-09 20:11:42 +01:00
Robin Jarry fe7ed940d3 config: use dynamic time format for default config
New users may find this nicer than a static format.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-06 17:44:53 +01:00
Robin Jarry 84146e23b3 index: add this-week-time-format
Also allow specific time format for messages received within the last
7 days.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-06 17:34:20 +01:00
Robin Jarry 02e7d8aca8 doc: fix typo today-time-format -> this-day-time-format
Fixes: 42b4302ba3 ("index: allow dynamic formatting of message dates")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-06 17:11:43 +01:00
Robin Jarry e41ed82cf3 imap: add manual {dis,}connect support
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-05 10:45:31 +01:00
Robin Jarry 20752df89c viewer: add colon after header names
Display them as standard RFC 822 headers.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-05 10:45:31 +01:00
Robin Jarry b1daf08991 go.mod: cleanup
Run go mod tidy.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-05 10:29:07 +01:00
Robin Jarry 0d645bcebd go.mod: change base git url
I'm not sure what are the implications but it seems required.

Link: https://github.com/golang/go/issues/20883
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-05 10:21:45 +01:00
Robin Jarry b2e9df623f bindings: remove unsupported s-tab key
This binding does not exist. It is backtab.

Fixes: 1a75906bcb ("bindings: support more modified keys")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-05 10:15:33 +01:00
Robin Jarry 4cf0ea2a05 imap: use builtin idle support
go-imap supports IDLE since 1.2.0. Remove dependency to go-imap-idle.

Link: https://github.com/emersion/go-imap/commit/ac3f8e195ef1b6d
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-02 11:24:33 +01:00
Robin Jarry 138977b2ce main: set xterm title
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-02 11:24:33 +01:00