aboutsummaryrefslogtreecommitdiffstats
path: root/commands
Commit message (Collapse)AuthorAgeFilesLines
...
* delete: revert deleted messages if Delete is unsupportedTim Culverhouse2022-08-051-0/+3
| | | | | | | | | | Delete operations are not supported by the notmuch backend. Revert deleted messages when the operation is not supported, and reselect the original selection. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: work nicely with wrapped errors (errorlint)Moritz Poldrack2022-08-042-2/+2
| | | | | | | | Error wrapping as introduced in Go 1.13 adds some additional logic to use for comparing errors and adding information to it. Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: homogenize operations and minor fixes (gocritic)Moritz Poldrack2022-08-0414-48/+42
| | | | | | | | | | | | | | | | | | Apply GoDoc comment policy (comments for humans should have a space after the //; machine-readable comments shouldn't) Use strings.ReplaceAll instead of strings.Replace when appropriate Remove if/else chains by replacing them with switches Use short assignment/increment notation Replace single case switches with if statements Combine else and if when appropriate Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: ensure errors are at least logged (errcheck)Moritz Poldrack2022-08-046-13/+46
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: simplify code (gosimple)Moritz Poldrack2022-08-041-4/+1
| | | | | | | | | | | | | | Replaces infinite for loops containing a select on a channel with a single case with a range over the channel. Removes redundant assignments to blank identifiers. Remove unnecessary guard clause around delete(). Remove `if condition { return true } return false` with return condition Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: remove redundant returns (S1023)Moritz Poldrack2022-08-043-4/+0
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: fix function parameters being overwritten before they are used (SA4009)Moritz Poldrack2022-08-041-2/+2
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: formatted codeMoritz Poldrack2022-08-041-1/+3
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: apply new formatting rulesMoritz Poldrack2022-08-0123-79/+53
| | | | | | | Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* msglist: remove invalidate from commands which remove messagesTim Culverhouse2022-08-013-7/+0
| | | | | | | | | | Archive, delete, and move all remove messages from the message store. The commands themselves invalidated the message list. The message list was also invalidated for every MessagesDeleted message received. Remove the call in the command logic to reduce redraws of the message list Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* archive,move: fix reselect next messageTim Culverhouse2022-08-012-2/+6
| | | | | | | | | | Move and Archive used store.Next to select the next message. When moving or archiving multiple messages with an upward movement, this would result in a to-be-removed message being selected. Use findNextNonDeleted function to select the correct next message for these commands. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgstore: leave visual-mark mode after certain commandsTim Culverhouse2022-08-013-0/+7
| | | | | | | | | | | | | | | | Commit "4753cfd visual-mode: deselect messages after performing command" introduced the behavior of leaving visual mark mode after performing certain commands. Add this behavior to additional commands: - Delete - Archive - Move Remark the selected mail files if an error occurred during the operation. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: add check-mail commandTim Culverhouse2022-08-011-0/+31
| | | | | | | | | Add :check-mail command for ad-hoc checking of mail. Reset timer for automatic checking if it is enabled. Suggested-by: staceee Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pipe: fix ordering by message id for long patch seriesRobin Jarry2022-08-011-9/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | Git send-email Message-Id headers have the following format: DATETIME.PID-NUM-COMMITTER Unfortunately, when there are more than 9 patches, the patch number (NUM) is not zero-padded which makes ascii sorting invalid, e.g.: 1 10 11 12 2 3 4 5 6 7 8 9 Instead of: 1 2 3 4 5 6 7 8 9 10 11 12 We need the patches to be ordered correctly to pipe them to git am. Make sure to pad the patch number with zero characters to allow series of up to 999 patches. Only re-order messages before piping them if all the Message-Id headers look like git-send-email headers. Link: https://github.com/git/git/blob/v2.36.0/git-send-email.perl#L1197 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
* outgoing-cred-cmd: delay execution until an email needs to be sentStas Rudakou2022-07-311-2/+6
| | | | | | | | | | | | | | | | | | This can be useful in cases when: 1. outgoing-cred-cmd requires a user action or confirmation (e.g. when using pass with a Yubikey or similar smart card that requires a user to enter a pin or touch the device when decrypting the password) 2. A user starts aerc frequently, but not all the sessions end up with sending emails 3. So the user only wants to execute outgoing-cred-cmd when the password is really used, so the user doesn't have to enter pin or touch their Yubikey each time aerc starts Signed-off-by: Stas Rudakou <stas@garage22.net> Acked-by: Robin Jarry <robin@jarry.cc>
* sort: clear sort criteria when called without argumentsTim Culverhouse2022-07-261-1/+1
| | | | | | | | | | | | Fix a regression introduced by commit c2f4404fca15 ("threading: enable filtering of server-side threads"). Prior to this commit, a :sort command (no args) would clear out the current sort criteria (or rather, apply the value from the config). Restore this functionality. Fixes: c2f4404fca15 ("threading: enable filtering of server-side threads") Reported-by: akspecs <akspecs@gmail.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* sort: show warning when sort is not supportedKoni Marti2022-07-261-0/+6
| | | | | | | | | | Use the capabilities returned by the backend to check whether sort is implemented when the user tries to use the sort command. Print a warning to the log when a sort request is silently dropped by the backend. Suggested-by: |cos| Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* delete: improve find next functionKoni Marti2022-07-261-8/+16
| | | | | | | | | | Improve the function to find the next valid message after the delete operation. This ensures that messages at the end or when marked in the visual mode are properly dealt with. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgstore: implement a uid-based architectureKoni Marti2022-07-263-5/+2
| | | | | | | | | | | Change the message store architecture from an index-based to a uid-based one. Key advantage of this design approach is that no reselect mechanism is required anymore since it comes with the design for free. Fixes: https://todo.sr.ht/~rjarry/aerc/43 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* delete: select new last message if last message was deletedTim Culverhouse2022-07-241-0/+7
| | | | | | | | | | If the last message is deleted, the new selection should be the last message instead of the first message. Fixes: https://todo.sr.ht/~rjarry/aerc/59 Reported-by: Sebastien Binet <s@sbinet.org> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* delete: move tab replace logic into Done callbackTim Culverhouse2022-07-241-27/+25
| | | | | | | | | | | | Move tab replacement logic for next-message-on-delete into the callback. This also moves the Invalidate() call into the callback, and should make imap deletion UI work more reliably - there is a race condition between the worker and the UI in displaying deleted messages. This should resolve the race condition, and also only remove the MsgView tab if the message is actually deleted. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: use level-based logger functionsRobin Jarry2022-07-237-28/+33
| | | | | | | | | | | | Do not pass logger objects around anymore. Shuffle some messages to make them consistent with the new logging API. Avoid using %v when a more specific verb exists for the argument types. The loggers are completely disabled (i.e. Sprintf is not even called) by default. They are only enabled when redirecting stdout to a file. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* tabs: make fields privateRobin Jarry2022-07-233-15/+16
| | | | | | | | | | | | | | The Tabs object exposes an array of Tab objects and the current selected index in that array. The these two fields are sometimes modified in goroutines, which can lead to data races causing fatal out of bounds accesses on the tab array. Hide these fields as private API. Expose only what needs to be seen from the outside. This will prepare for protecting concurrent access with a lock in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
* tabs: rename SelectedTab to SelectedTabContentRobin Jarry2022-07-2327-31/+31
| | | | | | | | | This function returns an ui.Drawable. Use a more explicit name. This prepares for adding a new SelectedTab function which will return an ui.Tab. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
* send: enter no-quit mode until message is sentKoni Marti2022-07-141-0/+7
| | | | | | | | | Protect the sending of a message by entering the no-quit mode. This prevents aerc from exiting with the :quit command until the operation is done or the exit is forced. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: implement a no-quit modeKoni Marti2022-07-142-3/+46
| | | | | | | | | | Add a mode that prevents aerc from quitting normally when an important task is performed, i.e. when sending a message. The no-quit mode will be ignored when quit is used with the -f option to force an exit. Suggested-by: ph14nix[m] Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pipe: use go-mbox for writing multiple messagesKoni Marti2022-07-141-38/+13
| | | | | | | Use go-mbox for piping out multiple messages in the mbox format. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* account: import mbox file to a folderKoni Marti2022-07-141-0/+153
| | | | | | | | | | | | | Append all messages from an mbox file to the selected folder with the import-mbox command. User confirmation is required when the folder already contains messages. A failed append will be retried a few times. If a backend timeout occurs, the entire import is stopped to prevent a hang. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* account: export folder to mbox fileKoni Marti2022-07-141-0/+126
| | | | | | | | | Export all message in the current folder to an mbox file. If an error occurs during the export, aerc retries a few times before giving up to prevent a hang. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* threading: refactor reselect logicTim Culverhouse2022-07-102-3/+2
| | | | | | | | | | This patch refactors reselection of a message during certain operations (searching, filtering, clearing, deleting, moving, new message arrival). The addition of server-side filtering for threaded views broke the existing reselection logic. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* threading: enable filtering of server-side threadsTim Culverhouse2022-07-102-9/+14
| | | | | | | | | | | | | | This patch enables the filtering of a threaded view which uses server-built threads. Filtering is done server-side, in order to preserve the use of server-built threads. In adding this feature, the filtering of notmuch folders was brought up to feature parity with the other workers. The filters function the same (ie: they can be stacked). The notmuch filters, however, still use notmuch syntax for the filtering. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* threading: enable toggle-threads for server-side threadsTim Culverhouse2022-07-101-2/+2
| | | | | | | | | | Enable the :toggle-threads command to work for workers which have Thread capability. The implementation of that feature has the side effect that the threading-enabled config option now sets the default view (threaded or not threaded) for any worker, not just IMAP or notmuch. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* recall: support pgp/mime messagesKoni Marti2022-07-101-55/+70
| | | | | | | | | | | PGP/MIME messages are stored encrypted and/or signed in the draft folder for security reasons. Recall will open them through the lib.MessageView interface in order to display the message content properly in the composer tab. If the stored message was encrypted or signed, the recalled message in the composer will also be encrypted or signed. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* recall: append attachmentsKoni Marti2022-07-101-2/+30
| | | | | | | | | Append attachments to the composer when a message with attachments is recalled. Before the attachement refactoring in the composer, the recalled attachments were ignored. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* recall: confirm deleting message when not sentKoni Marti2022-07-101-9/+34
| | | | | | | | | | | Ask for user confirmation when a recalled message is deleted after the composer is closed but the message has not been sent yet. The message will only be deleted automatically when the message is sent. This might prevent data loss since the recalled message is currently deleted either way. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* postpone: avoid calling WriteMessage twiceKoni Marti2022-07-101-9/+4
| | | | | | | | Postpone will currently call composer.WriteMessage twice: once for counting the bytes and another time for appending the message. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: implement prompt completionSergey Smirnykh2022-07-022-2/+57
| | | | | | | | | | | | | | | | | | | | | This patch implements :prompt completion. The completion mechanism only provides completions when there is at least one argument specified (prompt text). The mechanism is based on other commands' completions and works as follows: 1. Attempts to look up a command by the name specified in args[1]. 2.a On success it uses command.Complete. 2.b Otherwise, if total arguments count is lesser or equals than 2 (i.e. no command arguments specified), it attempts to complete the command's name. Additional effort is made to preserve prompt text, which often contains spaces and formatting. Signed-off-by: Sergey Smirnykh <sergey.smirnykh@siborgium.xyz> Acked-by: Robin Jarry <robin@jarry.cc>
* forward: remove crlf in text bodyKoni Marti2022-07-021-1/+5
| | | | | | | Remove crlf from the text body when forwarding a message. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* forward: provide option to append all attachmentsKoni Marti2022-07-021-14/+53
| | | | | | | | | Append all non-multipart attachments with the -A flag. Rename the flag for forwarding a full message as an RFC2822 attachments to -F. Suggested-by: psykose Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* compose: refactor attachment handlingKoni Marti2022-07-021-2/+1
| | | | | | | | | | | | Refactor the attachment handling process in the composer. The composer can currently only handle attachments that are stored as files (or pgp keys). This patch removes this limitation so that any message part can be handled as an attachment. With this we can treat files, pgp keys and message parts on an equal footing and it will enable us also to easily forward attachments. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* open: fix mimetype discovery for encrypted or signed messagesTim Culverhouse2022-06-261-1/+1
| | | | | | | | | | | | | Mimetype discovery for the :open command is based on the BodyStructure of the message. This patch fixes the method which got the BodyStructure of the message to a more generalized one, which is set post-encryption and post-validation. This allows encrypted or signed message parts to have their proper mimetype discovered. Fixes: https://todo.sr.ht/~rjarry/aerc/50 Reported-by: ~ph14nix Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com>
* pgp: fix pipe|open|save command behaviorTim Culverhouse2022-06-243-11/+10
| | | | | | | | | | | | | | Signed and/or encrypted PGP messages did not behave properly for pipe, open, and save commands. Specifically, the proper Message Part would not be passed to the command in the MessageViewer. This is due to the encapsulation of the body structure. This patch fixes the behavior for piping|opening|saving of message parts. Fixes: https://todo.sr.ht/~rjarry/aerc/47 Reported-by: ~ph14nix Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* msgviewer: open http links from messagesKoni Marti2022-06-141-1/+19
| | | | | | | | | | | | | | | | | Parse http links from a message and display them as completions in the :open-link command. Add the following binds to the [view] section in your binds.conf: <C-l> = :open-link <space> Parsing can be disabled in aerc.conf by setting parse-http-links to false in the viewer section. Thanks to Moritz for the help with the regular expression. Signed-off-by: Koni Marti <koni.marti@gmail.com> Reviewed-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* visual-mode: deselect messages after performing commandTim Culverhouse2022-06-145-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | In order to better align to vim functionality: deselect visual mode selections after performing a command on the selection. This patch also introduces a new command to allow for re-selecting (remarking) the previous selection set so that commands can be chained together. The deselection only applies to msg commands that *do not* move the message from the store (those types of commands already deselect): - read/unread - flag/unflag - modify-labels - copy - pipe Previous usage to mark several messages as read and deselect all: Vjjj:read<Enter>:unmark -a<Enter> New usage, similar to vim: Vjjj:read<Enter> To chain a command together: Vjjj:read<Enter>:remark<Enter>{next command}<Enter> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* unsubscribe: select method with the selector dialogKoni Marti2022-05-311-10/+77
| | | | | | | | | | | | Provide a choice to the user with the selector dialog to select the desired unsubscribe method. Before, the first method that appeared in the list-unsubscribe header was used. For the http method, the user can now also confirm whether he wants to open the provided link in the browser or not. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* invites: reply with accept, accept-tentative or declineKoni Marti2022-05-311-0/+190
| | | | | | | | | | Reply to iCalendar invitations with three commands: :accept, :accept-tentative or :decline. Parse a text/calendar request, create a reply and append it to the composer. Suggested-by: Ondřej Synáček <ondrej@synacek.org> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* help: add completionsTim Culverhouse2022-05-231-2/+15
| | | | | | | | Add :help completion arguments (config, imap, etc). The option "aerc" brings up the general manpage Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com>
* pgp: add attach key commandTim Culverhouse2022-05-061-0/+32
| | | | | | | | | Add compose command ("attach-key") to attach the public key associated with the sending account. Public key is attached in ascii armor format, with the mimetype set according to RFC 3156 ("application/pgp-keys"). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* pgp: check encryption keys before sending messageTim Culverhouse2022-05-061-12/+0
| | | | | | | | | | | | | | | | Add check for public keys of all message recipients (to, cc, and bcc) before sending the message. Adds an OnFocusLost callback to header editors to facilitate a callback for checking keys whenever a new recipient is added (OnChange results in too many keyring checks). Once encryption is initially set, the callbacks are registered. If a public key is not available for any recipient, encryption is turned off. However, notably, the callbacks are still registered meaning as s soon as the user removes the recipients with missing keys, encryption is turned back on. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* pgp: check for signing key before signing timeTim Culverhouse2022-05-041-1/+4
| | | | | | | | | | Check that the signing key exists when the user issues the :sign command. The signing key ID will be displayed in the security status also, allowing the user to see what key will be used to sign the message. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Jens Grassel <jens@wegtam.com>