aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* notmuch: fix watcher pathThorben Günther2024-08-241-3/+14
| | | | | | | | | | | | | | The watcher path does not necessarily contain ".notmuch". From notmuch-config(1): Notmuch will store its database here, (in sub-directory named .notmuch if database.mail_root is unset). So we can simply check if the ".notmuch" folder exists and fallback to the default path if it does not. Signed-off-by: Thorben Günther <admin@xenrox.net> Acked-by: Robin Jarry <robin@jarry.cc>
* ircbot: sanitize email subjectsRobin Jarry2024-08-201-3/+5
| | | | | | | | | Email subjects may contain line breaks if they are too long to fit in 72 columns. The supybot library does not support sending messages with line breaks. It raises an error. Replace all consecutive "white space" characters (including \r and \n) with regular space characters. Signed-off-by: Robin Jarry <robin@jarry.cc>
* commands: add reloadKoni Marti2024-08-205-4/+199
| | | | | | | | | | | | | | Add the reload command that performs a reload of config files. The reload command supports reloading the binds.conf and aerc.conf config files. Reloading will reload account views (including the directory list), message viewers, and composers. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* store: extract configure logicKoni Marti2024-08-202-62/+60
| | | | | | | | | | Extract a function to configure the message store from its constructor to reconfigure the store when the data changes. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* account: update split viewsKoni Marti2024-08-201-2/+23
| | | | | | | | | | | Update split views on reload. Use the safe acct.SelectedMessage() instead of acct.msglist.Selected() which can panic if msglist.store is nil. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* account: extract configure logicKoni Marti2024-08-201-17/+22
| | | | | | | | | | Extract a function to configure the account view from the constructor; rebuild the grid whenever the config data changed on a hot-reload. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* account: remove ui config struct fieldKoni Marti2024-08-203-21/+18
| | | | | | | | | | Remove the UI config field in the AccountView struct to ensure we use the most current UI config. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* tabs: update ui config in any tabKoni Marti2024-08-202-26/+27
| | | | | | | | | Update UI config in tabs. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* log: handle config reloadKoni Marti2024-08-202-3/+48
| | | | | | | | | | | | Prepare the logging system for a config file reload. Make sure that we never close os.Stdout but only log file descriptors. Note that if you started aerc by redirecting its output into a specific file, this cannot be changed by a config reload. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* config: extract load styleset functionKoni Marti2024-08-201-19/+33
| | | | | | | | | | Extract the function to load stylesets. Add a function to clear the contextual UI cache. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* config: add reload helper functionsKoni Marti2024-08-204-4/+77
| | | | | | | | | | Add reload helper function to reload config files. Store the initially used config files for the reloading. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* jmap: refactor thread fetchingTim Culverhouse2024-08-202-40/+23
| | | | | | | | | | | | | | | | | | Refactor JMAP thread fetching to occur in a single request. We use a result reference method call on Email/get to fetch the message info for each message in a thread. Previously, we checked the cache and only fetched information for messages we didn't already have. This results in two requests and is typically slower for most contexts. Also, in most cases if we are fetching an email we don't already have it's because we also need to fetch the entire thread. The only case this wouldn't happen is if we get a new email in a thread. We can optimize this by fetching message info for created messages in the push method at a later time. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* jmap: lazily fetch identitiesTim Culverhouse2024-08-202-19/+33
| | | | | | | | | | | | | Fetch Identities only when required: when we are sending an email. Refactor connect.go to check the state string of the Session on every request, and update the session as needed. Move the Session validity check to happen on any request, eg when our client returns an error we first update the Session object (via re-authenticating) and then retry the request. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: set the forwarded flag when forwarding msgsinwit2024-08-203-7/+36
| | | | | | | | | | | The maildir backend was ignoring the passed/forwarded flag. Allow for this flag to be set and synced to the server (if the server admits it). Changelog-added: The maildir backend now honors the forwarded/passed flag. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: set the "passed" tag when forwarding msgsinwit2024-08-203-8/+36
| | | | | | | | | | | | | | In notmuch, forwarded messages should be marked with the "passed" tag, which is subsequently synchronized with the corresponding maildir "P" flag. Ensure both flag and tag are applied to forwarded messages in the notmuch interface. Link: https://notmuchmail.org/special-tags/ Changelog-added: The notmuch backend now honors the forwarded flag, setting the "passed" tag. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* flag: manually toggle the forwarded taginwit2024-08-201-5/+13
| | | | | | | | | | Allow the user to manually set, unset and toggle the forwarded tag. Changelog-added: The :flag command now sets/unsets/toggle the forwarded tag. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* templates: add a template for forwaded messagesinwit2024-08-204-2/+14
| | | | | | | | | | | Add a {{.IsForwarded}} template to tell if a message has been forwarded or not. Changelog-added: Forwarded messages can be identified with the {{.IsForwarded}} template. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* styles: add a style for forwarded messagesinwit2024-08-203-10/+18
| | | | | | | | | | | Allow for messages marked with the forwarded flag to be styled differently. Changelog-added: Forwarded messages can be styled differently in the message list. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* search: allow searching for forwarded messagesinwit2024-08-202-4/+7
| | | | | | | | | | | | Commands :search and :filter allow the use of certain flags (read, replied...) as search criteria. Allow for the use of the forwarded flag too. Changelog-added: Forwarded messages can now be searched for and filtered in notmuch and maildir. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* forward: allow forwarded flag to be setinwit2024-08-208-2/+39
| | | | | | | | | | | | Usually, a MUA sets a flag for messages that have been forwarded, but this is currently not the case for aerc. Consider the forwarded flag and prepare aerc to set it everytime the :forward command is called and ends successfully. Changelog-added: The :forward command now sets the forwarded flag. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* copy: add -d flag to decrypt before copyingKoni Marti2024-08-202-2/+36
| | | | | | | | | | | Add -d flag to the copy command to decrypt a message before copying it. Implements: https://todo.sr.ht/~rjarry/aerc/238 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Jens Grassel <jens@wegtam.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pipe: add -d flag to decrypt messageKoni Marti2024-08-202-2/+29
| | | | | | | | | | | Add -d flag to the pipe command to decrypt a message before it is piped. Implements: https://todo.sr.ht/~rjarry/aerc/238 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Jens Grassel <jens@wegtam.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* cryptoutil: implement cleartext functionKoni Marti2024-08-201-0/+69
| | | | | | | | | | | | | | | Implement a cleartext function in the cryptoutil package to decrypt an encrypted message to cleartext and construct a valid rfc2822 message. The headers from the decrypt message body will be merged with the original headers to create a fully decrypted message. Implements: https://todo.sr.ht/~rjarry/aerc/238 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Jens Grassel <jens@wegtam.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* mod: update go-maildir to v0.5.0Bence Ferdinandy2024-08-202-3/+3
| | | | | | | | | This release solves an issue with malformed files in a folder stopping go-maildir from listing all other valid files. Fixes: https://todo.sr.ht/~rjarry/aerc/215 Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* go: bump minimal version to 1.21 and handle deprecationsBence Ferdinandy2024-08-206-12/+8
| | | | | | | | | | | | | Go 1.18 is already EOL. go-maildir v0.5.0 requires go 1.20 at least. Since go 1.20 is also EOL, bump the minimum required go version to the first still supported version which is 1.21. Go 1.20 deprecated Seed and Read in math/rand. Update the code accordingly. Changelog-deprecated: Support for go 1.20 and older. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: only abort directory listing if there are 0 uidsBence Ferdinandy2024-08-201-1/+1
| | | | | | | | | | | | If there is an error in container.UIDs, we will abort handling the message list, resulting in showing the number of messages by the directory name, but having an empty message list showing. Only return with err, if UIDs actually returned 0 messages. References: https://todo.sr.ht/~rjarry/aerc/215 Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* filters: send real COLUMNS and LINES valuesTristan Partin2024-08-201-0/+4
| | | | | | | | | | | | Previously filters received default COLUMNS LINES values no matter the width of the terminal. Fixes: https://todo.sr.ht/~rjarry/aerc/232 Changelog-added: Filters will receive the actual COLUMNS and LINES values. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* templates: fix AccountFrom default breaking startupBence Ferdinandy2024-08-201-1/+1
| | | | | | | | | | | | The default of {{.AccountFrom}} is currently nil. During startup, if index-columns has something like {{.AccountFrom.Address}} then startup will fail due to nil pointer evaluation. Add an example address to return. Fixes: 1d4eafb011f4 ("templates: add {{.AccountFrom}} template") Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: skejg <grolleman@zoho.com> Acked-by: Robin Jarry <robin@jarry.cc>
* log: explain why the signature command failedTristan Partin2024-08-201-0/+5
| | | | | | | It wasn't previously apparent why the command failed. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* template: pass account and folder names to signature commandTristan Partin2024-08-201-0/+4
| | | | | | | | | This can help to dynamically determine what signature you want. Changelog-added: `AERC_ACCOUNT` and `AERC_FOLDER` are now available in the signature command environment. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* jmap: fix emailKey function nameTristan Partin2024-08-201-4/+4
| | | | | | | This was just a simple typo. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* send: redact password in outgoing URI for loggingKoni Marti2024-08-201-1/+1
| | | | | | | | | | Redact the password in the outgoing URI for logging. This will replace the password by "xxxxx" and prevent a plaintext password leak in the logs. Signed-off-by: Koni Marti <koni.marti@gmail.com> Reviewed-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: reload all changed messages on DB changeJason Cox2024-08-202-23/+41
| | | | | | | | | | | | | | | | | | | | | | | This reverts commit c56649fe5291b725f14b45550a68cc7d0dc16ff7. As discussed in the aerc-devel thread for the reverted patch, the performance improvement comes with an issue: changes to message tags are no longer immediately reflected in the UI. This issue occurs whether the tags are modified from within aerc or externally with the notmuch CLI. The message list also flickers any time tag changes are made. Further, commit c36ed72e4a59 ("notmuch: speed up lastmod query") dramatically reduces the number of messages which are re-indexed when the database changes, likely eliminating the need for the reverted performance improvement anyway. Fixes: c56649fe5291 ("notmuch: don't reload all message on change") Link: https://lists.sr.ht/~rjarry/aerc-devel/patches/53729 Link: https://lists.sr.ht/~rjarry/aerc-devel/patches/54028 Reported-by: Robin Dapp <rdapp@modk.org> Reported-by: Ryan Winograd <ryan@thewinograds.com> Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* view-message: add option to view message in background tabAron Lebani2024-08-045-31/+52
| | | | | | | | | | | | | | | Add a -b flag to the :view command to open messages in a background tab instead of automatically switching to the new tab after opening. This is similar to opening browser tabs in the background. More generally, adds a new function app.NewBackgroundTab so that it is possible to enable other tabs to be opened in the background in the future. Implements: https://todo.sr.ht/~rjarry/aerc/266 Changelog-added: Add `-b` flag to the `:view` command to open messages in a background tab. Signed-off-by: Aron Lebani <aron@lebani.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* search,filter: add flag to use custom extensionsKoni Marti2024-08-043-7/+49
| | | | | | | | | | | | | | | | | | Add an extension flag to the search/filter command which will provide different completion strategies for the search terms and instruct the backend to use custom extensions (such as X-GM-EXT-1) if available. The following examples are based on the Gmail extension (note that this should be enabled in your accounts.conf with 'use-gmail-ext=true'): :filter -e filename:pdf from:bob :filter -e has:attachment newer_than:2d :search -e is:read is:starred :search -e list:~rjarry/aerc-devel@lists.sr.ht Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* imap: expose extension in capabilitiesKoni Marti2024-08-042-2/+14
| | | | | | | | Expose the supported extensions in the capabilities. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* imap: extend SEARCH with X-GM-RAW for full Gmail search syntaxKoni Marti2024-08-045-10/+193
| | | | | | | | | | | | | Extend the IMAP SEARCH command with the X-GM-RAW attribute for full Gmail search syntax. It is based on the Gmail extension (X-GM-EXT-1). The search/filter command will be interpreted in the same manner as in the Gmail web interface. Link: https://support.google.com/mail/answer/7190?hl=en Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* hooks: add logging for STDOUT and STDERRBence Ferdinandy2024-08-041-1/+10
| | | | | | | | | | Currently the only feedback we have from hooks is the error code. Log STDOUT on loglevel TRACE and log STDERR on loglevel ERROR if the command exists with an error. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* calendar: hide empty attendee listTimon Reinold2024-08-042-24/+30
| | | | | | | | | | | | | | Include the ATTENDEE and DETAILED LIST section in the calendar filter's output only if there are actually attendees to list. I was especially confused by the empty DETAILED LIST, as it wasn't clear which kind of detail it was supposed to list (and it also looked a bit like a heading for the description following immediately below), see e.g. the test output in filters/vectors/calendar-invite.expected. Fixes: 777bbb77e806 ("contrib: improve readability of meeting requests") Changelog-fixed: Builtin `calendar` filter shows empty attendee list. Signed-off-by: Timon Reinold <tirei+aerc@agon.one> Acked-by: Robin Jarry <robin@jarry.cc>
* filters: test calendar filter also with POSIX-AwkTimon Reinold2024-08-041-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The builtin "calendar" filter is written in the Awk language, for which multiple interpreters exist. The most common is probably GNU Awk (aka "gawk"), which also implements some features that other interpreters do not support. That means that the calendar filter could run fine in gawk, but fail in another interpreter (compare e.g. commit a604acceac0f "calendar: fix error with non-gnu awk"). Using the "-W posix" option, gawk can be put into a POSIX-compatibility mode, which attempts to stay as close as possible to the POSIX-specified version of Awk, which should then hopefully also be supported by other Awk interpreters. Running the filter's tests using "gawk -W posix" should help identify potential incompatibilities with other interpreters. Other interpreters also support "-W posix" (e.g. mawk, or ignore it like busybox awk). Using "awk -W posix" allows these to be used as well. If "-W posix" causes the interpreter to fail, skip this test. This new test in POSIX-compatibility mode runs in addition the existing test, which directly executes the filter, using the Awk interpreter's default mode ("-W posix" cannot just be added to the filter's shebang line, as only a single argument may be supported, and "-f" is also needed). The later is the mode most users will actually be using, so I don't want to remove that test. I'm not doing this for the other Awk-filters (hldiff and plaintext), as they have ben obsoleted by the colorize filter. Besides, they don't have any test vectors. Signed-off-by: Timon Reinold <tirei+aerc@agon.one> Acked-by: Robin Jarry <robin@jarry.cc>
* filters: add calendar test vectorTimon Reinold2024-08-044-3/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a test vector for the builtin "calendar" filter. Use the filter's current output as expected output. My aim is mostly just to run the calendar filter during "make tests", this vector doesn't necessarily cover the most interesting sections of its code. But at least running the filter once on what could be a common input (a meeting PUBLISH) and checking that its output matches what was expected should still be better than testing nothing. Previously, only compiled filters were tested. Testing the calendar filter (which is interpreted, not compiled) necessitated two changes: * Compilation output goes into the project root (filters/test.sh: "$here/../"), but the source code to interpret is in the filters/ subdirectory (filters/test.sh: "$here"/). The executable to invoke is thus in a different location. * .builds/alpine-edge.yml uses $FILTERS_TEST_PREFIX to wrap filters in valgrind, to check that filters written in e.g C don't leak memory. But for the calendar filter, that would check that the Awk interpreter doesn't leak memory, failing the test for at least gawk, mawk and busybox awk. Thus, a $FILTERS_TEST_BIN_PREFIX variable is introduced, which only applies to binary filters. Signed-off-by: Timon Reinold <tirei+aerc@agon.one> Acked-by: Robin Jarry <robin@jarry.cc>
* filters: print "error" if filter failedTimon Reinold2024-08-041-5/+4
| | | | | | | | | Print "error" instead of "ok" also if the filter (or the $FILTERS_TEST_PREFIX, i.e. valgrind) failed, not just if its output is unexpected. Also include that exist status in the error message. Signed-off-by: Timon Reinold <tirei+aerc@agon.one> Acked-by: Robin Jarry <robin@jarry.cc>
* reply: allow copying to current folderRobin Jarry2024-08-0313-21/+71
| | | | | | | | | Add a new copy-to-replied setting in accounts.conf to copy sent replies to the same folder than their replied message. Requested-by: Tristan Partin <tristan@partin.io> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tristan Partin <tristan@partin.io>
* jmap: fetch entire threadsTristan Partin2024-08-034-36/+141
| | | | | | | | | | Fetch an email's entire thread in the JMAP backend. Changelog-added: Fetch entire threads in the JMAP backend. Signed-off-by: Tristan Partin <tristan@partin.io> Tested-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: only send Done event if deletion succeedsHugo Osvaldo Barrera2024-08-031-1/+1
| | | | | | | | | | | | | | A Done event was sent from the worker to the UI unconditionally, so even if the deletion operation failed, the UI showed a "N messages deleted" confirmation. When no messages are deleted, don't send the done event. Given that the same function already sends an error in case of any failures, this error is what remains visible in the status bar. Signed-off-by: Hugo Osvaldo Barrera <hugo@whynothugo.nl> Acked-by: Robin Jarry <robin@jarry.cc>
* acct: indicate connection state in tab titleKoni Marti2024-08-031-0/+1
| | | | | | | | | | | | | | | | Indicate the connection state in the tab title. Example [ui].tab-title-account option in aerc.conf: tab-title-account= {{if .Connected}}{{.Account}}✓{{else}}{{.Account}}✗{{end}} Suggested-by: inwit <inwit@sindominio.net> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Gregory Anders <greg@gpanders.com> Tested-by: Inwit <inwit@sindominio.net> Reviewed-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: remove redundant queryHugo Osvaldo Barrera2024-08-031-9/+8
| | | | | | | | | | | | | | This function first queried the notmuch database for a single filename (arbitrarily chosen), and then queried the database for all filenames of the same message. Drop one unnecessary query; only query all names, and then use the first one as an arbitrarily chosen one. Signed-off-by: Hugo Osvaldo Barrera <hugo@whynothugo.nl> Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: speed up lastmod query.Robin Dapp2024-08-031-1/+1
| | | | | | | | | | | | | | When changing the tag/label of a message we refresh all messages that were modified since the start of the transaction. To that end we add "lastmod before..now" to the current query without any conjunction. That would make us re-index basically all messages. This patch wraps the existing query in parentheses and ANDs it with "lastmod" instead which greatly speeds up the process. Signed-off-by: Robin Dapp <rdapp@modk.org> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: improve logging for watcherHugo Osvaldo Barrera2024-08-031-1/+2
| | | | | | | | | | | | | When an error occurs initialising a watcher, the error shown is completely unclear (e.g.: "no such file or directory"). Clarify the error so that its source is clear and log the path that was used. Signed-off-by: Hugo Osvaldo Barrera <hugo@whynothugo.nl> Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: don't reload all message on changeHugo Osvaldo Barrera2024-08-032-41/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | When a notmuch query result was shown and any message changes (e.g.: was marked as read, deleted, flagged, etc) the entire result set was reloaded from disk. This included querying the notmuch for paths for each file individually and then reading headers from each file one by one. If the current view was a query-map with 4000 results, then marking a single message as read resulted in 4000 files being read from disk. When a change is detected in the database, instead of sending an individual MessageInfo event for each message in the result set, send a single DirectoryContents event. The UI code will remove from view any messages that no longer exist, add new ones and request from the worker any data that may be required (this data will be lazy-fetched). This results in a dramatic performance improvement when reading messages from a query-map result. Previously reading a single message would result in about 2 minutes of CPU at 150% (on a i7-13700K). With this patch, the same operation uses less than 5% CPU for less than 2 seconds. Signed-off-by: Hugo Osvaldo Barrera <hugo@whynothugo.nl> Acked-by: Robin Jarry <robin@jarry.cc>