From 40ceee969bd29508c1da28052c95eb85a52650ba Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sat, 21 Dec 2019 16:21:26 +0100 Subject: notmuch: emit LabelList event --- worker/notmuch/lib/database.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'worker/notmuch/lib/database.go') diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go index f4fd588..0706bbc 100644 --- a/worker/notmuch/lib/database.go +++ b/worker/notmuch/lib/database.go @@ -55,6 +55,23 @@ func (db *DB) connectRO() error { return nil } +// ListTags lists all known tags +func (db *DB) ListTags() ([]string, error) { + if db.ro == nil { + return nil, fmt.Errorf("not connected to the notmuch db") + } + tags, err := db.ro.Tags() + if err != nil { + return nil, err + } + var result []string + var tag *notmuch.Tag + for tags.Next(&tag) { + result = append(result, tag.Value) + } + return result, nil +} + //getQuery returns a query based on the provided query string. //It also configures the query as specified on the worker func (db *DB) newQuery(query string) (*notmuch.Query, error) { -- cgit v1.2.3