aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* maildir: show valid messages even if there are errorsBence Ferdinandy2024-01-262-4/+14
| | | | | | | | | | | | When go-maildir parses a folder and finds an error, it will still return the valid keys it has found along with the error. Instead of returning an empty list of UIDs log an error and proceed with the valid uids found by go-maildir. When opening a folder with invalid files, show an error message to the user. References: https://todo.sr.ht/~rjarry/aerc/215 Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
* release.sh: add --dry-run flagRobin Jarry2024-01-261-15/+23
| | | | | | | This allows checking what the changelog will look like when actually releasing. Signed-off-by: Robin Jarry <robin@jarry.cc>
* flags: add support for draft flagJason Cox2024-01-2619-13/+82
| | | | | | | | | | | | | | Support the draft flag wherever flags are used. Automatically set it when postponing a message, and allow recalling a message without the -f flag if it has the draft flag set, regardless of what folder it's in. Notmuch doesn't seem to pick up on the draft flag when indexing even though the flag is set on the maildir file. Explicitly set all tags corresponding to set flags when appending a message in notmuch. Changelog-added: Support the `draft` flag. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: centralize flag/tag mappingsJason Cox2024-01-263-33/+36
| | | | | | | | Mimic other backends that have centralized mappings. Doing so makes adding support for the draft flag simpler in a subsequent commit. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* tabs: optimize switching by offsetsdelitako2024-01-265-18/+30
| | | | | | | | | | | | | | | | | I imagine no sane user requires aerc to correctly handle commands like `:next-tab 1000000000`, but I tried anyway and it froze aerc while also eating up many GBs of system memory. This behavior is not ideal, so I improved it. This commit adds functions for selecting a tab at an offset from the currently-selected tab and changes the next-tab, prev-tab, and change-tab commands to use these functions instead of looping. Signed-off-by: delitako <delitako@delitako.xyz> Tested-by: Thomas Böhler <witcher@wiredspace.de> Reviewed-by: Thomas Böhler <witcher@wiredspace.de> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: don't attach key when removing signatureThomas Böhler2024-01-261-2/+0
| | | | | | | | | | | | | | If pgp-attach-key is set in accounts.conf, the key is detached with :detach and the signature removed with :sign, the key will be attached again. When :sign is called again two keys will be attached instead of one. Fix this by not attaching a key if it cannot be detached. Fixes: 9d90b70b4edf ("compose: refactor attachment handling") Signed-off-by: Thomas Böhler <witcher@wiredspace.de> Acked-by: Robin Jarry <robin@jarry.cc>
* mod: upgrade go-maildir to v0.4.1Michal Siedlaczek2024-01-262-1/+3
| | | | | | | | | This latest version includes a bug-fix for incorrect path discovery for some messages. Signed-off-by: Michal Siedlaczek <michal@siedlaczek.me> Reviewed-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* mv: allow to move messages across accountsJohannes Thyssen Tishman2024-01-253-31/+155
| | | | | | | | | | | | Add a new -a flag to :mv. When specified, an account name is required before the folder name. If the destination folder doesn't exist, it will be created whether or not the -p flag is specified. Changelog-added: Move messages across accounts with `:mv -a <account> <folder>`. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Acked-by: Robin Jarry <robin@jarry.cc>
* cp: allow to copy messages across accountsJohannes Thyssen Tishman2024-01-252-23/+112
| | | | | | | | | | | | Add a new -a flag to :cp. When specified, an account name is required before the folder name. If the destination folder doesn't exist, it will be created whether or not the -p flag is specified. Changelog-added: Copy messages across accounts with `:cp -a <account> <folder>`. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgstore: create destination folder on store.AppendJohannes Thyssen Tishman2024-01-251-0/+7
| | | | | | | | | When appending a message to a folder, always create the destination folder if it doesn't exist. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Acked-by: Robin Jarry <robin@jarry.cc>
* config: print file path in error messageMichal Siedlaczek2024-01-253-42/+63
| | | | | | | | | In case of a config parsing error, print the file path of the file in which the error occurred. Fixes: https://todo.sr.ht/~rjarry/aerc/218 Signed-off-by: Michal Siedlaczek <michal@siedlaczek.me> Acked-by: Robin Jarry <robin@jarry.cc>
* templates: avoid blank lines with empty signatureJason Cox2024-01-253-3/+9
| | | | | | | | | | An empty line is desirable before the signature but shouldn't be added if there isn't actually a signature. Fixes: b76bf1b ("templates: move signature from compose to templates") Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* hook: add mail-sent hookMoritz Poldrack2024-01-254-0/+59
| | | | | | | | | Add a hook to trigger when a message is sent. References: https://todo.sr.ht/~rjarry/aerc/136 Signed-off-by: Moritz Poldrack <git@moritz.sh> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* idler: improve the imap idlerKoni Marti2024-01-256-156/+182
| | | | | | | | | | Rewrite the imap idler to make it more fault tolerant and prevent hangs (and possibly short writes). Fixes: https://todo.sr.ht/~rjarry/aerc/208 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* check-patches: fix non-posix regexJohannes Thyssen Tishman2024-01-251-3/+3
| | | | | | | | | The usage of '+' to match 'one or more occurrences' of a regex is only POSIX compliant when used in an Extended Regular Expression (ERE). Link: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Acked-by: Robin Jarry <robin@jarry.cc>
* mailmap: updateRobin Jarry2024-01-251-0/+1
| | | | | | Add Thomas' real name. Signed-off-by: Robin Jarry <robin@jarry.cc>
* compose: allow automatic attachment of signing keyRobin Jarry2024-01-253-0/+16
| | | | | | | | | | | | | | | | | | Add a new pgp-attach-key boolean setting in accounts.conf. When set to true, enabling message signing (either automatically via pgp-auto-sign or manually with :sign) will imply attaching the (public) key that will be used to sign the message before sending. The automatically attached key can be unattached like any other attachment with :detach. Implements: https://todo.sr.ht/~rjarry/aerc/207 Changelog-added: Automatically attach signing key with `pgp-attach-key` in `accounts.conf`. Requested-by: Drew Devault <sir@cmpwn.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Thomas Böhler <witcher@wiredspace.de> Reviewed-by: Thomas Böhler <witcher@wiredspace.de>
* forward: select correct part for signed messagesKoni Marti2024-01-211-2/+20
| | | | | | | | Select the correct body part for signed messages when forwarding. Fixes: https://todo.sr.ht/~rjarry/aerc/214 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* reply: select correct part for signed messagesKoni Marti2024-01-211-29/+18
| | | | | | | | | | Select the correct body part for signed messages when quote-replying. Simplify logic in the reply command for the part selection. Fixes: https://todo.sr.ht/~rjarry/aerc/214 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* main: add flags to override config filesBence Ferdinandy2024-01-218-32/+62
| | | | | | | | | | | | Add --aerc-conf, --binds-conf and --accounts-conf CLI flags, which respectively override the default aerc.conf, binds.conf and accounts.conf configuration files. If the specified files do not exist or cannot be read, exit with an error. Implements: https://todo.sr.ht/~rjarry/aerc/209 Changelog-added: CLI flags to override paths to config files. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: add menuRobin Jarry2024-01-207-1/+266
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new :menu command that can be used to spawn a shell command in an interactive dialog and execute aerc commands for each of the lines printed on its standard output like xargs(1) would do in a shell. The shell command can be configured in aerc.conf under [general].default-menu-cmd and overridden via the :menu -c <cmd> option. There are two flags to provide input text to the shell command which can be useful in combination with other aerc commands: -a: All account names, one per line: '<account>' LF -d: All current account directory names, one per line: '<directory>' LF -ad: All directories of all accounts, one per line: '<account>' '<directory>' LF Here are some examples: :menu -adc fzf :cf -a :menu -c 'fzf --multi' :attach :menu -dc 'fzf --multi' :cp And also for key bindings: <C-p> = :menu -adc fzf :cf -a<Enter> Changelog-added: New `:menu` command to invoke other aerc commands based on a shell command output. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
* commands: refactor registrationRobin Jarry2024-01-2096-435/+665
| | | | | | | | | | | | | | | | | | Register all commands with the same function and store them in the same map. Use bit flags to determine in which contexts each command should be available. Remove duplicate commands now that the same command can be exposed in multiple contexts. Refactor API to allow executing commands from other commands without import cycles. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
* envelope: use message from current tabKoni Marti2024-01-201-2/+7
| | | | | | | | | Use the message from the current tab to populate the :envelope window. Fixes: https://todo.sr.ht/~rjarry/aerc/213 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* jmap: avoid crash when server returns garbageRobin Jarry2024-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For some reason, a JMAP server may send message details with empty blobId values. This is invalid but it should not cause a crash. Error: runtime error: slice bounds out of range [-2:] goroutine 16 [running]: git.sr.ht/~rjarry/aerc/worker/jmap/cache.(*JMAPCache).blobPath() git.sr.ht/~rjarry/aerc/worker/jmap/cache/blob.go:43 +0x95 git.sr.ht/~rjarry/aerc/worker/jmap/cache.(*JMAPCache).GetBlob() git.sr.ht/~rjarry/aerc/worker/jmap/cache/blob.go:11 +0x18 git.sr.ht/~rjarry/aerc/worker/jmap.(*JMAPWorker).handleFetchMessageBodyPart() git.sr.ht/~rjarry/aerc/worker/jmap/fetch.go:116 +0x26f git.sr.ht/~rjarry/aerc/worker/jmap.(*JMAPWorker).handleMessage() git.sr.ht/~rjarry/aerc/worker/jmap/worker.go:142 +0x25f git.sr.ht/~rjarry/aerc/worker/jmap.(*JMAPWorker).Run() git.sr.ht/~rjarry/aerc/worker/jmap/worker.go:177 +0x105 git.sr.ht/~rjarry/aerc/app.NewAccountView.func3() git.sr.ht/~rjarry/aerc/app/account.go:105 +0x57 created by git.sr.ht/~rjarry/aerc/app.NewAccountView in goroutine 1 git.sr.ht/~rjarry/aerc/app/account.go:98 +0x468 Ignore a blobId when it is an empty string. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tristan Partin <tristan@partin.io>
* compose: ensure rfc2045 compliant mime messageKoni Marti2024-01-191-0/+8
| | | | | | | | | | | | Ensure that the encrypted and/or signed messages contain a correct MIME-Version header field at the top level of the message in compliance with RFC2045 Section 4. Link: https://datatracker.ietf.org/doc/html/rfc2045#section-4 Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3C1704071512-sup-2798%40honeycomb%3E Reported-by: Dan Callaghan <djc@djc.id.au> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* templates: add basic string functionsMoritz Poldrack2024-01-192-5/+55
| | | | | | | | | | | | | Some clients are sending a text/plain part that contains nothing but the text/html part. This is rather suboptimal when replying. To be able to filter these, it is important to be able to detect things like <!doctype html>. Add basic string operations to the template functions. Signed-off-by: Moritz Poldrack <git@moritz.sh> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* git-stats-graph: fix release datesBence Ferdinandy2024-01-191-1/+3
| | | | | | | | The dates associated with tags and HEAD was always the previous tag. Fix the indexing for date parsing. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* check-patches: enforce trailer listBence Ferdinandy2024-01-182-0/+55
| | | | | | | | | | | | With the new Changelog-*: trailers it's important that trailers are not misspelled accidentally and to cut down on trailer clutter. Add an explicit list of accepted trailers with their preferred ordering and some explanation where warranted to CONTRIBUTING. Enforce the list in CI. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* check-patches: enforce prose on changelog entriesBence Ferdinandy2024-01-182-1/+9
| | | | | | | | | | Check if the Changelog-*: trailers have proper English sentences starting with a capital letter and ending in a period. Update CONTRIBUTING with an explicit mention of this. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* check-patches: check for a prefix in commit titleBence Ferdinandy2024-01-181-0/+4
| | | | | | | | | | The contributing guidelines ask for a use of a short prefix in the commit title. Delegate nitpicking about the existence of the prefix to the CI. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* check-patches: factorize codeRobin Jarry2024-01-181-7/+12
| | | | | | | Reduce code duplication. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com>
* rfc822: modify unit tests for message date parsingVitaly Ovchinnikov2024-01-171-6/+21
| | | | | | | | | | | Modify the message date parser tests so they accept all the possible parsing results, depending on the user's locale settings. Fixes: 49a8cf10935f ("rfc822: improve dates parsing") Reported-by: Jason Cox <me@jasoncarloscox.com> Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* rmdir: allow removing non-empty query dirsJason Cox2024-01-171-5/+8
| | | | | | | | | | | Notmuch query directories aren't backed by a filesystem directory, so deleting them doesn't actually delete any messages. Allow removing such directories even when they aren't empty to avoid the need to use the somewhat scary -f flag. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* reply,forward: use selected message partSebastien Binet2024-01-173-9/+18
| | | | | | | | | | Use the currently selected message part (if any) as the original message for quote-reply and forward. Honor viewer::alternatives if no message part was selected. Signed-off-by: Sebastien Binet <s@sbinet.org> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* z: complete with fs folders instead of account foldersRobin Jarry2024-01-171-1/+1
| | | | | | | | | | | GetFolders returns the current account email folders, not filesystem folders. Use CompleteDirs instead. Fixes: abe228b14d97 ("commands: use completion from go-opt") Fixes: https://todo.sr.ht/~rjarry/aerc/205 Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* z: fix arguments handlingRobin Jarry2024-01-171-12/+16
| | | | | | | | | | | Having both a string argument with a default value and an optional list of strings breaks completion with go-opt. Replace with a single argument and update all code accordingly. Fixes: abe228b14d97 ("commands: use completion from go-opt") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* cd: fix completion of folders with a spaceRobin Jarry2024-01-178-19/+21
| | | | | | | | | | | | | | Folders that contain spaces are surrounded by quotes. They can never end with '/'. Hence they are never returned in the completion results. Update CompletePath with an additional onlyDirs argument to take care of this before quotes are inserted. Fixes: abe228b14d97 ("commands: use completion from go-opt") Fixes: https://todo.sr.ht/~rjarry/aerc/204 Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* commands: simplify CompletePathRobin Jarry2024-01-177-50/+81
| | | | | | | | | | | | This function is overly complex, has code duplication and is not preserving user input (converting all paths to absolute paths). Simplify it and avoid converting relative paths to absolute ones. Add unit tests to ensure it works as expected. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* contrib: add commit-msg git hookRobin Jarry2024-01-173-0/+83
| | | | | | | | | Add a script that deals with the proper formatting and ordering of git trailers. Install it as commit-msg git hook so that everyone can benefit from it. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* config: remove deprecated settingsMoritz Poldrack2024-01-085-511/+0
| | | | | | | | | | Several settings have been deprecated a few versions ago and announced their removal in 0.17. Remove these deprecated sections and their uses. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* templates: move signature from compose to templatesBence Ferdinandy2024-01-087-91/+74
| | | | | | | | | | | | | | | | Currently, when composing a new message, everything is read from the template files, except the signature, which is added directly in the compose code. Add a new template variable {{.Signature}}, by moving the logic of reading signature from command or file from compose to templates. Update the various default template files to preserve the original placement of signatures. Users using the default templates should not notice the change. Users with custom compose templates will need to update their templates with {{.Signature}}. Changelog-changed: Signature placement is now controlled via the `{{.Signature}}` template variable and not hardcoded. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: treat folded threads as one entityKoni Marti2024-01-071-1/+30
| | | | | | | | | | Treat folded threads as one entity and apply any operation on its hidden children as well. Fixes: https://todo.sr.ht/~rjarry/aerc/206 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: keep track of all siblings in threadJason Cox2024-01-071-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider a thread with a root message and three child messages, each of which has a single child message, like so: root child 1 grandchild 1a child 2 grandchild 2a child 3 grandchild 3a With the previous implementation, if child 2 (or child 3) is not shown by the current query, then grandchild 2a (or grandchild 3a) will not be shown either. Ensure that this bug does not occur; that is, ensure that children of non-queried non-first-child messages are shown in threads. A more complex implementation is possible that maintains only a single loop over the messages, but thinking about it made my head hurt. Use a second (at times redundant) loop instead for simplicity's sake. Changelog-fixed: Don't lose child messages of non-queried parents in notmuch threads Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* sendemail-validate: try regular make if gmake not availableJason Cox2024-01-071-1/+2
| | | | | | | | Some OSes (e.g., Arch Linux) ship GNU Make but only provide the `make` executable. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* deps: bump emersion/go-maildir to v0.4.0:George Honeywood2024-01-072-3/+3
| | | | | | | | | | | this fixes a bug that prevented reading maildirs with paths containing `:` characters, among other changes changelog here: https://github.com/emersion/go-maildir/releases Signed-off-by: George Honeywood <aerc@george.honeywood.org.uk> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* ci: fix buildsMoritz Poldrack2024-01-071-0/+1
| | | | | | | | | The alpine runner does not natively contain curl. Add it to the list of required packages. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* doc: fix typo in aerc-tutorialRobin Jarry2024-01-061-1/+1
| | | | | | | There's no colorized filter. Fixes: c56e938f9c82 ("doc: proofreading") Signed-off-by: Robin Jarry <robin@jarry.cc>
* colorize: add small description in helpRobin Jarry2024-01-061-0/+2
| | | | | | For some reason there was none. Be consistent with wrap. Signed-off-by: Robin Jarry <robin@jarry.cc>
* templates: add full path of file(s) as Filename(s)Bence Ferdinandy2023-12-317-0/+41
| | | | | | | | | | | | | For the maildir and notmuch backends, add the full path of the message as Filename to templates. In case of a notmuch message having multiple files associated with it, it returns a random path. Also add Filenames to templates, which is a list of all associated message paths. This is relevant for the notmuch backend, where a single messages is shown, if there are multiple copies of it. Changelog-added: Add filepath to messages in templates as .Filename(s) Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: fix abbreviations regressionVitaly Ovchinnikov2023-12-311-7/+7
| | | | | | | | | | Make commands abbreviations work again by fixing the mistake introduced in one of the recent commits. Fixes: 07c1cefcf62d ("patch: create sub-command structure") Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>