aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* tcell-term: upgrade to latest releaseTim Culverhouse2023-04-233-22/+29
| | | | | | | | | | | | | | | | | Upgrade tcell-term to latest release. This is a complete rewrite of tcell-term, and includes many minor bug fixes and overall improvements. Notably: - Improved parsing - One fewer goroutine - Improved API - Improved redraw messaging - Improved key support - Improved mouse support Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
* colorize: support email domains that start/end with digitsRobin Jarry2023-04-221-1/+1
| | | | | | | | | | | | According to RFC 1123: "... a host domain name is now allowed to begin with a digit and could legally be entirely numeric ..." Link: https://datatracker.ietf.org/doc/html/rfc1123#section-2 Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com>
* mailto: add template parameterKoni Marti2023-04-222-2/+8
| | | | | | | | | Add template parameter to the mailto query and set the config.Template.NewMessage template file as default. Fixes: https://todo.sr.ht/~rjarry/aerc/145 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry<robin@jarry.cc>
* search: handle headers in search/filter queryJulian Marcos2023-04-225-4/+28
| | | | | | | | | Handle headers in the search and filter commands, for searching and filtering based on the Headers specified by the -H parameter, the syntax for the -H parameter should be `Header: Key`. Signed-off-by: Julian Marcos <jmjl@tilde.green> Acked-by: Robin Jarry<robin@jarry.cc>
* directory: add role to template fieldsTim Culverhouse2023-04-2210-15/+40
| | | | | | | | | Add .Role as a template field for use in distinguishing between mailboxes with a given IANA role, or custom role defined by aerc ("query" for notmuch queries, for example). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
* directory: add IANA mailbox rolesTim Culverhouse2023-04-223-3/+47
| | | | | | | | | | | Add IANA registered mailbox role, and a custom aerc role "query". This will be used in subsequent commits which add the Role field to templates, allowing users to style mailbox by IANA role, or style notmuch queries differently than maildir dirs when using the notmuch worker + maildir option. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
* directory: use directory to store rue countsTim Culverhouse2023-04-2210-84/+57
| | | | | | | | | | | | Store the Directory RUE counts on the Directory data model. Use DirectoryInfo messages to update the Directory model. Access Directories via the dirlist instead of via the msgstore. Remove unused fields on DirectoryInfo, all backends now give accurate counts. Move refetch logic into dirlist Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
* imap: update directory on flag opsTim Culverhouse2023-04-221-0/+3
| | | | | | | | | | All other backends automatically update directory counts by sending a directory info when a flag operation is performed. Unify the imap backend to this model by posting a CheckMail action, which requests an updated status from the server and posts a DirectoryInfo message Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
* dirstore: store directory model in dirstoreTim Culverhouse2023-04-223-8/+15
| | | | | | | | Use the dirstore to store models.Directory data structures. This will be used in subsequent commits for accessing directory data. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* directory: remove attributes fieldTim Culverhouse2023-04-225-14/+7
| | | | | | | Remove the unused field Attributes Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* listDirectories: refactor listdirectories handlingTim Culverhouse2023-04-224-59/+69
| | | | | | | | | | | | | | | | | ListDirectories is called when connecting, reconnecting, and creation/deletion of a directory. The code is not in the same style as other areas of aerc. Refactor to match coding style of the rest of aerc by creating an Update function which handles necessary updates in the dirlist. This style does not use a callback, making it clearer what is happening in the message flow, and operates similar to how the msgstore receives updates. Use a map in the dirstore to reduce duplicate storage of directory names. Directly add or remove directories from the map when created / deleted to prevent a new ListDirectories message, and a flash of the UI. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgstore: create from types.Directory messageTim Culverhouse2023-04-223-29/+34
| | | | | | | | | | | | | | | Create msgstores when a types.Directory message is received. This removes a quirk from the IMAP worker that msgstores are created on the first DirectoryInfo, and updated on the second. This path requires three messages in order to get an updated message store. By creating from types.Directory, we ensure that any subsequent DirectoryInfo can be routed to a msgstore. Remove the field DirInfo from the msgstore initializer, it isn't needed at initialization and isn't available with this refactor. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* capabilities: report capabilities from backendTim Culverhouse2023-04-2210-23/+48
| | | | | | | | | | | | | Use the Backend interface to report Backend capabilities. Previously, these were reported via a DirectoryInfo message, however they have nothing to do with a directory and should be reported directly by the backend. Add Capabilities method to Backend interface, satisfy this in each backend, and use it on the UI side. Remove Caps field from DirectoryInfo Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
* imap: properly handle mailbox status updatesTim Culverhouse2023-04-222-15/+11
| | | | | | | | | | | | | | | | | | | | Mailbox status updates received from the IMAP server do not come with the information being sent to the UI. Use the update signal to instead trigger a check-mail of the directory the status was sent for. The status update comes with the following data: - Messages in the mailbox - Recent messages in the mailbox - Sequence number of the first Unseen message - Flags in the mailbox The data we actually we want to send to the UI: - Messages in the mailbox - Recent messages in the mailbox - Unseen messages in the mailbox Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgstore: fetch message list based on OpenDirectory msgTim Culverhouse2023-04-227-13/+19
| | | | | | | | | | | | | | | Fetching the message list is done in a convoluted way. The UI receives a DirectoryInfo message, which creates a message store. It then receives a second DirectoryInfo (an oddity from the IMAP worker), and this DirectoryInfo is passed to the message store which then requests a fetch of the message list via store.Sort. Use the OpenDirectory done response to tell the message store to fetch messages. This makes the code easier to follow, and does not rely on quirks from the IMAP worker. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* colorize: don't print an id in osc8 terminatorTim Culverhouse2023-04-153-9/+13
| | | | | | | | | | | Printing an ID in the OSC8 terminator can cause issues in some pagers and/or terminals. The "spec" doesn't allow for an ID in the terminator, but most applications and terminals will ignore it if it's there. Prevent printing it in the first place for better compatibility. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Robin Jarry <robin@jarry.cc>
* templates: change layered fg & bg color prioritiesRobin Jarry2023-04-152-9/+8
| | | | | | | | | | | | | This is mostly a revert of commit ae4d742c5a90 ("templates: fix layered fg & bg color for inline styles"). As it turns out, context colors (msglist_selected, msglist_marked, msglist_deleted, etc.) need to have priority over inline colors. Otherwise strange and confusing results occur. Reported-by: Skejg <grolleman@zoho.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* term: update tab title even when tab is not selectedRobin Jarry2023-04-151-2/+4
| | | | | | | | | | | When a terminal widget title is updated, the screen is not redrawn. Only the UI state is invalidated so that on the next redraw, the title will be refreshed. Make sure that the screen is redrawn when the title changes. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* term: ignore redraw events when not visibleRobin Jarry2023-04-155-3/+40
| | | | | | | | | | | | | | | | Another attempt at fixing the high CPU usage when terminal tabs are running interactive tui applications and the message list tab is selected. There are cases where a terminal widget can be visible but not focused (composer, message viewer, attachment selector, etc.). Define a new Visible interface with a single Show() method. Call that method when changing tabs to make sure that terminal widget content events only trigger redraws when they are visible. Fixes: 382aea4a9426 ("terminal: avoid high cpu usage when not focused") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
* dialog: avoid panic when window is too smallRobin Jarry2023-04-151-2/+14
| | | | | | | | | Avoid negative offsets and limit height to the parent context height. Fixes: https://todo.sr.ht/~rjarry/aerc/142 Reported-by: Akspecs <akspecs@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
* chore: fix typos in contributing guidelinesMoritz Poldrack2023-04-101-3/+3
| | | | | | | | | | As many do not know, step-by-step is actually an adjective in its own right. Debugging is also written with three g and not with two. Link: https://www.merriam-webster.com/thesaurus/step-by-step Link: https://www.merriam-webster.com/thesaurus/debugging Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
* attach: focus terminal for file pickerKoni Marti2023-04-101-0/+1
| | | | | | | | | | | Focus terminal for file picker to ensure that terminal is correctly redrawn when using it. After commit 382aea4a ("terminal: avoid high cpu usage when not focused"), the file picker terminal in the attach command (when called with the -m flag) would not work as expected. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* wrap: do not strip signature delimiter trailing spaceRobin Jarry2023-04-103-5/+13
| | | | | | | | | | Some tools expect this trailing space to be present to detect email signatures start. Reported-by: Jd <john1doe@ya.ru> Fixes: https://todo.sr.ht/~rjarry/aerc/131 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Jd <john1doe@ya.ru>
* doc: clarify layered styles render priorityRobin Jarry2023-04-101-0/+43
| | | | | | | | | With all the new different options, the behaviour can be confusing. Add explicit rules and examples to avoid ambiguities. Reported-by: skejg <grolleman@zoho.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Inwit <inwit@sindominio.net>
* terminal: avoid high cpu usage when not focusedRobin Jarry2023-04-041-1/+3
| | | | | | | | | | | | | | | | When running dynamic tui applications (such as btop, htop, etc.) in the embedded :terminal and focusing an account tab, every tui application change triggers a full redraw of the whole window. When the message list is focused, this leads to high cpu usage because of the computationally intensive templates parsing and ansi sequence handling. Only redraw when the terminal is focused. Do not use tcell Watch and Unwatch functions since these completely disable all widget updates, including title changes and terminal close events. Reported-by: John Mcenroy <handplanet@outlook.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: John Mcenroy <handplanet@outlook.com>
* stylesets: fix *.selected parsingRobin Jarry2023-04-021-1/+1
| | | | | | | | | | | | | | | | | | | The stylesets are parsed in two passes. The first pass skips the .selected keys and updates the attributes and colors of both the objects and selected maps. The second pass is supposed to only update the selected map of the pointed style objects. The boolean logic was incorrect, the .selected styles were applied on normal objects as well which led to confusing behaviour most specifically when using *.selected.toggle=true. Properly parse .selected elements. Fixes: 47675e80850d ("config: rework styleset parsing") Reported-by: John Mcenroy <handplanet@outlook.com> Reported-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Kirill Chibisov <contact@kchibisov.com>
* colorize: make url parsing more robustRobin Jarry2023-04-023-25/+84
| | | | | | | | | | | | | | | | | | Reuse the URL parsing algorithm from foot. Basically, it involves recording the opening [, (, < and take into account their closing counterparts. If a closing character is encountered with no matching opening one, assume the URL ends. This allows handling markdown link syntax such as: [http://foobaz.org/xxx](http://foobaz.org/xxx) Avoid coloring bare URL protocols such as http:// or https:// Update test vector to handle more corner cases. Link: https://codeberg.org/dnkl/foot/src/tag/1.13.1/url-mode.c#L331-L471 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Kirill Chibisov <contact@kchibisov.com>
* accounts: warn for starttls deprecation only onceRobin Jarry2023-04-021-1/+3
| | | | | | | | | | | | | | If the user has several accounts with smtp-starttls=yes set, they will be warned multiple times for each account. This is confusing and may let the user believe that aerc is stuck because closing the dialog seems to have no effect. Only warn once. Fixes: c09b17a930cc ("smtp: replace smtp-starttls with schema option") Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* hooks: add aerc-shutdownMoritz Poldrack2023-04-016-1/+45
| | | | | | | | | | Add a hook to run when aerc shuts down. The environment is supplemented with the duration aerc was alive for. References: https://todo.sr.ht/~rjarry/aerc/136 Signed-off-by: Moritz Poldrack <git@moritz.sh> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* hooks: add aerc-startup hookMoritz Poldrack2023-04-016-1/+53
| | | | | | | | | | | Add a hook to run when aerc starts up. The environment is supplemented with aerc version and the path to its binary. References: https://todo.sr.ht/~rjarry/aerc/136 References: https://todo.sr.ht/~rjarry/aerc/139 Signed-off-by: Moritz Poldrack <git@moritz.sh> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* config: replace triggers with hooksMoritz Poldrack2023-04-0111-90/+143
| | | | | | | | | | | | | Deprecate triggers and replace them with hooks. Now that aerc supports running arbitrary ex commands over IPC, it is possible to run internal aerc commands *and* shell commands via external shell scripts. Hooks only allow running shell commands. Hooks info is passed via environment variables. Implements: https://todo.sr.ht/~rjarry/aerc/136 Signed-off-by: Moritz Poldrack <git@moritz.sh> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* tabs: make sure to close tab contentRobin Jarry2023-04-0117-44/+43
| | | | | | | | Rework how tabs are closed. Change the aerc.RemoveTab and aerc.ReplaceTab functions to accept a new boolean argument. If true, make sure to close the tab content. Signed-off-by: Robin Jarry <robin@jarry.cc>
* config: remove subject contextual ui sectionsRobin Jarry2023-03-314-63/+57
| | | | | | | | | | We have been wanting to remove this for a while now. The only use case is styleset and changing the whole styleset based on an email subject does not make much sense. The same feature can be achieve with dynamic msglist* styles based on any email header value in the stylesets now. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* styleset: allow dynamic msglist stylingRobin Jarry2023-03-315-33/+134
| | | | | | | | | | | Add support for dynamic msglist*.$HEADER,$VALUE.$ATTR = $VALUE where $VALUE can be either a fixed string or a regular expression. This is intended as a replacement of contextual ui sections based on subject values. Implements: https://todo.sr.ht/~rjarry/aerc/18 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* config: rework styleset parsingRobin Jarry2023-03-311-115/+53
| | | | | | | Simplify code. Prepare for dynamic styling of the message list. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* style: inherit colors unless explicitly set in layered stylesRobin Jarry2023-03-312-9/+13
| | | | | | | | Inherit from the lower layers colors unless explicitly overridden in upper layers. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* templates: fix layered fg & bg color for inline stylesRobin Jarry2023-03-311-7/+8
| | | | | | | | | | | | | The logic was inverted. The style argument is actually the "under" layer style. Each character in the RuneBuffer style must be applied on *top* of it, not the other way around. Use colors from style and override them with each character's colors if they are set. Keep attributes handling unchanged. Fixes: ab8f433e1739 ("templates: allow layered fg & bg color for inline styles") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* config: report accounts.conf format errorsRobin Jarry2023-03-262-13/+15
| | | | | | | | | | | When accounts.conf cannot be parsed, return an error instead of assuming that the file is non existent and wrongfully opening the new account wizard. Use the same ini delimiters for all configuration files. Fixes: https://todo.sr.ht/~rjarry/aerc/151 Reported-by: Jon Fineman <jon@fineman.me> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* colorize: emit OSC 8 for URLs and emailsKirill Chibisov2023-03-264-7/+28
| | | | | | | | | | Mark URLs with OSC 8 escape sequence to help terminal emulators with opening multi-line URLs with the mouse and attach the hyperlink to email addresses, so the users could open them. Link: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda Signed-off-by: Kirill Chibisov <contact@kchibisov.com> Acked-by: Robin Jarry <robin@jarry.cc>
* colorize: use bool for boolean variablesRobin Jarry2023-03-261-27/+28
| | | | | | Do not use int for true/false values. Signed-off-by: Robin Jarry <robin@jarry.cc>
* parse msg-id lists more liberallyNguyễn Gia Phong2023-03-267-38/+99
| | | | | | | | | | | | | | | Some user agents deliberately generate non-standard message identifier lists in In-Reply-To and References headers. Instead of failing silently, aerc now falls back to a desperate parser scavaging whatever looking like <id-left@id-right>. As the more liberal parser being substituted with, References header are now stored for IMAP not only when there's a parsing error. Fixes: 31d2f5be3cec ("message-info: add explicit References field") Signed-off-by: Nguyễn Gia Phong <mcsinyx@disroot.org> Acked-by: Robin Jarry <robin@jarry.cc>
* smtp: replace smtp-starttls with schema optionMarcin Serwin2023-03-264-55/+53
| | | | | | | | | The "smtp-starttls" options is now ignored in favor of more detailed schema specification, similarly to IMAP. Fixes: https://todo.sr.ht/~rjarry/aerc/149 Signed-off-by: Marcin Serwin <marcin.serwin0@protonmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ci: fix lint if notmuch is not installedMoritz Poldrack2023-03-162-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The linter goes completely crazy when notmuch is not installed and the notmuch build tag is enabled. With an otherwise successful lint, the following output is generated: worker/notmuch/lib/database.go:14:10: could not import github.com/zenhack/go.notmuch (-: # github.com/zenhack/go.notmuch ../../go/pkg/mod/github.com/brunnre8/go.notmuch@v0.0.0-20201126061756-caa2daf7093c/configList.go:9:11: fatal error: notmuch.h: No such file or directory 9 | // #include <notmuch.h> | ^~~~~~~~~~~ compilation terminated.) (typecheck) notmuch "github.com/zenhack/go.notmuch" ^ commands/eml.go:4:2: "bytes" imported and not used (typecheck) "bytes" ^ aerc.go:39:7: previous case (typecheck) case *widgets.AccountView: ^ exit status 1 make: *** [Makefile:73: lint] Error 1 Only include the notmuch build tag in the lint process if it is actually installed. Signed-off-by: Moritz Poldrack <git@moritz.sh> Signed-off-by: Robin Jarry <robin@jarry.cc>
* doc: merge duplicate :filter in aerc(1)witcher2023-03-161-6/+2
| | | | | | | | | | | :filter was given twice in the "MESSAGE LIST COMMANDS" section of aerc(1), both incomplete/wrong. Merge both to reference aerc-search(1) and say it actually *filters* the message list. Fixes: af63bd0188d1 ("doc: homogenize scdoc markup") References: https://todo.sr.ht/~rjarry/aerc/144 Signed-off-by: witcher <witcher@wiredspace.de> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* main: rename aerc.go -> main.goRobin Jarry2023-03-151-0/+0
| | | | | | | | I like it better that way. And it will not piss me off every time I need to use auto completion. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* config: fix default value of next-message-on-deleteRobin Jarry2023-03-151-1/+1
| | | | | | | | | The default value should be true as stated in the docs. Fixes: b63c93563c62 ("config: use reflection to map ini keys to struct fields") Reported-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Kirill Chibisov <contact@kchibisov.com>
* move/archive: make sure to close existing viewerRobin Jarry2023-03-151-0/+2
| | | | | | | | | | When running :move or :archive with a message viewer opened, the viewer is never closed properly. This leads to resources leak (pager processes left running). Fix that. Reported-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Kirill Chibisov <contact@kchibisov.com>
* openers: support basic shell globbingRobin Jarry2023-03-135-16/+38
| | | | | | | Allow wild cards for MIME types like in filters. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* openers: add mime type handling for open-linkRobin Jarry2023-03-137-17/+33
| | | | | | | | | Provide a way to configure link openers. Based on the URL mime type: x-scheme-handler/$scheme. Signed-off-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* doc: improve aerc-templates examplesRobin Jarry2023-03-131-2/+5
| | | | | | Adjust some examples with real world use cases. Signed-off-by: Robin Jarry <robin@jarry.cc>