aboutsummaryrefslogtreecommitdiffstats
path: root/app/compose.go
Commit message (Collapse)AuthorAgeFilesLines
* commands: add reloadKoni Marti2024-08-201-4/+0
| | | | | | | | | | | | | | 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>
* account: remove ui config struct fieldKoni Marti2024-08-201-1/+2
| | | | | | | | | | Remove the UI config field in the AccountView struct to ensure we use the most current UI config. 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-031-0/+4
| | | | | | | | | 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>
* attach: use absolute paths instead of relativeBence Ferdinandy2024-04-141-0/+4
| | | | | | | | | | | | Sometimes it is easier to change folders when adding attachments, but currently we store relative paths, which doesn't work with this. Add the absolute paths when attaching files. Replace the current user home dir with ~ to make it prettier in the UI. Implements: https://todo.sr.ht/~rjarry/aerc/134 Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: explicitly identify converted text/* partsRobin Jarry2024-04-131-1/+4
| | | | | | | | | | | | | | | | | | | | | 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>
* composer: block :quit command if composer is activeVitaly Ovchinnikov2024-04-131-0/+4
| | | | | | | | Prevent aerc from quiting if there is an active composer instance, unless `:quit -f` is used. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* send: prevent sending if multipart conversion failedVitaly Ovchinnikov2024-04-031-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* gpg: add pgp-self-encrypt optionBartkk2024-04-031-0/+9
| | | | | | | | | | Add an option to encrypt outgoing messages to the sender or the key specified in pgp-key-id. Implements: https://todo.sr.ht/~rjarry/aerc/237 Changelog-added: New `pgp-self-encrypt` option in `accounts.conf`. Signed-off-by: Bartkk <bartkk@bartkk.xyz> Acked-by: Robin Jarry <robin@jarry.cc>
* gpg: fix mime-version header positionRobin Jarry2024-03-101-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some MTAs try to normalize the case of all headers (including signed text parts headers). Unfortunately, Mime-Version can be normalized to different casing depending on the implementation (MIME- vs Mime-). Since the signature is computed on the whole part, including its header, changing the case can cause the signature to become invalid. Due to how multipart/signed messages are constructed, we need to hack around go-message writers to intercept the writing of a text part, compute its signature and write the actual message with the proper headers. Unfortunately, go-message does not allow creating a message writer that does not insert a Mime-Version header. This causes the Mime-Version header to be inserted in the wrong place: it is put inside the signed text part header instead on the top level header. Thus, included in the signed content. Make sure to remove any Mime-Version header from the signed part header. Finally, ensure that Mime-Version is set on the top-level header so that messages are compliant with RFC 2045. Fixes: https://todo.sr.ht/~rjarry/aerc/143 Link: https://github.com/emersion/go-message/issues/165 Link: https://github.com/emersion/go-pgpmail/pull/15 Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CCQRPF5EA0TF8.PEJ4AKCEGMFM%40fembook%3E Changelog-fixed: `Mime-Version` is no longer inserted in signed text parts headers. MTAs normalizing header case will not corrupt signatures anymore. Reported-by: Coco Liliace <chloe@liliace.dev> Reported-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* log: move package to libRobin Jarry2024-02-141-1/+1
| | | | | | | This has nothing to do at the root of the source tree. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
* lib: add function to obtain Message-ID hostnameKarel Balej2024-02-121-21/+10
| | | | | | | | | Make the function already present in app/compose.go reusable while also changing its signature for it not to require involvement of a Composer instance. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* mouse: use vaxis mouse eventsTim Culverhouse2024-02-121-5/+4
| | | | | | | Replace all tcell.EventMouse events with vaxis mouse events Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* style: use vaxis style everywhereTim Culverhouse2024-02-121-1/+1
| | | | | | | Replace all tcell.Style objects with vaxis.Style objects Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* fill: replace tcell.Style with vaxis.StyleTim Culverhouse2024-02-121-1/+1
| | | | | | | Replace the Fill implementation with vaxis style objects Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: change event interfaces to vaxis eventsTim Culverhouse2024-02-121-5/+6
| | | | | | | | | | Modify the function signature of Event and MouseEvent interfaces to accept vaxis events. Note that because a vaxis event is an empty interface, the implementations are not affected and the events are delivered as they were before Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: show annotations on the review screenKoni Marti2024-02-111-19/+35
| | | | | | | | | | | | | | | Customize annotations on the review screen. Annotations will overwrite the default descriptions. Replace the [][]string construct with a named struct for better readability. Fixes: https://todo.sr.ht/~rjarry/aerc/118 Changelog-deprecated: Built-in descriptions for the default keybinds shown on the review screen will be deprecated in a future release. Descriptions can be added to those keybinds with inline comments in binds.conf. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: fix deadlock when editor errors after :reply -cRobin Jarry2024-01-311-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the message viewer is open and running :reply -c, if the editor exits with an error (e.g. vim :cq), the compose tab is not closed and aerc does not register input anymore. This happens because the composer is closed twice. Once explicitly, and a second time by RemoveTab. This causes to open two viewers on the same message at the same time. Here is the deadlock stack trace: goroutine 149 [sync.Mutex.Lock]: runtime.gopark() runtime/proc.go:398 ... sync.(*Mutex).Lock(...) sync/mutex.go:90 git.sr.ht/~rjarry/aerc/app.(*Composer).Show() git.sr.ht/~rjarry/aerc/app/compose.go:793 git.sr.ht/~rjarry/aerc/lib/ui.(*Tabs).selectPriv() git.sr.ht/~rjarry/aerc/lib/ui/tab.go:171 git.sr.ht/~rjarry/aerc/lib/ui.(*Tabs).Add() git.sr.ht/~rjarry/aerc/lib/ui/tab.go:75 git.sr.ht/~rjarry/aerc/app.(*Aerc).NewTab() git.sr.ht/~rjarry/aerc/app/aerc.go:481 git.sr.ht/~rjarry/aerc/app.NewTab(...) git.sr.ht/~rjarry/aerc/app/app.go:60 git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute.func1() git.sr.ht/~rjarry/aerc/commands/account/view.go:71 git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView.func1() git.sr.ht/~rjarry/aerc/lib/messageview.go:79 git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView() git.sr.ht/~rjarry/aerc/lib/messageview.go:123 git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute() git.sr.ht/~rjarry/aerc/commands/account/view.go:52 git.sr.ht/~rjarry/aerc/commands/msg.reply.Execute.func1.1() git.sr.ht/~rjarry/aerc/commands/msg/reply.go:191 git.sr.ht/~rjarry/aerc/app.(*Composer).Close() git.sr.ht/~rjarry/aerc/app/compose.go:714 git.sr.ht/~rjarry/aerc/app.(*Composer).termClosed() git.sr.ht/~rjarry/aerc/app/compose.go:1189 git.sr.ht/~rjarry/aerc/app.(*Terminal).closeErr() git.sr.ht/~rjarry/aerc/app/terminal.go:69 git.sr.ht/~rjarry/aerc/app.(*Terminal).Close(...) git.sr.ht/~rjarry/aerc/app/terminal.go:46 git.sr.ht/~rjarry/aerc/app.(*Terminal).HandleEvent() git.sr.ht/~rjarry/aerc/app/terminal.go:174 git.sr.ht/~rockorager/tcell-term.(*VT).Start.func1() git.sr.ht/~rockorager/tcell-term@v0.10.0/vt.go:175 created by git.sr.ht/~rockorager/tcell-term.(*VT).Start in goroutine 1 git.sr.ht/~rockorager/tcell-term@v0.10.0/vt.go:165 +0x38d Fixes: https://todo.sr.ht/~rjarry/aerc/216 Reported-by: Karel Balej <balejk@matfyz.cz> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Karel Balej <balejk@matfyz.cz>
* compose: don't attach key when removing signatureThomas Böhler2024-01-261-2/+0
| | | | | | | | | | | | | | If pgp-attach-key is set in accounts.conf, the key is detached with :detach and the signature removed with :sign, the key will be attached again. When :sign is called again two keys will be attached instead of one. Fix this by not attaching a key if it cannot be detached. Fixes: 9d90b70b4edf ("compose: refactor attachment handling") Signed-off-by: Thomas Böhler <witcher@wiredspace.de> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: allow automatic attachment of signing keyRobin Jarry2024-01-251-0/+10
| | | | | | | | | | | | | | | | | | Add a new pgp-attach-key boolean setting in accounts.conf. When set to true, enabling message signing (either automatically via pgp-auto-sign or manually with :sign) will imply attaching the (public) key that will be used to sign the message before sending. The automatically attached key can be unattached like any other attachment with :detach. Implements: https://todo.sr.ht/~rjarry/aerc/207 Changelog-added: Automatically attach signing key with `pgp-attach-key` in `accounts.conf`. Requested-by: Drew Devault <sir@cmpwn.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Thomas Böhler <witcher@wiredspace.de> Reviewed-by: Thomas Böhler <witcher@wiredspace.de>
* compose: ensure rfc2045 compliant mime messageKoni Marti2024-01-191-0/+8
| | | | | | | | | | | | Ensure that the encrypted and/or signed messages contain a correct MIME-Version header field at the top level of the message in compliance with RFC2045 Section 4. Link: https://datatracker.ietf.org/doc/html/rfc2045#section-4 Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3C1704071512-sup-2798%40honeycomb%3E Reported-by: Dan Callaghan <djc@djc.id.au> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* templates: move signature from compose to templatesBence Ferdinandy2024-01-081-91/+0
| | | | | | | | | | | | | | | | Currently, when composing a new message, everything is read from the template files, except the signature, which is added directly in the compose code. Add a new template variable {{.Signature}}, by moving the logic of reading signature from command or file from compose to templates. Update the various default template files to preserve the original placement of signatures. Users using the default templates should not notice the change. Users with custom compose templates will need to update their templates with {{.Signature}}. Changelog-changed: Signature placement is now controlled via the `{{.Signature}}` template variable and not hardcoded. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* patch/list: add list sub-cmdKoni Marti2023-12-301-7/+1
| | | | | | | | | Implement the :patch list command. List the the current project and add a flag to list all saved projects. Use the pager to display the data and extract the pager commands and move them into the config package. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: define useful vars in the editor's envJason Cox2023-11-231-0/+5
| | | | | | | | | | | | Add AERC_ACCOUNT and AERC_ADDRESS_BOOK_CMD to the editor's environment when composing a message. These variables allow for per-account configuration of the editor and facilitate address completion when edit-headers = true. Changelog-added: `AERC_ACCOUNT` and `AERC_ADDRESS_BOOK_CMD` are now defined in the editor's environment when composing a message. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* complete: allow setting the completion key bindingRobin Jarry2023-11-021-0/+3
| | | | | | | | | | | | | | | | | | | | | Until now, if less than complete-min-chars were entered or if completion-delay had not expired yet, the only way to force trigger completion was to press <tab>. In some cases, <tab> is already bound to another action (for example :next-field in the compose::editor context). This makes forcing the completion impossible. Allow defining a key to trigger manual completion via the new $complete special entry in binds.conf. Leave the default binding to <tab>. Set it to <C-o> in the [compose::editor] to avoid conflicting with the existing <tab> binding. Changelog-added: Customize key to trigger completion with `$complete` in `binds.conf`. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
* binds: folder-specific bindings for composerVitaly Ovchinnikov2023-11-021-0/+7
| | | | | | | | | Add folder-specific bindings for composer, so custom binginds might be specified for a composer opened in a given folder. Changlelog-Added: `[compose::editor:folder=$name]` binding context. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: fix crash when getting hostnameMoritz Poldrack2023-10-261-0/+5
| | | | | | | | | | | | | Currently we assume that a From: address is present when retrieving the hostname for the message ID. This results in an index-out-of-range error when no From address is present. Generate a random hostname for the message ID, if no From: address is present. Fixes: 608bc4fa7fa7 ("compose: use email domain name in Message-Id") Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: fix header navigation after :compose -eRobin Jarry2023-10-251-9/+4
| | | | | | | | | | | | | | | | | | When the terminal is closed with [compose].edit-headers=true, all headers are deleted and recreated based on the email content. Since the terminal is not active, adding the first header was working fine, but the next ones were replacing the single entry on each call of addEditor(). Fix the broken append() logic. Reported-by: Inwit <inwit@sindominio.net> Fixes: c2a4fc7fdfae ("compose: avoid panic when deleting the last header") Changelog-fixed: Selection of headers in composer after `:compose -e` followed by `:edit -E`. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* terminal: add `:send-keys` commandVitaly Ovchinnikov2023-10-221-0/+4
| | | | | | | | | | | | 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>
* app: export global functionsRobin Jarry2023-10-101-23/+21
| | | | | | | | | | | | | | | 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-101-0/+1975
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>