database: wrap query() to make accept a block
folders: list the folders with the messages/threads count