aboutsummaryrefslogtreecommitdiffstats
path: root/commands
Commit message (Collapse)AuthorAgeFilesLines
...
* rmdir: ensure proper sequence of operationsKoni Marti2023-11-122-13/+43
| | | | | | | | | | | | | | | | | | | | Ensure the proper sequence of opening and removing a directory. Fix a potential race between the OpenDirectory (issued by dirlist.Select()) and the RemoveDirectory messages when removing a directory. Due to the delay in the current dirlist.Select() function, the RemoveDirectory message can arrive at the backend before the directory was changed to a different one. This can cause an error on some imap servers and problems with the watcher on the maildir backends. Introduce dirlist.Open() that accepts a callback function so that the operations can be performed in proper sequence. Dirlist.Select() is now a wrapper call to dirlist.Open(). Reported-by: inwit <inwit@sindominio.net> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* {im,ex}port-mbox: allow using ~ in pathVitaly Ovchinnikov2023-11-122-0/+6
| | | | | | | | Add ~ support to :export-mbox and :import-box the same way as it is done in :save. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: correct some push status messagesinwit2023-11-124-4/+31
| | | | | | | | | | | Upon success, commands :delete, :copy, :archive and :move show "Messages deleted/copied/archived/moved" in the status bar, which is obviously wrong if they are acting upon only one message. Make the success notification for those commands explicitly agree with the actual number of messages. Signed-Off-By: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* cf: do not quote notmuch queries in completion resultsRobin Jarry2023-11-021-1/+15
| | | | | | | | | | Notmuch queries should not be quoted, they will be interpreted by the notmuch library. Make sure not to return quoted results for directories which have the role == "query". Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* completion: refactor filter list apiRobin Jarry2023-11-0217-36/+45
| | | | | | | | | | | | Remove CompletionFromList which is a trivial wrapper around FilterList. Remove the prefix, suffix and isFuzzy arguments from FilterList. Replace prefix, suffix by an optional callback to allow post processing of completion results before presenting them to the user. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* hooks: add mail-added hookJason Cox2023-11-023-58/+71
| | | | | | | | | | | | | | The mail-added hook runs whenever a message is added to a folder. Note that the hook does not run when a new message is received (the mail-received hook already covers that) but instead runs whenever aerc itself adds a message to a folder, e.g. when moving or copying a message. Changelog-added: `mail-added` hook that triggers when a message is added to a folder. References: https://todo.sr.ht/~rjarry/aerc/136 Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* hooks: add mail-deleted hookJason Cox2023-11-021-11/+11
| | | | | | | | | | | | The mail-deleted hook runs whenever a message is deleted from a folder. Note that this means moving a message from one folder to another triggers the mail-deleted hook. Changelog-added: `mail-deleted` hook that triggers when a message is removed/moved from a folder. References: https://todo.sr.ht/~rjarry/aerc/136 Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* fold: add an option to toggle foldinginwit2023-11-021-4/+6
| | | | | | | | | | Add a toggle option (-t) to :fold/:unfold commands to allow for switching the folding status of a thread. Changelog-Added: Toggle folding with `:fold -t`. Signed-Off-By: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Jason Cox <me@jasoncarloscox.com>
* cf: fix unexpected argument on notmuchRobin Jarry2023-10-301-3/+21
| | | | | | | | | | | | | | Notmuch supports creating "dynamic" folders with the :cf command. When the backend is notmuch, :cf must accept multiple arguments since it can be a free-form notmuch query. Detect if the backend is notmuch and build a quoted query based on the provided arguments. Otherwise require a single argument. Fixes: e54486ee40c9 ("commands: parse arguments with go-opt") Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* complete: add trailing space after quotesRobin Jarry2023-10-301-2/+2
| | | | | | | | | | | | Currently, completing `:tag +forw` gives: '+forwarded ' instead of simply +forwarded without quotes with an embedded trailing space. Add the suffix *after* quoting. Fixes: abe228b14d97 ("commands: use completion from go-opt") Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* treewide: replace shlex.Split with opt.SplitArgsRobin Jarry2023-10-281-5/+3
| | | | | | | | | | Replace the remaining shlex.Split calls with opt.SplitArgs. Remove dependency to shlex. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* commands: use completion from go-optRobin Jarry2023-10-2880-967/+196
| | | | | | | | | | | Implement command completion with complete struct field tags from the get-opt library introduced earlier. Changelog-changed: Improved command completion. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* commands: remove command set completion apiRobin Jarry2023-10-282-50/+14
| | | | | | | | | | | Do not expose the completion of a command via its command set. Instead, require a single command object to be resolved in order to execute it. Extract the command names and the template terms completions in main.go. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* pipe: run commands with sh -cRobin Jarry2023-10-281-11/+14
| | | | | | | | | | | | Change the Cmd argument to a plain string that preserves shell quoting. Use this for sh -c instead of a list of arguments. Changelog-changed: `:pipe` commands are now executed with `sh -c`. Requested-by: Vitaly Ovchinnikov <v@postbox.nz> Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* open: run commands with sh -cRobin Jarry2023-10-283-4/+4
| | | | | | | | | | | Allow running shell commands in openers. Changelog-changed: `:open` commands are now executed with `sh -c`. Requested-by: Vitaly Ovchinnikov <v@postbox.nz> Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* search: use a common api for all workersRobin Jarry2023-10-281-4/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | Define a SearchCriteria structure. Update the FetchDirectoryContents, FetchDirectoryThreaded and SearchDirectory worker messages to include this SearchCriteria structure instead of a []string slice. Parse the search arguments in a single place into a SearchCriteria structure and use it to search/filter via the message store. Update all workers to use that new API. Clarify the man page indicating that notmuch supports searching with aerc's syntax and also with notmuch specific syntax. getopt is no longer needed, remove it from go.mod. NB: to support more complex search filters in JMAP, we need to use an email.Filter interface. Since GOB does not support encoding/decoding interfaces, store the raw SearchCriteria and []SortCriterion values in the cached FolderContents. Translate them to JMAP API objects when sending an email.Query request to the server. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* commands: parse arguments with go-optRobin Jarry2023-10-2875-1346/+673
| | | | | | | | | | | | | | | | | | | | | | | | | | Use the argument parsing framework introduced earlier to unify the parsing of (almost) all command options. Remove custom parsing code and to avoid extraneous types, add fields with `opt` tags on command structs that have options and arguments. Commands that take no argument do not need anything. Since the command objects now carry data, create a new temporary instance of them before passing them to opt.ArgsToStruct when executing a command. A few of the commands use specific semantics for parsing (:choose), or are delegating argument parsing to another function (:sort, :search, :filter). For these commands, simply add a dummy "-" passthrough argument. Since all commands still have the argument list (after split) nothing needs to be changed in this area. There should be no functional change besides the Usage strings and reported errors which are now generated automatically. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* commands: remove command set execute apiRobin Jarry2023-10-281-9/+5
| | | | | | | | | | Do not expose the execution of a command via its command set. Instead, require a single command object to be resolved in order to execute it. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* commands: expand templates before command resolutionRobin Jarry2023-10-281-20/+9
| | | | | | | | Move the template expansion before the command name is looked up. It saves a few void renderings and will be required for the next commits. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* commands: pass raw command line down to template evaluationRobin Jarry2023-10-284-158/+23
| | | | | | | | | | | | | | | | | | | | | | | | Some commands need to invoke others and/or run shell commands. For this, we need the raw command line as entered by the user. Pass it down the call chain just before it is split to invoke the command Execute method. Remove unit tests for the template expand() test which does have any added value now that it is performed on a single string without any quote juggling. Update all code to handle a single string instead of a list of arguments. Introduce a new dependency on git.sr.ht/~rjarry/go-opt to deal with shell splitting. This is in preparation for using opt.ArgsToStruct to parse arguments for all aerc commands. There should be no functional change after this patch. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* commands: add :suspendNojus Gudinavičius2023-10-241-0/+22
| | | | | | | | | Add :suspend to suspend the aerc process, returning to shell. Include documentation and default Ctrl-z keybinding for it. Changelog-added: New `:suspend` command bound to `<C-z>` by default. Signed-off-by: Nojus Gudinavičius <nojus.gudinavicius@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc>
* export-mbox: preserve the user-visible sorting order when exportingVitaly Ovchinnikov2023-10-221-6/+47
| | | | | | | | Export messages to mbox format in the same order as they are displayed to the user. Both marked-only and "full" export modes are supported. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Acked-by: Robin Jarry <robin@jarry.cc>
* accounts: allow fnmatch-style wildcards in aliasesJason Cox2023-10-222-38/+35
| | | | | | | | | | | | | | | | | Wildcard aliases make it possible to always reply from the same address to which a message was addressed, which is useful for catch-all email domains. Support fnmatch-style wildcards in only the address portion of an alias. When replying to a message that matches a wildcard alias, substitute the matching email address for the wildcard address, but keep the name specified with the wildcard address. For example, when the alias "Someone Awesome" <*@someone.com> is present, the reply to an email addressed to "Someone" <hi@someone.com> would be from "Someone Awesome" <hi@someone.com>. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: add `:send-keys` commandVitaly Ovchinnikov2023-10-221-0/+51
| | | | | | | | | | | | Add a new command for sending keystrokes to the active terminal, if there is one visible. Covers split preview, message viewer, composer and the terminal mode. This can be used to navigate the embedded applications to scroll or safely quit them when needed. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Acked-by: Robin Jarry <robin@jarry.cc>
* sort: new `flagged` sorting criteriaVitaly Ovchinnikov2023-10-131-0/+1
| | | | | | | | | Add new `flagged` criteria to `:sort` command (and apparently to the `sort` config option). Good for moving important stuff up. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* send: add option to overwrite copy-to folderKoni Marti2023-10-131-15/+34
| | | | | | | | | | | | | | | | Add -t option to specify a folder that will overwrite the default Copy-To folder from accounts.conf. This allows you to keep the sent messages in the desired folder. Use templates to create a keybind and always keep the sent messages in the currently selected folder: :send -t {{.Folder}} Fixes: https://todo.sr.ht/~rjarry/aerc/187 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Maarten van Gompel <proycon@anaproy.nl>
* split: add an alias for horizontal splitinwit2023-10-131-4/+4
| | | | | | | | | | To date, there are two orthogonal commands named :vsplit and :split, which create a vertical and a horizontal split, respectively. Add a :hsplit alias for the latter. Signed-Off-By: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
* app: export global functionsRobin Jarry2023-10-1078-492/+479
| | | | | | | | | | | | | | | The single Aerc object is passed around in almost all command functions. This hinders readability. Store the single Aerc instance as a global variable. Export public functions from the app package to access methods of that object. Remove all explicit references to *app.Aerc and replace them with calls to these functions. For references to private/unexported fields and functions from within the app package, directly access the global aerc object. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* widgets: rename package to appRobin Jarry2023-10-1078-340/+340
| | | | | | | | | This is the central point of all aerc. Having it named widgets is confusing. Rename it to app. It will make a cleaner transition when making the app.Aerc object available globally in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* commands: add :toggle-thread-context commandTim Culverhouse2023-09-271-0/+36
| | | | | | | | | Add a command to toggle the display of an thread-context. Update CHANGELOG. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: enable showing of thread-contextTim Culverhouse2023-09-271-0/+1
| | | | | | | | | | | | | | | Add a UI config value to enable showing of "thread-context", similar to `notmuch show --entire-thread=true`. Add an associated style called "msglist_thread_context" which can be used to style such messages. Currently this feature is only supported by notmuch. It would be possible for maildir to implement as well, IMAP with gmail custom extensions, and JMAP. This patch merely implements the notmuch version and puts the groundwork in for handling these sorts of displays. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* postpone: remove datacounter passthrough writerTim Culverhouse2023-08-311-7/+5
| | | | | | | | | Remove the use of package datacounter and it's passthrough write counter. We can directly get the quantity of bytes written to our buffer with buf.Len() Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* postpone: change recall/postpone logic for custom foldersVitaly Ovchinnikov2023-08-302-27/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change `:recall -f` behavior so it remembers the source folder the message is taken from and the further `:postpone` call can save it back to that folder. Change the `:recall` tab closing behavior, so it no longer asks if the recalled message needs to be deleted. This is now done automatically. Add an optional `-t <folder>` parameter to `:postpone`, so the message can be saved in a different folder. Change `:postpone` behavior, so it checks if the message was force-recalled from a different folder, and then it saves the message there. The "breaking" change is made to the closing handler of the recalled message tab. There was a confirmation dialog that asked if the recalled message needs to be deleted. This is now removed and replaced with a pretty simple logic: if the recalled message is either sent or re-postponed - it is safe to delete the original. Otherwise (if the recalled message editing is discarded, any other reasons?) the message is left intact, there is no need to ask for deleting it. If the user don't need that message - they can delete it manually. Another "breaking" change to the same handler is that it always works this way regardless of the curently selected folder. There was an `if` that checked that, but as the recalled messages are now only deleted if they are re-sent or re-postponed, it seems that there is no need to check the current folder anymore. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Acked-by: Robin Jarry <robin@jarry.cc>
* xdg: get rid of deprecated dependenciesRobin Jarry2023-08-275-31/+12
| | | | | | | | | | | github.com/mitchellh/go-homedir has not received any update since 2019. The last release of github.com/kyoh86/xdg was in 2020 and it has been marked as deprecated by its author. Replace these with internal functions. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
* export-mbox: better path suggestion and name completionVitaly Ovchinnikov2023-08-251-8/+11
| | | | | | | | | | | | Change the `:export-mbox` path completion algorithm, so it works the same as `:import-mbox`: the user can select folders with auto-complete, the ~ symbol works as home folder and so on. Move the automatic mbox-file naming into the export function and only use it if the user-supplied path is an existing folder. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: allow reading attachments from a fileKarel Balej2023-08-241-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Currently, aerc reads a list of files to be attached to a message from the file-picker-cmd's standard output. However, this doesn't play nice with ranger which seems to draw itself by writing there, causing it to be invisible in the embedded terminal. In fact, instead of using a pipe, aerc redirects the output of the command to a temporary file and then reads the list of files from there. Take advantage of this approach and allow user to directly reference this temporary file in the file-picker-cmd via the %f placeholder, which gets expanded to the temporary file's location. If the %f placeholder isn't present, keep the old behaviour. So for example, now it is possible to do: file-picker-cmd=ranger --choosefiles=%f in aerc.conf. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
* export-mbox: only export marked messages, if anyVitaly Ovchinnikov2023-08-051-3/+23
| | | | | | | | | | Change the `:export-mbox` behavior, so if some messages are marked with `:mark` - only those messages are exported. If nothing is marked - the whole folder is exported, as usual. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
* attach: add an option to pipe the attachments inVitaly Ovchinnikov2023-08-051-6/+72
| | | | | | | | | | | | | | | Add the -r option to :attach so that the attachments can be piped in from a command. Example: :attach -r image.jpg read-jpeg-from-clipboard.sh It takes two parameters: the attachment name (to be used in the email and to get the MIME type from) and the command to execute and read the output. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Acked-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com>
* templates: attach directly from templatesKoni Marti2023-08-031-0/+1
| | | | | | | | | | | | | | | | | | Attach a file from templates. Add a split template function. {{- .Attach "LICENSE" -}} or {{range (exec "find ./doc -type f -name *.scd" "" | split "\n") -}} {{with . }} {{- $.Attach . -}} {{- end}} {{- end}} Fixes: https://todo.sr.ht/~rjarry/aerc/109 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* wizard: display warning when focus is lostKoni Marti2023-08-031-0/+1
| | | | | | | | | | | | | | | Display the warning that the password is stored in plaintext after the focus of the password input field is lost. The current behavior of showing the warning after the first character is entered is ackward and confusing. It also eliminates the need to debounce the warning when a password is pasted. Reported-by: Brad <super1337@posteo.net> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: allow removing headersRobin Jarry2023-07-311-18/+26
| | | | | | | | Allow removing headers from the compose window when edit-headers=false (the default) with :header -d <name>. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
* split: ensure messagestore is availableMoritz Poldrack2023-07-281-0/+4
| | | | | | | | | | Checking that a messagestore is connected, prevents crashes when aerc has disconnected or :v?split is called without delay inside the aerc-startup hook. Reported-by: Ryan Roden-Corrent <ryan@rcorre.net> Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: allow changing edit-headers on the flyRobin Jarry2023-07-178-31/+115
| | | | | | | | | Add -e|-E flags to all compose commands to allow switching between edit-headers = true/false without restarting aerc. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* compose: implement embedded headers in editorKoni Marti2023-07-172-5/+3
| | | | | | | | | Implement embedded header mode in the composer widget. To activate it, use set [compose].edit-headers=true in aerc.conf. Signed-off-by: Koni Marti <koni.marti@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* compose: improve error handlingRobin Jarry2023-07-171-2/+8
| | | | | | | | | On error, return to the caller instead of logging a warning and trying to continue. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* compose: only allow setting content at creationRobin Jarry2023-07-177-60/+15
| | | | | | | | | | | | | Add a parameter for the initial value of the body to be inserted *before* the signature when composing a message. Make AppendContents and SetContents private methods to ensure there is no other way to change the composer contents from the outside after creation. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* send: return error when recipients list is emptyRobin Jarry2023-07-171-0/+3
| | | | | | | | Avoid sending messages with no recipients. Fixes: https://todo.sr.ht/~rjarry/aerc/182 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* templates: add ThreadCount and ThreadFoldedKoni Marti2023-07-161-0/+2
| | | | | | | | | | | | | | Add the number of threads and a flag to indicated folded threads to the template data. Use {{.ThreadCount}} and {{.ThreadFolded}} in template expression for the message list. column-subject = {{.ThreadPrefix}}{{if .ThreadFolded}}[{{.ThreadCount}}] {{end}}{{.Subject}} Update default configuration accordingly. Signed-off-by: Koni Marti <koni.marti@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: inwit <inwit@sindominio.net>
* commands: add :fold and :unfold for thread foldingKoni Marti2023-07-161-0/+49
| | | | | | | | | | Add the :fold and :unfold commands to perform thread folding. They only work on the selected message. Add vim-like bindings. Fixes: https://todo.sr.ht/~rjarry/aerc/148 Signed-off-by: Koni Marti <koni.marti@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: inwit <inwit@sindominio.net>
* threadbuilder: store uid/thread associationKoni Marti2023-07-161-6/+10
| | | | | | | | | | | | | | Store the association between uids and threads in a map instead of just having the threads in a slice. This simplifies the lookup of a thread when we have an uid and we can avoid computationally expensive tree walks. The threadbuilder will rebuild the uids from the given thread structure. Hence there is no need now to keep a threads slice around. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: inwit <inwit@sindominio.net>