From: Raphaƫl Droz Date: Tue, 30 Aug 2011 13:31:31 +0000 (+0200) Subject: mutt-query (2/3): moved mutt full database querying to mutt_query_export_database... X-Git-Tag: upstream/0.6.1~2^2~54 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=e9103e7aaac10a5210345e2478240baaae6df899;p=pkg%2Fabook.git mutt-query (2/3): moved mutt full database querying to mutt_query_export_database() inside filter.c --- diff --git a/abook.c b/abook.c index 866d71d..4ef136c 100644 --- a/abook.c +++ b/abook.c @@ -452,10 +452,7 @@ mutt_query(char *str) init_mutt_query(); if( str == NULL || !strcasecmp(str, "all") ) { - struct db_enumerator e = init_db_enumerator(ENUM_ALL); - printf("All items\n"); - db_enumerate_items(e) - muttq_print_item(stdout, e.item); + export_file("muttq", "-"); } else { int search_fields[] = {NAME, EMAIL, NICK, -1}; int i; diff --git a/filter.c b/filter.c index ff4d116..96fa9c2 100644 --- a/filter.c +++ b/filter.c @@ -60,6 +60,7 @@ static int allcsv_export_database(FILE *out, struct db_enumerator e); static int palm_export_database(FILE *out, struct db_enumerator e); static int vcard_export_database(FILE *out, struct db_enumerator e); static int mutt_alias_export(FILE *out, struct db_enumerator e); +static int mutt_query_export_database(FILE *out, struct db_enumerator e); static int elm_alias_export(FILE *out, struct db_enumerator e); static int text_export_database(FILE *out, struct db_enumerator e); static int spruce_export_database(FILE *out, struct db_enumerator e); @@ -87,6 +88,7 @@ struct abook_output_filter e_filters[] = { { "ldif", N_("ldif / Netscape addressbook (.4ld)"), ldif_export_database }, { "vcard", N_("vCard 2 file"), vcard_export_database }, { "mutt", N_("mutt alias"), mutt_alias_export }, + { "muttq", N_("mutt query format (internal use)"), mutt_query_export_database }, { "html", N_("html document"), html_export_database }, { "pine", N_("pine addressbook"), pine_export_database }, { "csv", N_("comma separated values"), csv_export_database }, @@ -2056,6 +2058,15 @@ void muttq_print_item(FILE *file, int item) abook_list_free(&emails); } +static int +mutt_query_export_database(FILE *out, struct db_enumerator e) +{ + fprintf(out, "All items\n"); + db_enumerate_items(e) + muttq_print_item(out, e.item); + return 0; +} + /* * end of mutt alias export filter */