aboutsummaryrefslogtreecommitdiffstats
path: root/commands
Commit message (Collapse)AuthorAgeFilesLines
...
* commands: allow to forward from emlKoni Marti2024-02-141-7/+25
| | | | | | | | | | | Forward messages from the message viewer when they are opened with :eml (e.g. rfc822 attachments). Those messages have no associated message store and currently :forward would complain about that. References: https://todo.sr.ht/~rjarry/aerc/227 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: allow to reply to emlKoni Marti2024-02-141-6/+11
| | | | | | | | | | | | | | | | Reply to messages in the message viewer that were opened with :eml (e.g. rfc822 attachments). Those messages have no associated message store and currently :reply would complain about that. However, we can still use the message data to create a reply, but we would have to disable setting the replied flag and/or archiving messages (obviously, these operations don't make sense for such messages in the first place). Implements: https://todo.sr.ht/~rjarry/aerc/227 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* log: move package to libRobin Jarry2024-02-1431-31/+31
| | | | | | | This has nothing to do at the root of the source tree. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
* commands: add bounceKarel Balej2024-02-121-0/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a command to allow for reintroduction of messages into the transport system. This means taking a message and forwarding it to new recipients as is including original headers. The fact that the message has been bounced is indicated by the prepend of *Resent-* headers in accordance with RFC 2822. The bounced message is not stored in the sent mailbox. Also add an `-A` switch to allow for bouncing using different account than the one currently selected. Also add default keybind and documentation entry for this command. The mentioned RFC also recognizes *Resent-Cc* and *Resent-Bcc* headers which might be an interesting continuation of this -- currently all recipients are specified in *Resent-To*. Also more control over the *Resent-From* header value could be implemented. This command is strongly inspired by (neo)mutt's `bounce`. Implements: https://todo.sr.ht/~rjarry/aerc/115 Changelog-added: `:bounce` command to reintroduce messages into the transport system. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* send: move code to lib for reuseKarel Balej2024-02-121-315/+7
| | | | | | | | | | | | | Move the code which handles the preparation of a sender into which the message can be written into lib to allow for reuse. Also hide the sending backend a bit more from the `:send` command code by introducing a NewSender function which determines which backend should be used and invokes the appropriate sender factory function. Rename send() to sendHelper() to avoid collision. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* jmap: set explicit sender and recipientsKarel Balej2024-02-121-4/+4
| | | | | | | | | | | | | | | JMAP is able to automatically determine sender and recipients based on the message headers after it is submitted for sending. However this means that it is not possible to send a message with the From header not matching the account with this approach (or to send the message to recipients not listed in the headers). Luckily, JMAP allows setting the envelope containing the envelope sender and recipients manually. Modify the code to do so. Also bump go-jmap to include a fix needed for this to work. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* send: remove the sendCtx structKarel Balej2024-02-121-77/+54
| | | | | | | | | | | Remove all use of the sendCtx struct and instead only pass the minimum required data to sender factory functions. Also introduce shouldCopy variable instead of evaluating all copying prerequisities every time. Fix preposition in SMTP error message. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* send: refactor parseSchemeKarel Balej2024-02-121-8/+8
| | | | | | | Rename several variables to better distinguish their meaning. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: replace tcell keys with vaxis keysTim Culverhouse2024-02-121-2/+5
| | | | | | | Replace all instances of tcell key usage with vaxis keys Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: change event interfaces to vaxis eventsTim Culverhouse2024-02-122-4/+4
| | | | | | | | | | Modify the function signature of Event and MouseEvent interfaces to accept vaxis events. Note that because a vaxis event is an empty interface, the implementations are not affected and the events are delivered as they were before Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* filter: allow workers to combine filter termsKoni Marti2024-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the backend workers to combine the filter terms. Currently, the consecutive filters are joined in the message store with a space (" "). This works well for most backends, but makes the filter combination for notmuch confusing. Example: Issuing two consecutive filter commands in notmuch :filter not tag:list :filter tag:list would create the following filter query 'not tag:list tag:list' This is not what users would expect; they expect: '(not tag:list) and (tag:list)' Note that the notmuch backend works correctly for the given query, but produced a query that does not match the user's expectation. This patch fixes this. The combination of filter terms in other backends remains the same. Reported-by: Ángel Castañeda <angel@acsq.me> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: add alignKoni Marti2024-02-111-0/+60
| | | | | | | | | | | | | | | | | | | | | Add a new :align command that aligns the selected message vertically at the top, center, or bottom of the message list. The command requires a position argument that can either be: "top", "center", or "bottom". Create the following default keybinds: zz = :align center<Enter> zt = :align top<Enter> zb = :align bottom<Enter> Changelog-added: Add new `:align` command to align the selected message at the top, center, or bottom of the message list. Suggested-by: Ángel Castañeda <angel@acsq.me> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: rename patch delete to patch unlinkKoni Marti2024-01-311-9/+9
| | | | | | | | | | | Rename the command :patch delete to :patch unlink. This expresses the "link" between the project data within aerc and the underlying repository better. :patch unlink does not delete anything in the repository, it only removes the metadata about currently applied patch revisions/tags. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: rename patch remove to patch dropKoni Marti2024-01-311-9/+9
| | | | | | | | Rename the :patch remove command to :patch drop to better express the this operation is the counter-part to :patch apply. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* menu: use listbox as fallback commandKoni Marti2024-01-291-27/+76
| | | | | | | | | | | | Implement the listbox widget as fallback picker when no command to :menu was specified or the command cannot be found in PATH. The listbox will also be used with "-" as the shell command: :menu -c "-" -d :cf Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* app: define two dialog constructorsKoni Marti2024-01-295-39/+5
| | | | | | | | | | | | | Define two new constructor functions for the popup dialog. DefaultDialog() creates a dialog that spans half of the screen, whereas the LargeDialog() covers three-quarter of the screen. If a dialog widget has more specific size requirements, custom window position and window height functions can be used with NewDialog(). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* help: add :man as aliasBence Ferdinandy2024-01-271-1/+1
| | | | | | | | Since except for :help keys, we literally open man with the appropriate aerc manpages, it makes sense to have that as an alias. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* mv: fix regression in selection of next messageJohannes Thyssen Tishman2024-01-271-6/+15
| | | | | | | | | | | | | | | Commit 41c25caafd58 ("mv: allow to move messages across accounts") introduced a regression where moving a message causes the last message in the list to be selected instead of the next available one. Record the next message to jump to *before* actually jumping. Fixes: 41c25caafd58 ("mv: allow to move messages across accounts") Fixes: https://todo.sr.ht/~rjarry/aerc/219 Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* flags: add support for draft flagJason Cox2024-01-265-7/+15
| | | | | | | | | | | | | | 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>
* tabs: optimize switching by offsetsdelitako2024-01-262-18/+13
| | | | | | | | | | | | | | | | | 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>
* mv: allow to move messages across accountsJohannes Thyssen Tishman2024-01-252-27/+148
| | | | | | | | | | | | 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-251-19/+105
| | | | | | | | | | | | 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>
* hook: add mail-sent hookMoritz Poldrack2024-01-251-0/+9
| | | | | | | | | 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>
* 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>
* commands: add menuRobin Jarry2024-01-202-1/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2095-336/+653
| | | | | | | | | | | | | | | | | | 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>
* 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>
* 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>
* 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>
* patch/find: add find sub-cmdKoni Marti2023-12-301-0/+132
| | | | | | | | 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-301-11/+23
| | | | | | | | | | | | | | | | | | | | | | 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-301-0/+54
| | | | | | | | 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-301-0/+54
| | | | | | | | | 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-302-0/+363
| | | | | | | | | | | | | | | | | 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-301-0/+43
| | | | | | | | | | | 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-301-0/+113
| | | | | | | | | 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-303-0/+317
| | | | | | | | | | 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-301-0/+36
| | | | | | | 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-302-1/+77
| | | | | | | | 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>
* doc: add aerc-patchKoni Marti2023-12-301-0/+1
| | | | | | | | | Document the local patch management. Adjust the help command. Add default key binds. Changelog-added: Patch management with `:patch`. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* cf: allow changing folder of another accountRobin Jarry2023-12-051-23/+66
| | | | | | | | | | | | | | Add a new -a flag to :cf. When specified, an account name is required before the folder name and the focus will be changed to the corresponding account tab before changing folders. If the target folder does not exist, an explicit error will be reported. Changelog-added: Change to a folder of another account with `:cf -a <account> <folder>`. Signed-off-by: Robin Jarry <robin@jarry.cc> Co-authored-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>