aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
Commit message (Collapse)AuthorAgeFilesLines
* feat: add background mail polling option for all workersTim Culverhouse2022-05-312-28/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | Check for new mail (recent, unseen, exists counts) with an external command, or for imap with the STATUS command, at start or on reconnection and every X time duration IMAP: The selected folder is skipped, per specification. Additional config options are included for including/excluding folders explicitly. Maildir/Notmuch: An external command will be run in the background to check for new mail. An optional timeout can be used with maildir/notmuch. Default is 10s New account options: check-mail check-mail-cmd (maildir/notmuch only) check-mail-timeout (maildir/notmuch only), default 10s check-mail-include (IMAP only) check-mail-exclude (IMAP only) If unset, or set less than or equal to 0, check-mail will be ignored Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* widgets: provide a generic selector dialog uiKoni Marti2022-05-311-0/+65
| | | | | | | | Provide a generic selector dialog popup where the user can select from different options. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: check bounds before drawing dialogKoni Marti2022-05-311-2/+3
| | | | | | | | Check bounds before drawing a dialog window to avoid a panic when resizing the terminal window. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: append text partsKoni Marti2022-05-311-13/+58
| | | | | | | | Append text parts to emails in the composer as multipart/alternative. Display the mime-type of the parts in the review window. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: prevent sending empty address list headersTim Culverhouse2022-05-251-0/+4
| | | | | | | | | | Aerc was sending empty address list header fields (specifically CC by default). This was causing DKIM failures in lists.sr.ht. RFC 5322 states that an address field should consist of the field name and one or more addresses, implying empty fields are not allowed. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: fix deadlock with finer-grained lockingKoni Marti2022-05-251-3/+8
| | | | | | | | | | | | Commit 1bac87e80414 ("terminal: fix race when closing a terminal") fixed a race in Terminal.Draw by using a mutex. The current locking of the entire Draw function could create a deadlock, however, since this function itself might call Terminal.Close which is protected by the same mutex. A finer-grained locking solves both the race and deadlock problem. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* fix: "terminal: fix race when closing a terminal"Robin Jarry2022-05-231-3/+0
| | | | | | | I applied the wrong version of this patch. Link: https://lists.sr.ht/~rjarry/aerc-devel/patches/32482 Signed-off-by: Robin Jarry <robin@jarry.cc>
* terminal: fix race when closing a terminalKoni Marti2022-05-231-0/+10
| | | | | | | | | | | | | | | | | Fix race when closing a terminal. The race appears as a nil pointer dereference panic in pty.StartWithAttrs when trying to access the provided term.cmd variable. Before calling pty.StartwithAttrs in the Terminal.Draw function, term.cmd is checked for nil. Terminal.Close must be called concurrently right after this check and before/while entering pty.StartWithAttrs. This can be avoided with a mutex. Link: https://github.com/creack/pty/issues/146 Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CCJ2I45HMOTGD.2J1QMEJ4T1E3N%40t450.arielp.com%3E#%3CCJ3D069RCTXL.3VEZ7JIGFHOHK@Archetype%3E Fixes: https://todo.sr.ht/~rjarry/aerc/38 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: fix panic in selector when resizing terminal0.10.0Koni Marti2022-05-081-5/+63
| | | | | | | | | | | | | | | | Fix panic when resizing the terminal by dynamically adjusting the width of the option selector. The selector does not check the width of the terminal before printing. This can lead to a panic in the account wizard when reducing the terminal width. If the terminal width is not large enough, the space between the options is reduced. If this is still not enough, then the selector will only show the focused option and arrows indicating the alternatives. Fixes: https://todo.sr.ht/~rjarry/aerc/41 Reported-by: Omar Polo <op@omarpolo.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pgp: add attach key commandTim Culverhouse2022-05-061-2/+78
| | | | | | | | | Add compose command ("attach-key") to attach the public key associated with the sending account. Public key is attached in ascii armor format, with the mimetype set according to RFC 3156 ("application/pgp-keys"). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* pgp: check encryption keys before sending messageTim Culverhouse2022-05-061-9/+70
| | | | | | | | | | | | | | | | Add check for public keys of all message recipients (to, cc, and bcc) before sending the message. Adds an OnFocusLost callback to header editors to facilitate a callback for checking keys whenever a new recipient is added (OnChange results in too many keyring checks). Once encryption is initially set, the callbacks are registered. If a public key is not available for any recipient, encryption is turned off. However, notably, the callbacks are still registered meaning as s soon as the user removes the recipients with missing keys, encryption is turned back on. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* pgp: add options auto-sign & opportunistic-encryptTim Culverhouse2022-05-061-0/+7
| | | | | | | | Add account level config options for auto-sign and opportunistic encryption. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* compose: use selected account ui config for security headerRobin Jarry2022-05-041-1/+2
| | | | | | | Do not use the default ui config. Fixes: 78b7e4e993f5 ("compose: add sign/encrypt persistent display") Signed-off-by: Robin Jarry <robin@jarry.cc>
* pgp: check for signing key before signing timeTim Culverhouse2022-05-041-6/+30
| | | | | | | | | | 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>
* compose: add sign/encrypt persistent displayTim Culverhouse2022-04-291-5/+78
| | | | | | | | | | Add a text row below the header editors to (persistently) display if the current message will be signed, encrypted, or both. The display will disappear if the message will not be signed or encrypted. The display is visible on the reviewMessage screen as well Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* dirlist: add format specifier to compact folder nameKoni Marti2022-04-291-0/+4
| | | | | | | | | | | Add the format specifier %N to the dirlist-format to display compacted folder names. A folder such as INBOX/WORK/PROJECT will be compacted to I/W/PROJECT in the directoy list. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* compose: use account ui config where missingRobin Jarry2022-04-281-5/+5
| | | | | | | | | | | | The composer widget already has a reference to the AccountView object. Get the UI config from it directly. This completes commit 6edfbfa8ce37 ("aerc: use contextual ui styleset for tabs/compose"). Fixes: https://todo.sr.ht/~rjarry/aerc/3 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
* feat: add gpg integrationTim Culverhouse2022-04-271-8/+10
| | | | | | | | | | | | | | | | | | | This commit adds gpg system integration. This is done through two new packages: gpgbin, which handles the system calls and parsing; and gpg which is mostly a copy of emersion/go-pgpmail with modifications to interface with package gpgbin. gpg includes tests for many cases, and by it's nature also tests package gpgbin. I separated these in case an external dependency is ever used for the gpg sys-calls/parsing (IE we mirror how go-pgpmail+openpgp currently are dependencies) Two new config options are introduced: * pgp-provider. If it is not explicitly set to "gpg", aerc will default to it's internal pgp provider * pgp-key-id: (Optionally) specify a key by short or long keyId Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* refactor: refactor pgp implementationTim Culverhouse2022-04-275-72/+27
| | | | | | | | | 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>
* style: add style config options for dirlist_unread and dirlist_recentTim Culverhouse2022-04-272-7/+29
| | | | | | | | Adds two style options: dirlist_unread and dirlist_recent. These options apply in layers, in the same way as msglist_* styles do. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgviewer: show available bindings when filter not configuredkt programs2022-04-251-27/+59
| | | | | | | | | | Show what command can be used to achieve the described effect so users can add it as a binding. Fixes: https://todo.sr.ht/~rjarry/aerc/40 Signed-off-by: kt programs <ktprograms@gmail.com> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* statusline: refactor to make it more customizableKoni Marti2022-04-251-1/+4
| | | | | | | | | | | | | | | | | Refactor statusline by clearly separating the rendering part from the text display. Use printf-like format string for statusline customization. Document printf-like format string to customize the statusline. Allow to completely mute the statusline (except for push notifications) with a format specifier. Provide a display mode with unicode icons for the status elements. Implements: https://todo.sr.ht/~rjarry/aerc/34 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* status: use contextual ui styleset for statuslineKoni Marti2022-04-171-7/+9
| | | | | | | Use contextual ui styleset for statusline widget. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: use contextual ui styleset for tabs/composeKoni Marti2022-04-171-4/+14
| | | | | | | | | Use contextual ui styleset for tabs and compose widgets. If no account is selected, use default styleset as fallback. Fixes: https://todo.sr.ht/~rjarry/aerc/3 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* review: show command that will be executed by bindingkt programs2022-04-141-4/+2
| | | | | | | | Also show commands that don't have a binding. This allows users to see what's available to bind. Signed-off-by: kt programs <ktprograms@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* Initialization fix for dynamic foldersAivars Vaivods2022-04-141-0/+9
| | | | | | | | | | | | | | | | | | | There is an issue with backends, that provide dynamic folders, namely when opening folder, that isn't defined in config file, you get empty folder. To actually get messages listed, you need to open that folder twice. At first attempt only DirectoryInfo is fetched and new MessageStore created. Second attempt populates previously created MessageStore with list of messages. For pre-configured folders, DirectoryInfos are fetched upon connection to backend and, when folder is opened, MessageStore is updated with list of messages. Fixes: https://todo.sr.ht/~rjarry/aerc/30 Signed-off-by: Aivars Vaivods <aivars@vaivods.lv> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: fix panic in header formatterMoritz Poldrack2022-04-061-0/+4
| | | | | | Reported-by: noex Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* sort: keep sort criteria applied to folderKoni Marti2022-03-251-2/+2
| | | | | | | | | | | | | | | 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>
* statusline: improve status line updatingKoni Marti2022-03-252-1/+10
| | | | | | | | | | | | Update statusline only for the selected account (to prevent other updates from different accounts to interfere). Update status when jumping/selecting/closing tabs. Fixes cosmetic regressions introduced by commit feecc09b73e2 ("statusline: make statusline folder-specific"). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* save: add -a option to save all attachmentsRobin Jarry2022-03-241-0/+17
| | | | | | | | | | 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>
* logging: fix race condition in startupMoritz Poldrack2022-03-243-6/+10
| | | | | | | | | If a panic occurs in one of the workers, it can happen after the UI was initialised, but before the cleanup function has been registered. With this the start of the worker loops is deferred until the cleanup routine was registered. Signed-off-by: Moritz Poldrack <git@moritz.sh>
* logging: added a log on panicMoritz Poldrack2022-03-236-1/+27
| | | | | | | | | | | | | 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>
* statusline: make statusline folder-specificKoni Marti2022-03-231-8/+4
| | | | | | | | | | | | 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>
* compose: make headerEditor focusing more reliableTim Culverhouse2022-03-222-21/+9
| | | | | | | | | | | | 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>
* msglist: update message counter upon filter changeKoni Marti2022-03-201-0/+6
| | | | | | | | | | | | | | | | Update message counter in msglist when the filter is changed (either set or cleared in the msgstore). When we apply a filter, we change the number of uids in the message store. This can unintentionally trigger the storeUpdate() function of the msglist which checks the number of uids for new messages and advances the pointer by the difference in the number of messages. This can be avoided when we update the message counter upon changing the filter. Fixes: https://todo.sr.ht/~rjarry/aerc/23 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* statusline: update status only when necessaryKoni Marti2022-03-201-1/+6
| | | | | | | | | | | | | Update statusline only when changed to reduce cpu usage. commit 2512c0403fa4 ("statusline: implement per-account status") updates the status irrespective of whether the statusline changed or not. This can lead to high cpu usage that can be avoided. Reported-by: Jens Grassel <jens@wegtam.com> Reported-by: inwit <inwit@sindominio.net> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* statusline: implement per-account statusKoni Marti2022-03-183-31/+40
| | | | | | | | | | | | | | | | 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>
* mailto: handle bcc and body fieldsTim Culverhouse2022-03-181-0/+10
| | | | | | | Enable handling of bcc and body fields in mailto links Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* go vet: composite literal uses unkeyed fieldsMoritz Poldrack2022-03-185-80/+80
| | | | | | | | This commit fixes all occurrences of the abovementioned lint-error in the codebase. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* mailto: allow empty recipient fieldTim Culverhouse2022-03-181-1/+4
| | | | | | | | Allow a mailto link to open a new composer even if no recipient is in the url. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Moritz Poldrack <git@moritz.sh>
* viewer: add key passthrough modekt programs2022-03-142-1/+19
| | | | | | | | | | | | | | | | 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>
* all: fix minor issues found by staticcheckMoritz Poldrack2022-03-124-10/+3
| | | | Signed-off-by: Moritz Poldrack <git@moritz.sh>
* scrollable: extract scrolling behavior for reuseKoni Marti2022-03-034-139/+101
| | | | | | | | | Extract the vertical scrolling ability into its own Scrollable struct that can be embedded and reused across any ui element that relies on scrolling. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: always check SelectedAccount return valueRobin Jarry2022-02-253-22/+32
| | | | | | | | | | | | | | | | 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>
* ui: make dirlist-delay context-awareinwit2022-02-241-1/+1
| | | | | | | | | | | | | | Allow this in aerc.conf: dirlist-delay=200ms ... [ui:account=CrappyO365Account] dirlist-delay=2000ms Fixes: https://todo.sr.ht/~rjarry/aerc/26 Signed-off-by: Koni Marti <koni.marti@gmail.com> Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* threading: implement on-the-fly message threadingKoni Marti2022-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* dirtree: implement foldable tree for directory listKoni Marti2022-02-233-3/+504
| | | | | | | | | | | | | | implement a foldable tree for the directory list. Expand all parent directories when a hidden directory is selected with the change-folder command. folders-sort considers the top-level directories only. The folders and foldersexclude filters work with the full directory path. Enable tree view by adding 'dirlist-tree=true' to the config file. Implements: https://todo.sr.ht/~sircmpwn/aerc2/228 Signed-off-by: Koni Marti <koni.marti@gmail.com>
* search/filter: display in extra statusRobin Jarry2022-02-232-1/+23
| | | | | | | | | | 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>
* imap: improve reconnect stabilityKoni Marti2022-02-061-1/+3
| | | | | | | | | | | | | | | | improves the robustness of the imap reconnect feature which was introduced in commit beae17a6da37 ("imap: auto-reconnects on connection error"). If a connection error is emitted, the message list is cleared and a corresponding error message is shown in the ui. Status bar is updated as well. Upon reconnect, the directories and the message list will be re-fetched (same behavior as the connect command). Reconnect can be enabled and disabled with the connect and the disconnect commands. Signed-off-by: Koni Marti <koni.marti@gmail.com>
* compose: allow setting all headers in templatesRobin Jarry2022-02-031-2/+2
| | | | | | | Allow setting To, Cc, Subject, Bcc in template headers. Fixes: https://todo.sr.ht/~rjarry/aerc/19 Signed-off-by: Robin Jarry <robin@jarry.cc>