+Notmuch 0.23 (UNRELEASED)
+=========================
+
+Ruby Bindings
+-------------
+
+Add support for `notmuch_database_get_all_tags`
+
Notmuch 0.22 (2016-04-26)
=========================
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
*
VALUE
notmuch_rb_database_find_message_by_filename (VALUE self, VALUE pathv);
+VALUE
+notmuch_rb_database_get_all_tags (VALUE self);
+
VALUE
notmuch_rb_database_query_create (VALUE self, VALUE qstrv);
notmuch_rb_database_find_message, 1); /* in database.c */
rb_define_method (notmuch_rb_cDatabase, "find_message_by_filename",
notmuch_rb_database_find_message_by_filename, 1); /* in database.c */
+ rb_define_method (notmuch_rb_cDatabase, "all_tags", notmuch_rb_database_get_all_tags, 0); /* in database.c */
rb_define_method (notmuch_rb_cDatabase, "query", notmuch_rb_database_query_create, 1); /* in database.c */
/*
notmuch count --output=threads tag:inbox > EXPECTED
test_expect_equal_file OUTPUT EXPECTED
+test_begin_subtest "get all tags"
+test_ruby <<"EOF"
+require 'notmuch'
+$maildir = ENV['MAIL_DIR']
+if not $maildir then
+ abort('environment variable MAIL_DIR must be set')
+end
+@db = Notmuch::Database.new($maildir)
+@t = @db.all_tags()
+for tag in @t do
+ print tag,"\n"
+end
+EOF
+notmuch search --output=tags '*' > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
test_done