From: Jan Janak Date: Mon, 23 Nov 2009 00:10:54 +0000 (+0100) Subject: notmuch: New function to retrieve all tags from the database. X-Git-Tag: 0.1~331 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=c3c52e464b8b0e024a01feacfeb34cc4ce1f3d62;hp=c3c52e464b8b0e024a01feacfeb34cc4ce1f3d62 notmuch: New function to retrieve all tags from the database. This patch adds a new function called notmuch_database_get_all_tags which can be used to obtain a list of all tags from the database (in other words, the list contains all tags from all messages). The function produces an alphabetically sorted list. To add support for the new function, we rip the guts off of notmuch_message_get_tags and put them in a new generic function called _notmuch_convert_tags. The generic function takes a Xapian::TermIterator as argument and uses the iterator to find tags. This makes the function usable with different Xapian objects. Function notmuch_message_get_tags is then reimplemented to call the generic function with message->doc.termlist_begin() as argument. Similarly, we implement notmuch_message_database_get_all_tags, the function calls the generic function with db->xapian_db->allterms_begin() as argument. Finally, notmuch_database_get_all_tags is exported through lib/notmuch.h Signed-off-by: Jan Janak ---