X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fruby%2Fdatabase.c;h=6deda5751df0d1c69fb264f17a4f04243f7dab7d;hb=7e6e23c36e290d4b22b0449766a6ef2107f1ef6c;hp=c03d7011f8406931045183a02eeb0d1395eb0107;hpb=f5db7ad7d243785c274a99734c681e69d13313d0;p=notmuch diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index c03d7011..6deda575 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -374,6 +374,30 @@ notmuch_rb_database_find_message_by_filename (VALUE self, VALUE pathv) return Qnil; } +/* + * call-seq: DB.get_all_tags() => TAGS + * + * Returns a list of all tags found in the database. + */ +VALUE +notmuch_rb_database_get_all_tags (VALUE self) +{ + notmuch_database_t *db; + notmuch_tags_t *tags; + + Data_Get_Notmuch_Database (self, db); + + tags = notmuch_database_get_all_tags (db); + if (!tags) { + const char *msg = notmuch_database_status_string (db); + if (!msg) + msg = "Unknown notmuch error"; + + rb_raise (notmuch_rb_eBaseError, "%s", msg); + } + return Data_Wrap_Struct (notmuch_rb_cTags, NULL, NULL, tags); +} + /* * call-seq: DB.query(query) => QUERY *