aboutsummaryrefslogtreecommitdiffstats
path: root/worker/notmuch/lib
Commit message (Collapse)AuthorAgeFilesLines
* fold: allow for multiple folding levelsinwit2023-11-021-1/+5
| | | | | | | Extend the :fold/:unfold behaviour to allow for multiple folding levels. Signed-Off-By: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: return all siblings in threadsinwit2023-10-131-24/+10
| | | | | | | | | | | | | | | | | Notmuch threads can silently drop sibling messages during threading when a thread has multiple "top level messages" (IE a thread where the root is missing). Modify makeThread to return a slice of all encountered siblings and add these as individual threads. Note that the current implementation does not link these threads together with a dummy parent node. This should be done in the future when rendering of these types of threads is implemented Fixes: https://todo.sr.ht/~rjarry/aerc/188 Reported-by: inwit <inwit@sindominio.net> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: enable showing of thread-contextTim Culverhouse2023-09-271-7/+12
| | | | | | | | | | | | | | | Add a UI config value to enable showing of "thread-context", similar to `notmuch show --entire-thread=true`. Add an associated style called "msglist_thread_context" which can be used to style such messages. Currently this feature is only supported by notmuch. It would be possible for maildir to implement as well, IMAP with gmail custom extensions, and JMAP. This patch merely implements the notmuch version and puts the groundwork in for handling these sorts of displays. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: internally sort threads newest firstTim Culverhouse2023-08-311-1/+11
| | | | | | | | | For proper thread ordering, notmuch needs to use a SORT_NEWEST_FIRST sort order in it's query, and then we reverse the thread order. Also give a maximum guess for size of slice we'll be returning. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: track database stateTim Culverhouse2023-08-311-0/+7
| | | | | | | | | Track the notmuch database state. When a state change is detected, query if any changes affect the current query then send updates accordingly. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: remove unused codeTim Culverhouse2023-08-301-15/+0
| | | | | | | The thread.go file hasn't been used for a long time. Remove it. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: replace notmuch library with internal bindingsTim Culverhouse2023-08-301-306/+196
| | | | | | | Replace the notmuch library used with our internal bindings. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: implement cancellation of requestsTim Culverhouse2023-06-201-10/+21
| | | | | | | | | Implement cancellation of cancellable requests. These include listing of directory contents, searching, and sorting. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: use fswatcher to trigger directory count updateTim Culverhouse2023-03-071-0/+5
| | | | | | | | | | | Use fswatcher to watch the underlying notmuch db to trigger directory updates. Remove unused argument in the handleUpdateDirCounts function. Call this function when listing directories to initialize counts when starting aerc. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Ben Lee-Cohen <ben@lee-cohen.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: rename package to logRobin Jarry2022-12-021-8/+8
| | | | | | | | | | Use the same name than the builtin "log" package. That way, we do not risk logging in the wrong place. Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: add MsgIDFromFilename method to notmuch.DBJulian Pidancet2022-10-271-0/+16
| | | | | | | | | Add a method to retrieve the message key associated with a message file path, if indexed in the database. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: fix bad copy-paste in MsgModifyTags loggingJulian Pidancet2022-10-271-1/+1
| | | | | | | | | | Print "failed to remove tag" instead of "failed to add tag" when removing tag failed. Fixes: 5ca6022d007b ("lint: ensure errors are at least logged (errcheck)") Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: add IndexFile and DeleteMessage methods to notmuch.DBJulian Pidancet2022-10-271-0/+29
| | | | | | | | | The new IndexFile and DeleteMessage allow dynamically inserting and removing files to/from a notmuch database. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: add MsgFilenames method to notmuch.DBJulian Pidancet2022-10-271-0/+25
| | | | | | | | | | Multiple files on the filesystem can be referenced under a single key in the notmuch database. MsgFilenames() returns a list of filenames associated with an index key. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: fix regression in error handlingJose Lombera2022-09-011-1/+1
| | | | | | | | | | | | | Fix reggression introduced by 70bfcfef4257 ("lint: work nicely with wrapped errors (errorlint)"). Discovered this because it broke my arec-notmuch config where I have `exclude-tags=deleted`. Queries with `tag:deleted` would now fail with error message saying "Argument was ignored". Fixes: 70bfcfef4257 ("lint: work nicely with wrapped errors (errorlint)") Signed-off-by: Jose Lombera <jose@lombera.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: work nicely with wrapped errors (errorlint)Moritz Poldrack2022-08-041-2/+3
| | | | | | | | Error wrapping as introduced in Go 1.13 adds some additional logic to use for comparing errors and adding information to it. Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: homogenize operations and minor fixes (gocritic)Moritz Poldrack2022-08-041-3/+4
| | | | | | | | | | | | | | | | | | Apply GoDoc comment policy (comments for humans should have a space after the //; machine-readable comments shouldn't) Use strings.ReplaceAll instead of strings.Replace when appropriate Remove if/else chains by replacing them with switches Use short assignment/increment notation Replace single case switches with if statements Combine else and if when appropriate Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: ensure errors are at least logged (errcheck)Moritz Poldrack2022-08-041-3/+13
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: apply new formatting rulesMoritz Poldrack2022-08-011-8/+11
| | | | | | | Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: use level-based logger functionsRobin Jarry2022-07-231-9/+6
| | | | | | | | | | | | Do not pass logger objects around anymore. Shuffle some messages to make them consistent with the new logging API. Avoid using %v when a more specific verb exists for the argument types. The loggers are completely disabled (i.e. Sprintf is not even called) by default. They are only enabled when redirecting stdout to a file. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* notmuch: fix server-side threadsTim Culverhouse2022-07-021-3/+15
| | | | | | | | | | | | | | | Notmuch server-side threading added messages within a thread that didn't match the query into the uidstore. By doing so, several UI issues presented: * All "hidden" messages displayed at the bottom of the msglist * Selected messages wouldn't open properly This patch stops these messages from being put into the message store, thereby resolving the UI issues Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com>
* format: reformat code with go 1.17Robin Jarry2021-12-112-2/+4
| | | | | | | | There was a change in how build tags are formatted. Use this as new reference. Link: https://go.dev/doc/go1.17#gofmt Signed-off-by: Robin Jarry <robin@jarry.cc>
* messages: allow displaying email threadsy0ast2021-11-132-8/+127
| | | | | | | | | | | | | Display threads in the message list. For now, only supported by the notmuch backend and on IMAP when the server supports the THREAD extension. Setting threading-enable=true is global and will cause the message list to be empty with maildir:// accounts. Co-authored-by: Kevin Kuehler <keur@xcf.berkeley.edu> Co-authored-by: Reto Brunner <reto@labrat.space> Signed-off-by: Robin Jarry <robin@jarry.cc>
* notmuch: remove gc close hooksReto Brunner2020-12-021-0/+1
| | | | | | | We frequently had issues with notmuch segfaulting and my guess is that this was due to the garbage collection magic used in the module. This changes to a fork that ripped the functionality out.
* notmuch: close tag objectReto Brunner2020-09-241-0/+1
|
* notmuch: manually close notmuch objectsReto Brunner2020-08-071-0/+3
| | | | | There seems to be some race with the automatic closing that should happen in theory... close it manually where we can to avoid the issue
* notmuch: avoid stale DBsReto Brunner2020-02-161-99/+133
| | | | | | | | | | | | | | Opening a notmuch DB gives you a snapshot of the stage at that specific time. Prior to this, we only reopened the DB upon writing. However, if say a mail sync program like offlineimap is fetching new mail, we would never pick it up. This commit caches a db for a while, so that we don't generate too much overhead and does a reconnect cycle after that. I hardcoded a value as I don't think that having an option would be beneficial. Any write operation (meaning reading mail) anyhow flushes the DB by necessity. (we need to close to commit tag changes, which changing the read state is)
* notmuch: emit LabelList eventReto Brunner2019-12-211-0/+17
|
* notmuch: sync maildir flagsReto Brunner2019-09-161-1/+4
| | | | Syncs back special notmuch tag like unread to the underlying maildir store
* notmuch: extract all notmuch db operations.Reto Brunner2019-09-161-0/+179
For some reason the current code frequently segfaults due to an invalid C memory address. This commit mediates that by never keeping an object alive longer than absolutely necessary.