aboutsummaryrefslogtreecommitdiffstats
path: root/worker/notmuch/lib/database.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker/notmuch/lib/database.go')
-rw-r--r--worker/notmuch/lib/database.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go
index 1add2770..880ec3f7 100644
--- a/worker/notmuch/lib/database.go
+++ b/worker/notmuch/lib/database.go
@@ -225,6 +225,31 @@ func (db *DB) MsgTags(key string) ([]string, error) {
return tags, err
}
+func (db *DB) MsgFilenames(key string) ([]string, error) {
+ var filenames []string
+
+ err := db.withConnection(false, func(ndb *notmuch.DB) error {
+ msg, err := ndb.FindMessage(key)
+ if err != nil {
+ return err
+ }
+ defer msg.Close()
+
+ fns := msg.Filenames()
+ var filename string
+ for fns.Next(&filename) {
+ if err != nil && !errors.Is(err, notmuch.ErrDuplicateMessageID) {
+ return err
+ }
+ filenames = append(filenames, filename)
+ }
+
+ return nil
+ })
+
+ return filenames, err
+}
+
func (db *DB) msgModify(key string,
cb func(*notmuch.Message) error,
) error {