aboutsummaryrefslogtreecommitdiffstats
path: root/worker/notmuch/lib
Commit message (Collapse)AuthorAgeFilesLines
* 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.