about summary refs log tree commit diff stats
path: root/worker/notmuch/lib
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2019-12-21 16:21:26 +0100
committerDrew DeVault <sir@cmpwn.com>2019-12-21 11:20:11 -0500
commit40ceee969bd29508c1da28052c95eb85a52650ba (patch)
tree0224774c182196a7352496c7f461136285de0471 /worker/notmuch/lib
parent2705d8460d7e974ee01ad41ce063ae3feeb30317 (diff)
downloadaerc-40ceee969bd29508c1da28052c95eb85a52650ba.tar.gz
notmuch: emit LabelList event
Diffstat (limited to 'worker/notmuch/lib')
-rw-r--r--worker/notmuch/lib/database.go17
1 files changed, 17 insertions, 0 deletions
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) {