aboutsummaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* aerc: change event interfaces to vaxis eventsTim Culverhouse2024-02-128-16/+18
| | | | | | | | | | 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>
* msgviewer: implement inline image viewingTim Culverhouse2024-02-121-0/+1
| | | | | | | | | | | | | | | | | Implement inline image viewing for jpeg, png, bmp, tiff, and webp formats. When a user has no configured image filter and the image is supported and the terminal has either sixel or kitty image protocol support, the image will be displayed in the message viewer. Always clear the screen before each draw. This call is necessary in vaxis to allow for images to be cleared properly between renders. There is no performance impact: the call only resets each cell to a blank cell, and aerc will redraw each one already. Changelog-added: Inline image previews when no filter is defined for `image/*` and the terminal supports it. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: create and expose vaxis Window with ContextTim Culverhouse2024-02-121-2/+11
| | | | | | | | | Create and expose a vaxis.Window object with each Context. vaxis.Windows are used for creating local coordinates (similar to the views.View API that tcell provides). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: so long tcellTim Culverhouse2024-02-121-1/+11
| | | | | | | | | | | | | Replace tcell with vaxis. Vaxis provides several new features (none of which are included in this commit). All behavior should be exactly the same as previous, with one exception: Vaxis does not have an internal terminfo library. Some terminals will now have RGB that didn't before, as well as any other feature that was falling back to some unknown state. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* parse/ansi: remove tcell/terminfo dependencyTim Culverhouse2024-02-122-69/+69
| | | | | | | | | | | | The parse library builds an ansi-escaped string based on a buffer of styled cells. Use constants which aerc will still parse properly (and are the same as the terminfo package was pulling in) to remove dependency on tcell/terminfo. Additionally, we can use the internal go "fmt" package to write strings instead of the terminfo.TParm method (which is much slower at formatting strings). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* view: only set seen flag if not presentRobin Jarry2024-02-111-1/+2
| | | | | | | | No need to do anything if the message was already seen once. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com>
* calendar: make invitation matching case-insensitiveMoritz Poldrack2024-02-111-1/+2
| | | | | | | | | | | | | | Since some organisations are using capitalised email-adresses, there is no guarantee that invitations are received by an address of the same case. Fixes: 62982a9a ("invites: reply with accept, accept-tentative or decline") Changelog-fixed: Calendar responses now ignore case. Reported-by: "Bart Libert" <bart@libert.email> Signed-off-by: Moritz Poldrack <git@moritz.sh> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* main: improve version stringRobin Jarry2024-02-013-0/+29
| | | | | | | | | | | | | | | | | | | | | | | Initialize a build variable to the date on which the binary was generated. Include the date in the build info string which is output when running aerc -v and in the crash logs. Do not rely on parsing the build flags via some obscure base64 voodoo to determine if notmuch support is available or not. Instead, use the symbols from the linked library directly if available. Before: $ aerc -v 0.16.0-183-g4cc2e6be3a01 +notmuch (go1.21.6 amd64 linux) After: $ aerc -v aerc 0.16.0-183-g4cc2e6be3a01 +notmuch-5.6.0 (go1.21.6 amd64 linux 2024-01-31) Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Ciarán Ainsworth <cda@sporiff.dev>
* commands: rename patch delete to patch unlinkKoni Marti2024-01-311-2/+2
| | | | | | | | | | | Rename the command :patch delete to :patch unlink. This expresses the "link" between the project data within aerc and the underlying repository better. :patch unlink does not delete anything in the repository, it only removes the metadata about currently applied patch revisions/tags. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: rename patch remove to patch dropKoni Marti2024-01-315-21/+21
| | | | | | | | Rename the :patch remove command to :patch drop to better express the this operation is the counter-part to :patch apply. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ipc: wait for app to be ready before accepting commandsRobin Jarry2024-01-311-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pass a cancellable context to the IPC server and defer accepting connections until the first worker message has been received by the main thread. This is not a real fix for the :split command not working at startup. :split requires a mail store to be present on the currently selected account tab+folder. I could have waited for a types.DirectoryContents message but it seems silly and bug prone since such a message may never arrive and we don't want to pool IPC messages forever. Also, a types.DirectoryContents message may arrive for one account but :split is only effective *per account* and the default selected account tab is the first one. In any case, this band aid prevents aerc from crashing or breaking down the terminal when running IPC commands in the aerc-startup hook. Fixes: https://lists.sr.ht/~rjarry/aerc-devel/%3CCYPN7AVYQ69S.WV0T67VM6WX3%40wegtam.com%3E Fixes: https://todo.sr.ht/~rjarry/aerc/173 Reported-by: Jens Grassel <jens@wegtam.com> Reported-by: Justine Smithies <justine@smithies.me.uk> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Thomas Böhler <witcher@wiredspace.de> Reviewed-by: Thomas Böhler <witcher@wiredspace.de>
* flags: add support for draft flagJason Cox2024-01-261-0/+10
| | | | | | | | | | | | | | Support the draft flag wherever flags are used. Automatically set it when postponing a message, and allow recalling a message without the -f flag if it has the draft flag set, regardless of what folder it's in. Notmuch doesn't seem to pick up on the draft flag when indexing even though the flag is set on the maildir file. Explicitly set all tags corresponding to set flags when appending a message in notmuch. Changelog-added: Support the `draft` flag. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* tabs: optimize switching by offsetsdelitako2024-01-261-0/+12
| | | | | | | | | | | | | | | | | I imagine no sane user requires aerc to correctly handle commands like `:next-tab 1000000000`, but I tried anyway and it froze aerc while also eating up many GBs of system memory. This behavior is not ideal, so I improved it. This commit adds functions for selecting a tab at an offset from the currently-selected tab and changes the next-tab, prev-tab, and change-tab commands to use these functions instead of looping. Signed-off-by: delitako <delitako@delitako.xyz> Tested-by: Thomas Böhler <witcher@wiredspace.de> Reviewed-by: Thomas Böhler <witcher@wiredspace.de> Acked-by: Robin Jarry <robin@jarry.cc>