aboutsummaryrefslogtreecommitdiffstats
path: root/commands
Commit message (Collapse)AuthorAgeFilesLines
* completion: complete paths with FilterListHEADdevelAndrew Jeffery12 days3-22/+77
| | | | | | | | | | | | Make the completion filtering for paths use the standard FilterList function. This leads to fuzzy filtering if configured, as per other completions. Changelog-changed: Path completion now uses the normal filtering mechanism, respecting case sensitivity and the fuzzy completion option. Signed-off-by: Andrew Jeffery <dev@jeffas.net> Acked-by: Robin Jarry <robin@jarry.cc>
* reply: consider the From address too when checking aliasesKarel Balej2024-10-241-0/+1
| | | | | | | | | | | | | This sets the likely usually desired From address when replying to a previously sent email and does not compose To the alias instead (unless reply-to-self is enabled). Changelog-fixed: Aliases are now taken into account correctly when replying to own messages such as from the Sent folder or via a mailing list. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* textinput: make completions run async with cancellationTim Culverhouse2024-10-242-2/+4
| | | | | | | | | | | | | | | | | | Make the Completer interface accept a context.Context. Provide a cancellation feature on text input tab completion to cancel an inflight completion command. This is particularly useful for address book completion if the user has specified a network-accessing command, eg carddav-query. The command is started according to the completion delay, but is cancellable if another request comes in. We also check for cancellation after the request is complete to ensure we only show valid completion results. Changelog-changed: Tab completions for text fields are run asynchronously. In-flight requests are cancelled when new input arrives. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* history: read the history file from XDG_STATE_HOMETristan Partin2024-10-241-2/+2
| | | | | | | | | | | History is more like application state than a cache you would just want to blow away. Let's reflect that in the path for the history file. Changelog-changed: The location of the command history file has changed to ${XDG_STATE_HOME:-$HOME/.local/state}/aerc/history. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* completion: add command option descriptionsRobin Jarry2024-10-2358-166/+155
| | | | | | | | | | | | | Add `desc:""` struct field tags in all command arguments where it makes sense. The description values will be returned along with completion choices. Implements: https://todo.sr.ht/~rjarry/aerc/271 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bojan Gabric <bojan@bojangabric.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* completion: add commands descriptionsRobin Jarry2024-10-2393-8/+375
| | | | | | | | | | | | | | | Update the Command interface to include a Description() method. Implement the method for all commands using short descriptions inspired from the aerc(1) man page. Return the description values along with command names so that they can be displayed in completion choices. Implements: https://todo.sr.ht/~rjarry/aerc/271 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bojan Gabric <bojan@bojangabric.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* completion: display descriptions next to choicesRobin Jarry2024-10-2312-17/+23
| | | | | | | | | | | | | | | | | | | | | | | | | Use go-opt v2 new completion API which returns items descriptions along with their text values. Display the descriptions after the items separated by two spaces. Wrap the descriptions in parentheses to better indicate that they are not part of the completion choices. Limit the description length to 80 characters to avoid display issues. Add a new style object completion_description in stylesets. By default, the object will be rendered with a dimmed terminal attribute. Update all stylesets and documentation accordingly. Implements: https://todo.sr.ht/~rjarry/aerc/271 Link: https://git.sr.ht/~rjarry/go-opt/commit/ebeb82538395a Changelog-added: Command completion now displays descriptions next to completion items. Changelog-added: New `completion_description` style object in style sets used for rendering completion item descriptions. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bojan Gabric <bojan@bojangabric.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* viewer: avoid crashes on opening invalid messagesRobin Jarry2024-10-226-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an error occurs during the opening of a message because its contents cannot be parsed, the PartSwitcher object is left to nil and the err field is set to the reported error. This defers the error reporting after the viewer tab is displayed but it is not handled in all sub functions which assume that switcher cannot be nil. Error: runtime error: invalid memory address or nil pointer dereference git.sr.ht/~rjarry/aerc/app.(*PartSwitcher).Show(...) /build/aerc/src/aerc/app/partswitcher.go:77 git.sr.ht/~rjarry/aerc/app.(*MessageViewer).Show(...) /build/aerc/src/aerc/app/msgviewer.go:409 git.sr.ht/~rjarry/aerc/lib/ui.(*Tabs).selectPriv(...) /build/aerc/src/aerc/lib/ui/tab.go:181 git.sr.ht/~rjarry/aerc/lib/ui.(*Tabs).Add(...) /build/aerc/src/aerc/lib/ui/tab.go:75 git.sr.ht/~rjarry/aerc/app.(*Aerc).NewTab(...) /build/aerc/src/aerc/app/aerc.go:511 git.sr.ht/~rjarry/aerc/app.NewTab(...) /build/aerc/src/aerc/app/app.go:61 git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute.func1(...) /build/aerc/src/aerc/commands/account/view.go:71 git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView.func1(...) /build/aerc/src/aerc/lib/messageview.go:80 git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView(...) /build/aerc/src/aerc/lib/messageview.go:124 git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute(...) /build/aerc/src/aerc/commands/account/view.go:52 git.sr.ht/~rjarry/aerc/commands.ExecuteCommand(...) /build/aerc/src/aerc/commands/commands.go:205 main.execCommand(...) Remove that private err field and return an explicit error when the message cannot be opened to enforce handling of the error by the caller. When the msg argument is nil (only used in split viewer), return an empty message viewer object and ensure that all code paths that read the switcher or msg fields perform a nil check before accessing it. Link: https://lists.sr.ht/~rjarry/aerc-devel/%3C12c465e4-b733-4b15-b4b0-62f87429fdf7@gmail.com%3E Link: https://lists.sr.ht/~rjarry/aerc-devel/%3C2C55CF50-A636-46E5-9BA8-FE60A2303ECA@proton.me%3E Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CD51PEB6OMNDT.1KVSX0UCNL2MB@posteo.de%3E Reported-by: Benjamin Braun <ben.braun@posteo.de> Reported-by: Filip <filip.sh@proton.me> Reported-by: Sarthak Bhan <sbstratos79@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc>
* invite: honor the -a flag for :sendinwit2024-10-211-1/+9
| | | | | | | | | | | | When sending replies to invitations with :accept, :accept-tentative or :decline, calling `:send -a` in the review screen does not archive the original invitation, as it should. Solve this situation and allow for directly archiving invitations after replying to them. Changelog-fixed: Invitations now honor the -a flag for :send. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* send: allow using envelope from addresshrdl2024-10-121-0/+5
| | | | | | | | | | Add a new boolean option in accounts.conf to use the envelope From address instead of the *from* configuration option when submitting via smtp, jmap or sendmail. Changelog-added: New `use-envelope-from` option in `accounts.conf`. Signed-off-by: hrdl <git@hrdl.eu> Acked-by: Robin Jarry <robin@jarry.cc>
* reply: make {{.OriginalText}} available to custom templatesJohannes Thyssen Tishman2024-10-121-8/+6
| | | | | | | | | | | | Currently {{.OriginalText}} is only available to the quote-reply template when using `:reply -q`. Allow templates specified using the `-T` flag to make use of it too. Changelog-changed: Templates passed to the `:reply` command using the `-T` flag can now make use of `{{.OriginalText}}`. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Acked-by: Robin Jarry <robin@jarry.cc>
* calendar: skip editor when replying to invitationsinwit2024-10-031-2/+7
| | | | | | | | | | | Most of the time, accepting an invitation does not require editing the automatically generated email before sending it. Allow the user to optionally skip the editor entirely and go directly to the review screen when dealing with invitations. References: https://todo.sr.ht/~rjarry/aerc/247 Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* commands: add an echo commandBence Ferdinandy2024-09-201-0/+26
| | | | | | | | | | | | | Currently if you want to explore what templates resolve to, it's a bit of pain. Add an echo command that doesn't do anything, other than prints the string that is its argument with the templates resolved. Implements: https://todo.sr.ht/~rjarry/aerc/277 Changelog-added: New `:echo` command that prints its arguments with templates resolved. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* treewide: replace uint32 uids with opaque stringsRobin Jarry2024-08-2817-43/+46
| | | | | | | | | | | | | | | | | Add a new models.UID type (an alias to string). Replace all occurrences of uint32 being used as message UID or thread UID with models.UID. Update all workers to only expose models.UID values and deal with the conversion internally. Only IMAP needs to convert these to uint32. All other backends already use plain strings as message identifiers, in which case no conversion is even needed. The directory tree implementation needed to be heavily refactored in order to accommodate thread UID not being usable as a list index. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* reload: reload everything if no flags are providedJason Cox2024-08-241-0/+6
| | | | | | | | | | | Currently, the :reload command silently does nothing if no flags are provided. Eliminate this confusion by reloading all reloadable configs in the absence of flags. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* forward: better preserve attached file namesVitaly Ovchinnikov2024-08-241-2/+2
| | | | | | | | | | | Use a dedicated filename function for getting a name of the attached file instad of analyzing its mime type. Some attachments have file name in `Content-Disposition` rather than `Content-Type`, the new method handles both cases. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: add reloadKoni Marti2024-08-201-0/+180
| | | | | | | | | | | | | | Add the reload command that performs a reload of config files. The reload command supports reloading the binds.conf and aerc.conf config files. Reloading will reload account views (including the directory list), message viewers, and composers. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* flag: manually toggle the forwarded taginwit2024-08-201-5/+13
| | | | | | | | | | Allow the user to manually set, unset and toggle the forwarded tag. Changelog-added: The :flag command now sets/unsets/toggle the forwarded tag. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* search: allow searching for forwarded messagesinwit2024-08-201-4/+5
| | | | | | | | | | | | Commands :search and :filter allow the use of certain flags (read, replied...) as search criteria. Allow for the use of the forwarded flag too. Changelog-added: Forwarded messages can now be searched for and filtered in notmuch and maildir. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* forward: allow forwarded flag to be setinwit2024-08-202-2/+11
| | | | | | | | | | | | Usually, a MUA sets a flag for messages that have been forwarded, but this is currently not the case for aerc. Consider the forwarded flag and prepare aerc to set it everytime the :forward command is called and ends successfully. Changelog-added: The :forward command now sets the forwarded flag. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* copy: add -d flag to decrypt before copyingKoni Marti2024-08-201-0/+32
| | | | | | | | | | | Add -d flag to the copy command to decrypt a message before copying it. Implements: https://todo.sr.ht/~rjarry/aerc/238 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Jens Grassel <jens@wegtam.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pipe: add -d flag to decrypt messageKoni Marti2024-08-201-0/+25
| | | | | | | | | | | Add -d flag to the pipe command to decrypt a message before it is piped. Implements: https://todo.sr.ht/~rjarry/aerc/238 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Jens Grassel <jens@wegtam.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* send: redact password in outgoing URI for loggingKoni Marti2024-08-201-1/+1
| | | | | | | | | | Redact the password in the outgoing URI for logging. This will replace the password by "xxxxx" and prevent a plaintext password leak in the logs. Signed-off-by: Koni Marti <koni.marti@gmail.com> Reviewed-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* view-message: add option to view message in background tabAron Lebani2024-08-041-4/+13
| | | | | | | | | | | | | | | Add a -b flag to the :view command to open messages in a background tab instead of automatically switching to the new tab after opening. This is similar to opening browser tabs in the background. More generally, adds a new function app.NewBackgroundTab so that it is possible to enable other tabs to be opened in the background in the future. Implements: https://todo.sr.ht/~rjarry/aerc/266 Changelog-added: Add `-b` flag to the `:view` command to open messages in a background tab. Signed-off-by: Aron Lebani <aron@lebani.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* search,filter: add flag to use custom extensionsKoni Marti2024-08-041-5/+27
| | | | | | | | | | | | | | | | | | Add an extension flag to the search/filter command which will provide different completion strategies for the search terms and instruct the backend to use custom extensions (such as X-GM-EXT-1) if available. The following examples are based on the Gmail extension (note that this should be enabled in your accounts.conf with 'use-gmail-ext=true'): :filter -e filename:pdf from:bob :filter -e has:attachment newer_than:2d :search -e is:read is:starred :search -e list:~rjarry/aerc-devel@lists.sr.ht Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* reply: allow copying to current folderRobin Jarry2024-08-033-10/+39
| | | | | | | | | Add a new copy-to-replied setting in accounts.conf to copy sent replies to the same folder than their replied message. Requested-by: Tristan Partin <tristan@partin.io> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tristan Partin <tristan@partin.io>
* reply: handle the Sender headerBence Ferdinandy2024-08-031-3/+12
| | | | | | | | | | | | | | | | | | | | | | Sometimes emails will have a Sender: header, that is different from the From: header. The only use of this in the wild I have seen to date is when meeting invitation is forwarded by somebody. The From: header will be the person organising the meeting, and the Sender: will be the person forwarding. Naturally, when one replies (e.g. with on accept), it should go to the meeting oragniser, but sometimes one would want to include the Sender in such a reply. When executing :reply determine the To: address in order of Reply-To:, From:, Sender:. When executing :reply -a, include the Sender: in Cc:. Implements: https://todo.sr.ht/~rjarry/aerc/259 Link: https://www.rfc-editor.org/rfc/rfc4021#section-2.1.3 Changelog-added: Replying to all will include the Sender in Cc. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Reviewed-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: add :redraw commandTim Culverhouse2024-08-031-0/+22
| | | | | | | | | | | Add a :redraw command to force a repaint of the entire screen. Changelog-added: New `:redraw` command to force a repaint of the screen. Requested-by: Remko Tronçon <r@mko.re> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* cc,bcc,forward: add completion from address bookRobin Jarry2024-06-252-2/+10
| | | | | | | | | | | | Allow using the address book for completion in the :cc, :bcc and :forward commands. Changelog-added: The address book is now used for `:cc`, `:bcc` and `:forward`. Requested-by: Maximilian Bosch <maximilian@mbosch.me> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Maximilian Bosch <maximilian@mbosch.me>
* next,prev: fix panic when message list is emptyRobin Jarry2024-06-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | When running :filter -u and iterating over all messages with maildir, the list will eventually become empty (e.g. all messages have been read, no unread messages can be displayed). At this point, :next or :prev will fail to select anything and the maildir backend will return an error. Since the error is not caught, the message viewer is reloaded with a broken message. At this point, any key press causes a panic. This only happens with maildir because message list filters are updated dynamically in the background everytime a filsystem event is triggered. Avoid reloading the message viewer if an error is returned by the backend. Just display the error and abort. Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CD1761AO8LJUL.12698V9VQDR9B@gmail.com%3E Reported-by: Matthew Bystrin <dev.mbstr@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
* dirlist: store previous folder infoKoni Marti2024-06-233-13/+12
| | | | | | | | | | Store the previous folder in the dirlist and retire the global 'history' map in the commands package. This ensures that the previous folder is always available when using ':cf -'. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* rmdir: allow specifying folder to deleteJason Cox2024-06-231-21/+47
| | | | | | | | | | | It's useful to delete folders other than the current one. If a folder is specified, delete that one; otherwise, delete the current one. Changelog-added: Allow specifying the folder to delete with `:rmdir`. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* query: allow forcing overwrite of existing folderBence Ferdinandy2024-06-234-6/+7
| | | | | | | | | | | | | | Currently, when using :query the user is forced to create a new folder for every query, since aerc doesn't allow overwriting an existing folder. Actually, "overwriting" an existing folder with a query is a non-destructive operation in the sense, that the underlying maildir is not touched, the only thing lost is the state in aerc. The current behaviour doesn't allow for a simple `:query -n query ` type of binding. Allow overwriting an existing folder with the -f flag. Changelog-added: Allow using existing directory name with `:query -f`. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: use AccountConfig.Backend instead of reflectBence Ferdinandy2024-06-053-14/+4
| | | | | | | | | Currently we use a convoluted way based on reflect to check what type of backend a command is running in. Use the new Backend variable available in AccountConfig instead to simplify the logic. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* hooks: add AERC_ACCOUNT_BACKEND to hooks with AERC_ACCOUNTBence Ferdinandy2024-06-051-0/+1
| | | | | | | | | | It can be good to know the backend used for an account in a hook. Add this information to all hooks that already pass the account name along. Changelog-added: Added `AERC_ACCOUNT_BACKEND` to hooks with `AERC_ACCOUNT`. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* move: avoid crash when message list is not readyRobin Jarry2024-06-041-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following crash: panic: runtime error: invalid memory address or nil pointer dereference goroutine 1 [running]: runtime/panic.go:770 +0x132 git.sr.ht/~rjarry/aerc/lib.(*MessageStore).Selected(...) git.sr.ht/~rjarry/aerc/lib/msgstore.go:709 git.sr.ht/~rjarry/aerc/commands/msg.Move.CallBack() git.sr.ht/~rjarry/aerc/commands/msg/move.go:178 +0x78 git.sr.ht/~rjarry/aerc/commands/msg.Move.Execute.func1() git.sr.ht/~rjarry/aerc/commands/msg/move.go:75 +0x90 git.sr.ht/~rjarry/aerc/lib.(*MessageStore).Move.func1() git.sr.ht/~rjarry/aerc/lib/msgstore.go:645 +0x138 When a move operation finishes, the callback is invoked but there is no guarantee that the target account has any message store ready (e.g. IMAP may be disconnected). Only access acct.Store() in the happy code path and even there, only use store if is is not nil. Fixes: 40c25caafd58 ("mv: allow to move messages across accounts") Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CD114PEHTFKRE.2R9XF4U2BBDD6@mailbox.org%3E Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CD118R1N4XZ1X.1ZFQPGG8DSCDA@schaeffer.tk%3E Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CD1B2PVIVGPOZ.1925R9LL60EAZ@disroot.org%3E Reported-by: Alex Freudenberg <alexfxd@mailbox.org> Reported-by: Evin Yulo <yujiri@disroot.org> Reported-by: Maarten Aertsen <sagi+aerc-devel@rtsn.nl> Reported-by: Yuri Schaeffer <yuri@schaeffer.tk> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Tristan Partin <tristan@partin.io>
* notmuch: add completions for :cf, :filter and :searchBence Ferdinandy2024-04-142-4/+31
| | | | | | | | | | | Add completion of notmuch search-terms for :cf, :filter and :search. Implements: https://todo.sr.ht/~rjarry/aerc/244 Changelog-added: Notmuch completions for `:cf`, `:filter` and `:search`. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Julio B <julio.bacel@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* query: add completions for notmuch search-termsBence Ferdinandy2024-04-142-2/+60
| | | | | | | | | | | | | | Add completions to :query for the notmuch search terms. Most search terms that seemed valid for interactive use in aerc are listed as options. Some of them (from, to, tag, path, and folder) get actual completions. The function was designed, so later patches can reuse it to add completions to :cf, :filter and :search for notmuch accounts. References: https://todo.sr.ht/~rjarry/aerc/244 Changelog-added: Notmuch search term completions to `:query`. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Julio B <julio.bacel@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* open: create a file even if filename is emptyBence Ferdinandy2024-04-141-1/+12
| | | | | | | | | Without a filename, aerc tries to open a directory. In this case, create a random filename. Fixes: d99c49de2fc1 ("open: preserve the original filename") Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: explicitly identify converted text/* partsRobin Jarry2024-04-131-2/+1
| | | | | | | | | | | | | | | | | | | | | When running :accept, an error is displayed on the review screen: text/calendar error: no command defined for mime/type When running :multipart text/xxx, its contents are not specified. They are regenerated every time the review screen is displayed. When running :accept, a text/calendar part is added with actual contents. Update the Part object to hold a boolean initialized when first being created. If body is nil, identify the part as "Converted" and update its contents every time the review screen is displayed. When body is not nil but contains text (e.g. when running :accept), identify the part as *not* converted and ignore the conversion step. Fixes: cbcabfafaab2 ("compose: allow writing multipart/alternative messages") Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* pipe: allow closing the terminal automaticallyJohannes Thyssen Tishman2024-04-132-2/+7
| | | | | | | | | | | | | Add a new -s flag to :pipe. When specified, the terminal tab opened by the :pipe command will be automatically closed after the process is completed instead of prompting for a key press. While this doesn't technically silence the command (the output is not suppressed), the output is not shown to the user. Changelog-added: Silently close the terminal tab after piping a message to a command with `:pipe -s <cmd>`. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Acked-by: Robin Jarry <robin@jarry.cc>
* open: preserve the original filenameMaarten Aertsen2024-04-131-15/+12
| | | | | | | | | | | | | Change the name of the temporary file that is :open'ed using the system handler from `aerc-<randint>.ext` to `aerc-<randint>/<actual-filename.ext>`. This preserves the original filename, while retaining collision avoidance and the current base location (os.TempDir()). Changelog-changed: `:open` commands now preserve the original filename. Signed-off-by: Maarten Aertsen <maarten@nlnetlabs.nl> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* send: prevent sending if multipart conversion failedVitaly Ovchinnikov2024-04-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given the following configuration: binds.conf: [compose::review] y = :multipart text/html<Enter>:send<Enter> aerc.conf: [multipart-converters] text/html = /path/to/some/script.sh /path/to/some/script.sh: #!/bin/sh exit 10 # falls for some reason When you press `y` aerc runs `:multipart` command and although it gets an error from the converter script, the error is ignored and then the `:send` command actually sends a broken message. Add ConversionError field to Composer.Part to track multipart conversion errors. Check for conversion errors in :send, block sending if the errors are found. There is no way to skip this like missing attachment or empty subject. This is done intentionally. The user needs to update or delete the problematic part before actually sending a message. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* config: make popover dialogs configurableJohannes Thyssen Tishman2024-04-024-19/+4
| | | | | | | | | | | | Add the [ui].dialog-{position,width,height} options in aerc.conf to set the position, width and height of popover dialogs such as the one from :menu, :envelope or :attach -m relative to the main window. Changelog-added: Add `[ui].dialog-{position,width,height}` to set the position, width and height of popover dialogs. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: add strategies for multi-file messagesJason Cox2024-04-026-21/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A single notmuch message can represent multiple files. As a result, file-based operations like move, copy, and delete can be ambiguous. Add a new account config option, multi-file-strategy, to tell aerc how to handle these ambiguous cases. Also add options to relevant commands to set the multi-file strategy on a per-invocation basis. If no multi-file strategy is set, refuse to take file-based actions on multi-file messages. This default behavior is mostly the same as aerc's previous behavior, but a bit stricter in some cases which previously tried to be smart about multi-file operations (e.g., move and delete). Applying multi-file strategies to cross-account copy and move operations is not implemented. These operations will proceed as they have in the past -- aerc will copy/move a single file. However, for cross-account move operations, aerc will refuse to delete multiple files to prevent data loss as not all of the files are added to the destination account. See the changes to aerc-notmuch(5) for details on the currently supported multi-file strategies. Changelog-added: Tell aerc how to handle file-based operations on multi-file notmuch messages with the account config option `multi-file-strategy` and the `-m` flag to `:archive`, `:copy`, `:delete`, and `:move`. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Tested-by: Maarten Aertsen <maarten@nlnetlabs.nl> Acked-by: Robin Jarry <robin@jarry.cc>
* detach: add glob supportTristan Partin2024-03-101-3/+41
| | | | | | | | | This matches the behavior of :attach. Changelog-added: The `:detach` command now understands globs similar to `:attach`. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* quit: add :q aliasTristan Partin2024-03-101-1/+1
| | | | | | | | | | | | This used to work, but after f3a61a34 (where :query) was added, we had two commands which then started with q. So, the automatic alias stopped working. Changelog-added: Specify a ":q" alias for quit. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: rename confusing constantsRobin Jarry2024-03-0441-47/+45
| | | | | | | | There is an overlap between ACCOUNT and MESSAGE. Rename ACCOUNT to MESSAGE_LIST and use MESSAGE_LIST|MESSAGE_VIEWER instead of MESSAGE. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
* commands: add :query to create named notmuch dirsJason Cox2024-02-264-23/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current :cf command can be used to create folders for arbitrary notmuch queries. These folders use the query as their namee. In some cases, though, it's useful to give a more human-readable name. Create a new :query command to allow doing so. The :query command accepts an optional -n flag to specify a name. The remaining arguments are interpreted verbatim as a notmuch query. If no name is specified, the query itself is used as the name. For example, to create a new folder with the full thread of the current message, named by its subject, run the following command: :query -n "{{.SubjectBase}}" thread:"{mid:{{.MessageId}}}" :query could have been implemented as an additional flag to :cf. Giving a name to the created folder would make the smantics of :cf strange, though. For example, to create a named query folder, one would use :cf -n <name> <query>. This syntax feels odd; the name of the folder seems like it ought to be the positional argument of the change folder command. Alternatively, the usage could be :cf -q <query> <name>, but this feels wrong as well: the query, which is provided as a positional parameter when no name is specified, becomes a flag parameter when a name is specified. What's more, both of these potential usages add a notmuch-specific flag to an otherwise general command. Creating a new command feels cleaner. Perhaps the current query functionality of the :cf command could eventually be deprecated to remove the duplicate functionality and keep :cf limited to changing to existing folders. Changelog-added: Create notmuch named queries with the `:query` command. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: remove compose commands from message viewerRobin Jarry2024-02-221-1/+1
| | | | | | | | | | | | | | | | All compose commands were made available in the message viewer context by mistake. Remove them. This fixes a crash when the :send command is invoked while viewing a message: Fixes: 159fb38daf53 ("commands: refactor registration") Fixes: https://lists.sr.ht/~rjarry/aerc-devel/%3CCZ01NTGWNUBV.14A9POG9ITJ6F%40posteo.net%3E Changelog-fixed: Fixed crash when running `:send` with a `:preview` tab focused. Reported-by: Sertonix <sertonix@posteo.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Maarten Aertsen <maarten@nlnetlabs.nl>