summaryrefslogtreecommitdiff
path: root/commands
AgeCommit message (Collapse)Author
2022-06-24pgp: fix pipe|open|save command behaviorTim Culverhouse
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>
2022-06-14msgviewer: open http links from messagesKoni Marti
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>
2022-06-14visual-mode: deselect messages after performing commandTim Culverhouse
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>
2022-05-31unsubscribe: select method with the selector dialogKoni Marti
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>
2022-05-31invites: reply with accept, accept-tentative or declineKoni Marti
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>
2022-05-23help: add completionsTim Culverhouse
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>
2022-05-06pgp: add attach key commandTim Culverhouse
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>
2022-05-06pgp: check encryption keys before sending messageTim Culverhouse
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>
2022-05-04pgp: check for signing key before signing timeTim Culverhouse
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>
2022-04-29recall: mention the -f option in the error messageinwit
Commit bc593ac7cdb2 ("recall: allow recalling messages from any folder") added the possibility to recall any message by providing the -f flag. Mention the flag in the error message. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-27refactor: refactor pgp implementationTim Culverhouse
This commit refactors the internal PGP implementation to make way for GPG integration. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-25filter: clear filter when called with no argsKoni Marti
Clear filter when called with no arguments. Fixes: https://todo.sr.ht/~rjarry/aerc/35 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-17store: keep current message selectedKoni Marti
Keep current message selected when clearing or changing filters and when toggling threads. Add -s flag to the clear command to also clear the selected message and set cursor to the top of the message list. Implements: https://todo.sr.ht/~rjarry/aerc/36 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-14forward: allow ':forward -A' with no addressTim Culverhouse
Allow using the command ':forward -A' without specifying an email address inline. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-06fix: out-of-bounds error in command headerMoritz Poldrack
This commit fixes an out-of-bound error that happened while parsing commands. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-06header: remove trailing colon in header fieldMoritz Poldrack
With this commit trailing colons in the :header command's field are removed to prevent double-colon-headers from being sent. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-06compose: parse headers correctly from -HEvan Gates
By using :compose -H <header> a user should be able to add arbitrary headers to an email. The existing implementation from 5b523880b4b4cd2abd9457b4b09c384af33be14b added the headers as lines to the beginning of the body. These lines were not interpreted as headers anywhere and ended up as plain text in the body of the email. Fix the code to parse and add the headers correctly. Signed-off-by: Evan Gates <evan.gates@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
2022-03-31save: fix path completionRobin Jarry
Ignore option flags and prepend default-save-path if the current path is not absolute. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
2022-03-25statusline: indicate when sorting is in progressKoni Marti
Indicate when sorting is in progress in the statusline. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-25sort: keep sort criteria applied to folderKoni Marti
Keep the sort criteria applied to the selected folder until the default sort order should be restored. Call the sort command without arguments to restore the default sort order. The current behavior is that the default sort order is restored as soon as the folder reloads. This happens often and then the results of the sort command are lost. This makes the sort command not very user-friendly. Instead, we should keep the sort criteria applied until the user explicitly wants to restore the default sort order again. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-24save: add -a option to save all attachmentsRobin Jarry
Allow saving all message parts that have the content disposition "attachment" header to a folder. Suggested-by: Ondřej Synáček <ondrej@synacek.org> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
2022-03-23logging: added a log on panicMoritz Poldrack
Since panics still regularly "destroy" the terminal, it is hard to get a stack trace for panics you do not anticipate. This commit adds a panic handler that automatically creates a logfile inside the current working directory. It has to be added to every goroutine that is started and will repair the terminal on a panic. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-23statusline: make statusline folder-specificKoni Marti
Make statusline folder-specific. Update filter, search and threading status when changing folders. Commit 2512c04 ("statusline: implement per-account status") introduced an account-specific statusline. This makes it account- and folder-specific. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
2022-03-22compose: make headerEditor focusing more reliableTim Culverhouse
Focusing header editors was hardcoded as integers which only worked with the default ui. If a user changed the UI to, for example, put CC as a field below "to", FocusSubject would focus the CC field instead of the subject. This commit reuses and modifies the function FocusEditor to generalize the focusing of header editors - which can now be called by name via FocusEditor(name string) Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-18statusline: implement per-account statusKoni Marti
Implement a statusline state for each account. Keep the ex line and the push notifications global. Add account name prefix to push notifications. Prefix status line with account name when multiple accounts are available. Use account-specific status line for each tab where an account is defined. Handle threading, filter/search, viewer passthrough and connection status. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-16commands: use SelectedAccountUiConfig instead of explicit nil checkkt programs
Remove code duplication and provide completion even when acct is nil Signed-off-by: kt programs <ktprograms@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-16commands: fix possible panic in CompletionFromListkt programs
Panic might occur if aerc.SelectedAccount() is nil Signed-off-by: kt programs <ktprograms@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-14bindings: fix panic for terminal keybindKoni Marti
Fix panic in the GetCompletions function when using the keybind for the terminal command. Fixes: https://todo.sr.ht/~rjarry/aerc/29 Reported-by: inwit <inwit@sindominio.net> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-14viewer: add key passthrough modekt programs
When trying to search in less, keys bound to viewer functions can't be used as part of the search query, which makes the search useless. Add a view::passthrough binding mode and a :toggle-key-passthrough command go toggle in and out of that mode. By default, typing '/' in the viewer is bound to enabling key passthrough and automatically inserting '/', to easily enter "less" search mode. When in the passthrough mode, all bindings are ignored by default. The default binds.conf only defines a single keybinding in that mode: <Esc> to get back out. $ex is bound to <C-x> to allow typing colons. Signed-off-by: Kt Programs <ktprograms@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-12all: fix minor issues found by staticcheckMoritz Poldrack
Signed-off-by: Moritz Poldrack <git@moritz.sh>
2022-03-07commands: implement fuzzy completion for commands and optionskt programs
Change the option to enable fuzzy completion to be fuzzy-complete, since it's no longer only used for folders Signed-off-by: Kt Programs <ktprograms@gmail.com> Acked-by: Koni Marti <koni.marti@gmail.com>
2022-03-03reply: add automatic replacement of localized Re:Moritz Poldrack
Some MUAs (namely Outlook) use localized prefixes for replied-to and forwarded mail. With this patch aerc replaces known localized prefixes and repetitions with the common Re: prefix. Link: https://office-watch.com/2014/outlook-reply-forward-prefixes/ Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2022-02-25pipe: allow piping multiple marked messagesRobin Jarry
When messages are marked, pipe their contents into the specified command. The messages are ordered according to their respective Message-Id headers. This allows applying complete patch series with a single command. When piping more than one message, make sure to write them in the mbox format as git am expects them to be. Link: https://en.wikipedia.org/wiki/Mbox Link: https://github.com/git/git/blob/v2.35.1/builtin/mailsplit.c#L15-L44 Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: akspecs <akspecs@gmail.com>
2022-02-25aerc: always check SelectedAccount return valueRobin Jarry
aerc.SelectedAccount() is used in lots of places. Most of them without checking the return value. In some cases, the currently selected tab is not related to any account (widget.Terminal for example). This can lead to unexpected crashes when accessing account specific configuration. When possible, return an error when no account is currently selected. If no error can be returned, fallback to non-account specific configuration. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com>
2022-02-24threading: implement on-the-fly message threadingKoni Marti
implement message threading on the message store level using the jwz algorithm. Build threads on-the-fly when new message headers arrive. Use the references header to create the threads and the in-reply-to header as a fall-back option in case no references header is present. Does not run when the worker provides its own threading (e.g. imap server threads). Include only those message headers that have been fetched and are stored in the message store. References: https://www.jwz.org/doc/threading.html Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Tested-by: akspecs <akspecs@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-02-23commands: add expand-folder and collapse-folderKoni Marti
add the expand-folder and collapse-folder commands to navigate the directory tree view. Provide keybinds for a vi-like folder navigation experience. Signed-off-by: Koni Marti <koni.marti@gmail.com>
2022-02-23search/filter: display in extra statusRobin Jarry
Add an extra attribute to the status line. When non-empty, display it after the current status. Set that extra status after a successful :search or :filter. Remove it after :clear. Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-19search/filter: remove from status bar after 20 secondsRobin Jarry
The status is not cleared. It is annoying. Fixes: c37f1eaaeaa1 ("filter/search: display current search/filter arguments") Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-19filter/search: display current search/filter argumentsinwit
Make the statusbar message after search and filter completion more informative by showing the full call that was used. Signed-off-by: inwit <inwit@sindominio.net>
2022-02-19unsubscribe: parse internationalized headersKoni Marti
Fix the parsing of internationalized headers (RFC 6532). Enable unsubscribe to work with regular and encoded headers. Signed-off-by: Koni Marti <koni.marti@gmail.com>
2022-02-06postpone: re-open review mode on errorKoni Marti
re-opens the review UI when the postpone operation fails. Before, the composer would close, even on error, and we would lose the email draft. Now, the user can decide on how to proceed when postponing fails. References: https://lists.sr.ht/~rjarry/aerc-devel/patches/28824 Signed-off-by: Koni Marti <koni.marti@gmail.com>
2022-01-31completions: add folder flexible search as an optioninwit
Provide an option to change the completion style when selecting a folder from completing with folders starting with the input string to completing with folders in which the input string is a substring present at any point in the folder name. References: https://lists.sr.ht/~sircmpwn/aerc/%3C20201129181020.186984-1-inwit%40sindominio.net%3E References: https://lists.sr.ht/~sircmpwn/aerc/%3C20210223202536.199355-1-clayton%40craftyguy.net%3E Signed-off-by: inwit <inwit@sindominio.net>
2022-01-31compose: add option to never include your own address when replyingjohn1doe@ya.ru
Introduce an option in aerc.conf to disable the auto-including of your own address when replying to your own emails (address replies to the original To: and Cc: instead); default to true (allow the auto-including)
2022-01-29recover: recover emails from tempdir after a crashKoni Marti
implements a recover command that searches the local temp dir for aerc emails. If a file is found and selected, a new composer tab will open with the file contents as the message body. No header data is stored in the temp file and thus this information cannot be recovered. Recover will not remove the temporary file unless the force flag (-f) is explicitly used. This recovery method only works when the editor buffer is saved to disk and the Close() function of the composer has not been called yet. Sending, postponing or quitting will call the Close() function which removes the temporary file completely. After Close() is called, no recovery is possible anymore. Signed-off-by: Koni Marti <koni.marti@gmail.com>
2022-01-27reply: use new-message template for non-quoted repliesRobin Jarry
Unless a template is specified with reply -T, use the new-message template for non-quoted replies. Fixes: 877a94f5d9a7 ("compose: add default template for new messages") Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-22msgstore: fetch missing headers in visual modeKoni Marti
fetches missing headers when in visual selection mode. This prevents large archive operations from panicking due to a nil pointer dereference. The archive command will return an error to the ui when a nil message is encountered to signal that the message store is not ready yet. Signed-off-by: Koni Marti <koni.marti@gmail.com>
2022-01-19compose: add default template for new messagesRobin Jarry
Allow defining a default template to use when composing new messages. Add an example to be used for new users. Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-19docs: mention missing -T options for compose and forwardRobin Jarry
A template file may be specified for compose and forward as well. Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-01-07pgp: PGP/MIME encryption for outgoing emailsKoni Marti
implements PGP/MIME encryption with go-pgpmail. The Encrypt() function of go-pgpmail requires a list of public keys which are taken from the keystore. The keystore is searched for the email addresses of all recipients (to, cc, and bcc). If you want to be able to read the encrypted email afterwards, add yourself as a recipient in either to, cc, or bcc as well. Public keys can be exported from gpg into aerc as follows: $ gpg --export >> ~/.local/share/aerc/keyring.asc When composing a message, the encryption is enabled with the ":encrypt" command. This sets a bool flag in the Composer struct. A reapted application of this command will toggle the flag. The encrypted message can also be signed by using the ":sign" command before or after ":encrypt". References: https://todo.sr.ht/~rjarry/aerc/6 Signed-off-by: Koni Marti <koni.marti@gmail.com>
2022-01-07pgp: PGP/MIME signing for outgoing emailsKoni Marti
implements PGP/MIME signing with go-pgpmail. The Sign() function of go-pgpmail requires a private (signing) key. The signing key which matches the senders email address (from field in email header) is looked up in aerc's copy of the keyring. Private keys can be exported from gpg into aerc as follows: $ gpg --export-secret-keys >> ~/.local/share/aerc/keyring.asc A message is signed with the ":sign" command. The sign command sets a bool flag in the Composer struct. Using the command repeatedly will toggle the flag. References: https://todo.sr.ht/~rjarry/aerc/6 Signed-off-by: Koni Marti <koni.marti@gmail.com>