aboutsummaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* templates: add head and tail functionsBence Ferdinandy2024-08-032-0/+54
| | | | | | | | | | | | | | | Add head and tail functions to get beginning or ends of strings. E.g.: {{"hello" | head 2}} will return "he" {{"hello" | tail 2}} will return "lo" Implements: https://todo.sr.ht/~rjarry/aerc/220 Changelog-added: New `head` and `tail` templates functions for strings. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: add :redraw commandTim Culverhouse2024-08-031-1/+13
| | | | | | | | | | | 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>
* smtp: take smtp-domain into account for tls connectionsRobin Jarry2024-07-151-2/+9
| | | | | | | | | | | | | smtp-domain is ignored when using smtps:// transport. It is only configured for clear text and STARTTLS connections. Also use it for TLS encrypted connections. Fixes: c10cb370bb94 ("config: add option for SMTP HELO/EHLO local domain") Changelog-fixed: `smtp-domain` is now properly taken into account for TLS connections. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tristan Partin <tristan@partin.io>
* rfc822: make header parsing less pedanticRobin Jarry2024-07-152-66/+45
| | | | | | | | | | | | | When receiving invalid headers, just log the errors and move on with our life. When failing to decode addresses, do whatever is possible to at least make the message readable. Changelog-fixed: Aerc is now less pedantic about invalid headers for the maildir and notmuch backends. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Vitaly Ovchinnikov <v@ovch.ru> Tested-by: inwit <inwit@sindominio.net>
* ui: make textinput grapheme awareTim Culverhouse2024-07-022-22/+37
| | | | | | | | | | | | | | | | | The textinput widget operated on a slice of runes, and naively assumed a rune was a "character". When deleting or navigating the cursor through text which contains multi-codepoint characters (such as emoji), the cursor index could desync and cause panics. Use a slice of vaxis.Characters instead of runes to more accurately reflect the index state of the cursor with respect to characters. Fixes: https://todo.sr.ht/~rjarry/aerc/263 Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* rfc822: be liberal with invalid address headersRobin Jarry2024-07-022-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | Some email clients format email addresses with quotes around B encoded names. E.g.: "=?utf-8?B?U21pZXRhbnNraSwgV29qY2llY2ggVGFkZXVzeiBpbiBUZWFtcw==?=" This seems non standard. I tried reading the multiple RFCs that describe the MIME headers encoding but could not find any precise answer to determine if adding quotes around encoded words is valid or not. In any case, ParseAddressList completely ignores any encoding when it encounters a double quote. When that happens, try to detect it and force decoding a second time after the quotes have been removed. Link: https://datatracker.ietf.org/doc/html/rfc2045#section-3 Link: https://datatracker.ietf.org/doc/html/rfc2047#section-2 Link: https://datatracker.ietf.org/doc/html/rfc822#section-3.3 Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* imap: report errors from serverRobin Jarry2024-07-011-2/+4
| | | | | | | | | | | | Avoid eternal spinner on the message list when the imap server advertises some message UIDs but fails to provide their headers when aerc asks from them. When an error occurs, or if some UIDs are not returned, make sure to report the errors to the message list UI. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tristan Partin <tristan@partin.io>
* rfc822: properly parse address listsRobin Jarry2024-06-291-10/+7
| | | | | | | | | | | | | | | | h.Text() parses blobs of encoded text without taking into account specific handling for email addresses. h.AddressList(key) uses mail.ParseAddressList(h.Get(key)) already deals with charsets and quoted-printable stuff. Pass it the raw header value. In some cases, mail.ParseAddressList will return a list of addresses *and* an UnknownCharset error. In this specific case, ignore the error. Fixes: https://todo.sr.ht/~rjarry/aerc/257 Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net> Reviewed-by: Tristan Partin <tristan@partin.io>
* threadbuilder: allow threading by subjectRobin Jarry2024-06-252-10/+28
| | | | | | | | | | | | If no match were found in the References and In-Reply-To headers, allow threading by looking at subjects. This behaviour is disabled by default. Add a setting to enable it. Changelog-added: Allow fallback to threading by subject with `[ui].threading-by-subject`. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Matěj Cepl <mcepl@cepl.eu>
* threadbuilder: show siblings even when no parent foundKoni Marti2024-06-252-21/+33
| | | | | | | | | | | | | | | Show all threading associations even when not all nodes are present. Indicate if a thread is incomplete, i.e. misses a direct parent node. Use the `msglist_thread_orphan.fg=red` styleobject in your stylesheet to indicate whether a messsage has a missing parent. Also use a different thread prefix ("┬─" instead of "├─") not to confuse them with regular threads that have a visible parent. Signed-off-by: Koni Marti <koni.marti@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Matěj Cepl <mcepl@cepl.eu>
* hooks: add AERC_ACCOUNT_BACKEND to hooks with AERC_ACCOUNTBence Ferdinandy2024-06-056-0/+11
| | | | | | | | | | 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>
* templates: add .AccountBackendBence Ferdinandy2024-06-051-0/+7
| | | | | | | | | | | It's useful to know what the current account's backend is, especially if one has multiple configs where the same account name might use a different backend. Add AccountBackend to templates. Changelog-added: Added `{{.AccountBackend}}` to templates. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* hooks: add AERC_FOLDER_ROLE to hooks with AERC_FOLDERBence Ferdinandy2024-06-054-0/+8
| | | | | | | | | | It's logical to pass this information as well, when we pass a folder name. Changelog-added: Added `AERC_FOLDER_ROLE` to hooks that have `AERC_FOLDER`. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: add select-last-message optionKoni Marti2024-05-281-1/+8
| | | | | | | | | | | | | | Add a [ui].select-last-message option to position the cursor at the bottom of the message list view. Fixes: https://todo.sr.ht/~rjarry/aerc/254 Changelog-added: Add `[ui].select-last-message` option to position cursor at the bottom of the view. Suggested-by: Bence Ferdinandy <bence@ferdinandy.com> Requested-by: Tomasz Kramkowski <tomasz@kramkow.ski> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tomasz Kramkowski <tomasz@kramkow.ski> Acked-by: Robin Jarry <robin@jarry.cc>
* msgstore: restore the directoryChange bool to fix new message bellKarel Balej2024-05-091-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 24eab0f5ef63 the condition under which the triggerDirectoryChange callback is executed was changed so that it would now only run if there were new messages in the currently scrolled into view part of the message list whereas previously it ran for new messages anywhere in the list. The motivation for this was to make the mail-received hook work even when the tab of the receiving account is not currently focused by fetching the new message's/s' headers needed for the hook to execute based on what changed in the scrolled into part of the list. This limitation is needed because apparently we don't currently have a better way to recognize new messages other than comparing the list of UIDs provided by the worker and that kept by the store. My current understanding is that we cannot remove the scroll view limit because then we would be fetching headers for all messages in the directory which can be a somewhat intensive operation. However we can disregard the view limit for the bell as that does not require the headers: it only cares about that something has changed. It is noteworthy that the bell is rung on aerc startup: I assume that this occurs with the initial load of the message store for every account when the else branch where directoryChange is set to true inevitably executes. Overall, this patch is more of a workaround than a proper fix: the ideal situation would be if we were able to fetch headers for new messages independently of the scroll status. However as this is how this was before, it should be suitable as a temporary solution. There are also further problems here: currently we have triggerNewEmail and triggerDirectoryChange callbacks which are both supposed to run when new mail is received, the latter only implicitly. And yet they both use a different mechanism and thus execute under different circumstances. It would be ideal to move the bell into the new mail trigger and get rid of the directory change one as it is otherwise unused. However this is not done here because for some setups the new mail trigger does not run until the tab is focused which is what the aforementioned commit was meant to fix but apparently succeeded in doing so only partially. The directoryChange trigger does not have this drawback and thus should be kept until the issue is resolved for all setups. Also note that for instance for O365 mail the bell still doesn't work properly as there new mail only appears in the store after the given folder is reopened (:prev-folder :next-folder) and the bell is thus rung only then. Fixes: 24eab0f5ef63 ("msglist: fetch headers even when not focused") Fixes: https://todo.sr.ht/~rjarry/aerc/249 Changelog-fixed: Restore previous behaviour of the new message bell which was broken in the last two releases for at least some setups. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* attach: use absolute paths instead of relativeBence Ferdinandy2024-04-141-1/+2
| | | | | | | | | | | | 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>
* hooks: add flag-changedBence Ferdinandy2024-04-142-1/+49
| | | | | | | | | Add the flag-changed hook. References: https://todo.sr.ht/~rjarry/aerc/136 Changelog-added: New `flag-changed` hook. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* hooks: add tag-modifiedBence Ferdinandy2024-04-142-2/+37
| | | | | | | | | Add the tag-modified hook for notmuch and JMAP accounts. References: https://todo.sr.ht/~rjarry/aerc/136 Changelog-added: New `tag-modified` hook for notmuch and JMAP accounts. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose,viewer: do not always wrap people names in quotesRobin Jarry2024-04-131-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, names of recipients in From, To, Cc and Bcc headers are (almost) always wrapped in quotes. Even if they are pure ASCII and contain one upper case letter. E.g.: From: "Foo" <foo@baz.org> There is no valid reason to add these quotes unless the name contains special characters as specified by RFC 5322, section 3.2.3: specials = "(" / ")" / ; Special characters that do "<" / ">" / ; not appear in atext "[" / "]" / ":" / ";" / "@" / "\" / "," / "." / DQUOTE Adapt the check accordingly. Link: https://datatracker.ietf.org/doc/html/rfc5322#section-3.2.3 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* compose: explicitly identify converted text/* partsRobin Jarry2024-04-131-6/+15
| | | | | | | | | | | | | | | | | | | | | 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>
* vaxis: fix panic trace print on stderrRobin Jarry2024-04-131-0/+1
| | | | | | | | | | | | | | | | | | By default, vaxis tries to open stderr, stdout and stdin in that order and uses the first one as its TTY file descriptor. Upon exit, vaxis.Close() closes that file descriptor. When aerc panics, our panic handler calls UICleanup() which is an alias for vaxis.Close(). This effectively makes os.Stderr unusable and all error messages are written to a closed file descriptor. This also break the regular go runtime panic() handler which prints on stderr as well. Use an explicit /dev/tty path instead of stderr to keep it open. Fixes: 6eff242090dc ("ui: so long tcell") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
* ipc: disable IPC completely when disable-ipc=trueJason Cox2024-04-131-4/+0
| | | | | | | | | | | | | | | Truly disable IPC when disable-ipc is set to true in aerc.conf. Don't run commands over IPC and don't start an IPC server. Being able to disable IPC in the config is useful because it allows making aerc open mailto links in a new instance without modifying the aerc.desktop file. There are of course potential security benefits as well. Changelog-changed: The `disable-ipc` option in `aerc.conf` completely disables IPC. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ipc: retry failed command directly, not over IPCJason Cox2024-04-132-46/+6
| | | | | | | | | If IPC fails the first time we try it, we know that no other aerc instance is running. When we retry, run the command directly instead of going through the current instance's own IPC server. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ipc: improve error handlingJason Cox2024-04-132-13/+8
| | | | | | | | | | | | | | | Detect error responses in addition to errors connecting, sending the request, and receiving the response. If an error occurs when retrying the IPC call, keep the new aerc instance running and simply show the error. We already know (due to the initial failed IPC call) that no other aerc instance is running. Keeping the new instance open also improves the visibility of the error in some cases, such as when clicking on a malformed mailto link causes a new aerc instance to open. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* send: prevent sending if multipart conversion failedVitaly Ovchinnikov2024-04-031-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* notmuch: add strategies for multi-file messagesJason Cox2024-04-021-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* mod: update all dependenciesRobin Jarry2024-04-021-18/+9
| | | | | | | | | | | | | | | | | | Patch produced with the following commands: go mod edit -dropreplace=golang.org/x/crypto go get -t -u go mod tidy I dropped the replace of x/crypto. The only use for the fork from ProtonMail is for openpgp which has been deprecated by the official implementation. And aerc explicitly uses the correct import path where needed. go-smtp update was a bit harsh. The API was changed completely. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* gpg: use export-minimal when attaching public keyRobin Jarry2024-03-101-1/+2
| | | | | | | | | | | Depending on how many signatures the public key has, it may be very large. The key signatures are not required to verify the authenticity of an email. Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CCZKDO3ETIOAI.1DDOYI8Z8LY5O%40cepl.eu%3E Reported-by: Matěj Cepl <mcepl@cepl.eu> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Matěj Cepl <mcepl@cepl.eu>
* gpg: fix mime-version header positionRobin Jarry2024-03-101-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* templates: add visual mode indicator to TrayInfoJason Cox2024-03-043-0/+24
| | | | | | | | | | | It's useful to have some indicator of whether or not aerc is in visual mark mode. Add such an indicator to the TrayInfo available in the status line. Changelog-changed: The `TrayInfo` template variable now includes a visual mark mode indicator. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: update vaxis and only use disambiguate csi-u flagTim Culverhouse2024-02-261-0/+1
| | | | | | | | | | | | | | | | | | Update vaxis to 0.8.2, which adds the ability to specify any CSI-u flag combination. Explicitly only use the disambiguate flag. This enables aerc to have additional keybinds not previously possible (C-i, C-m) while preventing some internal logic bugs relating to single-modifier key presses. While these events can be useful, they are not needed in aerc and aerc currently would need several workarounds to properly handle them so let's just not request them in the first place. Fixes a bug with encoding shift+space in the presence of CSI-u in the terminal widget Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Tested-by: Jason Cox <dev@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: enable CSIu key encodingTim Culverhouse2024-02-221-2/+8
| | | | | | | | | | | | | | Enable CSIu key encoding protocol when support is detected. This will enable keybinds which traditionally have been unavailable due to conflicting with other keys (C-i, C-m, C-[, etc). Remove numlock and capslock from all keypresses to prevent interfering with key matching. Changelog-added: Virtually any key binding can now be configured in `binds.conf`, including Shift+Alt+Control modifier combinations. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* revert: "ui: enable kitty keyboard protocol"Robin Jarry2024-02-191-1/+2
| | | | | | | | | | | | | | This reverts commit d73cf33c2c6c3e564ce8aff04acc329a06eafc54. This breaks virtually all key bindings on foot. Almost zero ctrl- bindings work, and even in some cases, single key binds, like n don't register anymore. It looked harmless, but I should probably have tested before applying this. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* ui: enable kitty keyboard protocolTim Culverhouse2024-02-191-2/+1
| | | | | | | | | | | | Enable kitty keyboard protocol when support is detected. This will enable keybinds which traditionally have been unavailable due to conflicting with other keys (C-i, C-m, C-[, etc). Reported-by: Jonathan Dowland <jon+aerc-discuss@dow.land> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Jonathan Dowland <jon@dow.land> Acked-by: Robin Jarry <robin@jarry.cc>
* ipc: accept verbatim commandsJason Cox2024-02-191-2/+5
| | | | | | | | | | | | | | | | | | | | | | | When aerc receives a command over IPC, it quotes the arguments before passing them on to the internal command parser. In many cases, the parser interprets the quotes, and the command runs with the arguments exactly as they were specified in the shell. In some cases, though, the quotes are not interpreted and the additional quotes can cause the command to fail. Simply eliminating the addition of quotes is not possible because some commands need them. Allow a command and its arguments to be specified as a single argument in the shell. In that case, pass that argument verbatim to the internal command parser so that it is interpreted exactly as if it had been typed directly in aerc's command line. Link: https://lists.sr.ht/~rjarry/aerc-devel/%3C20240203085541.27416-2-contact%40willowbarraco.fr%3E Changelog-added: Execute IPC commands verbatim by providing the command and its args as a single argument in the shell. Cc: Willow Barraco <contact@willowbarraco.fr> Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* format: remove unused codeTim Culverhouse2024-02-191-27/+0
| | | | | | | | Remove unused TruncateHead function. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* store: fix split view blinkingNicolas Dichtel2024-02-151-10/+14
| | | | | | | | | | | | | | | | | | | | | When split view and threading mode are enabled, the message is blinking. First, since commit ddfa5cac1fe9 ("msgstore: fix deadlock in thread builder"), the threadCallback is never set to nil: the thread builder calls it continuously. After setting it to nil, the message is still blinking once. To avoid this, don't call the onSelect method (which points to AccountView.updateSplitView()) from the thread builder: the message is already displayed. Let's rewrite Select and selectPriv: - Select(): it takes the lock and calls the onSelect callback; - selectPriv: the assumption is that the lock is held. It doesn't call the onSelect callback. This function is only used by the thread builder. Fixes: 588be1a28422 ("store: improve cursor position") Fixes: ddfa5cac1fe9 ("msgstore: fix deadlock in thread builder") Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Robin Jarry <robin@jarry.cc>
* hooks: add Message-ID to variables for mail-receivedMoritz Poldrack2024-02-141-0/+1
| | | | | | | | | | | | When scripting for the mail-received hook, it can be useful to identify a mail in a maildir. In that case the Message-ID might be one of the most useful parameters to go for identifying the file of a message. Changelog-changed: Add Message-ID to the variables of `[hooks].mail-received`. Suggested-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* log: move package to libRobin Jarry2024-02-1431-29/+241
| | | | | | | 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-0/+20
| | | | | | | | | 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>
* send: move code to lib for reuseKarel Balej2024-02-126-0/+375
| | | | | | | | | | | | | Move the code which handles the preparation of a sender into which the message can be written into lib to allow for reuse. Also hide the sending backend a bit more from the `:send` command code by introducing a NewSender function which determines which backend should be used and invokes the appropriate sender factory function. Rename send() to sendHelper() to avoid collision. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* vaxis: update to v0.7.2 and update ansi parserTim Culverhouse2024-02-126-726/+171
| | | | | | | | | | | | Update Vaxis to v0.7.2 to gain performance improvements and StyledString parsing. The Vaxis parser fully accounts for the terminal's capability to display wide characters. Use the Vaxis StyledString parser to parse and style ansi-encoded strings. Remove unneeded code and tests. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: set title using vaxisTim Culverhouse2024-02-121-0/+1
| | | | | | | Set the window title using Vaxis at UI initialization. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* mouse: use vaxis mouse eventsTim Culverhouse2024-02-124-17/+13
| | | | | | | Replace all tcell.EventMouse events with vaxis mouse events Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: replace tcell-term with vaxis terminalTim Culverhouse2024-02-122-14/+1
| | | | | | | | Replace tcell terminal with the vaxis terminal. The vaxis terminal is a port of tcell term. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* style: use vaxis style everywhereTim Culverhouse2024-02-125-117/+125
| | | | | | | Replace all tcell.Style objects with vaxis.Style objects Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: replace tcell keys with vaxis keysTim Culverhouse2024-02-122-23/+25
| | | | | | | Replace all instances of tcell key usage with vaxis keys Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* fill: replace tcell.Style with vaxis.StyleTim Culverhouse2024-02-122-7/+5
| | | | | | | Replace the Fill implementation with vaxis style objects Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: initialize vaxis directly, drop tcell.Screen initializationTim Culverhouse2024-02-123-29/+20
| | | | | | | | Use Vaxis library directly to initialize the UI, dropping the need for a tcell Screen implementation Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: remove screen and viewportsTim Culverhouse2024-02-123-69/+73
| | | | | | | | Remove references to tcell.Screen or views.Viewports. Convert Contexts and the core UI struct to use Vaxis objects only. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>