aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* msglist: refactor tree buildingMoritz Poldrack2023-12-301-35/+26
| | | | | | | | | | | | Our way of building trees seems absurd: generate a list of prefixes, reverse it, and trim the first element. Change it so the string is built back to front and define the arrows beforehand so they are easier to configure. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* imap: show parseable messages on errorMoritz Poldrack2023-12-301-12/+13
| | | | | | | | | | | | | Currently if there are mails aerc can not properly handle, listing the mailbox is aborted. This is especially bothersome if the message one is looking for would be parseable without issue. Show an error if parsing of a message fails, but handle all other messages as normal. This leads to those messages showing up as still loading. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* rfc822: improve dates parsingVitaly Ovchinnikov2023-12-302-10/+91
| | | | | | | | Provide better parsing of email dates with timezone names, but without numeric offsets. Add unit tests to check the new behaviour. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* commands/msg: adapt quote-reply to honor viewer::alternativesSebastien Binet2023-12-301-1/+8
| | | | | | | | modify quote-reply to quote the message part corresponding to the first MIME type matching the list in viewer::alternatives. Signed-off-by: Sebastien Binet <s@sbinet.org> Acked-by: Robin Jarry <robin@jarry.cc>
* lib: introduce FindMIMEPart, adapt Find{Plain,Calendar}textSebastien Binet2023-12-301-15/+10
| | | | | | | | | | introduce a general FindMIMEPart function to find a message part with the given MIME type. reimplement FindPlaintext and FindCalendartext in terms of this new FindMIMEPart function. Signed-off-by: Sebastien Binet <s@sbinet.org> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/find: add find sub-cmdKoni Marti2023-12-303-0/+161
| | | | | | | | Implement the :patch find command. Search and filter for a given commit by subject line in the current accout and current folder. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch: implement worktree supportKoni Marti2023-12-3010-31/+234
| | | | | | | | | | | | | | | | | | | | | | Implement worktree support for the patch management. Use ":patch apply -w <commit-ish> <tag>" to create a new worktree and apply the selected messages to it. The worktree is linked to repo in the current project. Internally, the worktree is stored as a new project. When this project is deleted with ":patch delete", the underlying linked worktree is removed as well. ":patch list" shows when a project is a worktree and to what project it is linked to. Worktrees enable the users to create a new copy of the repo at a given commit and apply patches without interrupting the current work in the base repo. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/switch: add switch sub-cmdKoni Marti2023-12-302-0/+83
| | | | | | | | Implement the :project switch command. Switch between different projects. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/delete: add delete sub-cmdKoni Marti2023-12-302-0/+99
| | | | | | | | | Implement the :patch delete command. Remove the project data from the permanent store. If no argument is provided, the current project will be deleted. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/term: add term sub-cmdKoni Marti2023-12-302-5/+50
| | | | | | | | | Implement the :patch term command. This will open a shell in the project's root directory that was defined during the :project init setup. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/rebase: add rebase sub-cmdKoni Marti2023-12-303-0/+444
| | | | | | | | | | | | | | | | | Implement the :patch rebase command. Rebase the internal patch data in case the repository was rebased too. The :patch rebase command accepts a optional argument which is used as the reference commit from which the rebasing will occur. Open an editor with the commits that are found on top of the rebase reference. Any untracked commit will have the tag 'untracked'. If a line is removed or the 'untracked' tag remains, it will be dropped from the internal data. To group commits into a patch set, assign the same tag names. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/cd: add cd sub-cmdKoni Marti2023-12-301-0/+42
| | | | | | | | Implement the :patch cd command. Change the directory to the project's root directory that was determined during the :patch init setup process. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/remove: add remove sub-cmdKoni Marti2023-12-304-0/+388
| | | | | | | | | | | Implement the :patch remove command. Remove a patch set from the respository and from the internal storage. Note that in git, this will change all commit hashes that appear after the removed one since the commit hash depends on its parents. Adjust the code to handle such cases and add tests for this. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/list: add list sub-cmdKoni Marti2023-12-306-17/+202
| | | | | | | | | Implement the :patch list command. List the the current project and add a flag to list all saved projects. Use the pager to display the data and extract the pager commands and move them into the config package. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/apply: add apply sub-cmdKoni Marti2023-12-305-3/+464
| | | | | | | | | | Add the :patch apply command to apply a patch set and create a corresponding tag. The tag command argument can be completed based on the subject lines of the selected messages. Add a test for the completion proposal. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/init: add init sub-cmdKoni Marti2023-12-303-0/+121
| | | | | | | Implement the :patch init command to initialize a new project. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch: create sub-command structureKoni Marti2023-12-303-2/+86
| | | | | | | | Create the sub-command structure for the :patch command. Make the :patch command accessible from any context. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pama: implement the persistent store for projectsKoni Marti2023-12-301-0/+244
| | | | | | | Implement the persistent store for models.Project structs. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pama: implement the revision control logicKoni Marti2023-12-302-0/+160
| | | | | | | | | Implement the RevisionController interface to interact with a respository control system. Add the implementation for git. Other revision systems such as mercurial, pijul or fossil can be extended. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pama: define the entity modelsKoni Marti2023-12-303-0/+260
| | | | | | | | Define the entity models for the patch management. Add a Project and Commit struct and implement the Stringer interface for both. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* contrib: fix check-docs for subcommandsKoni Marti2023-12-303-7/+7
| | | | | | | | Fix check-docs linter for subcommands, i.e. where spaces are between the root command and the subcommands such as in ":patch init". Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>