From: Jaakko Heinonen Date: Mon, 3 Oct 2005 05:22:49 +0000 (+0000) Subject: - wanderlust export filter (Josef Schugt) X-Git-Tag: upstream/0.6.1~2^2~139 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=0cd708a881cb4c6f398381b43be3521a36ca8bd4;p=pkg%2Fabook.git - wanderlust export filter (Josef Schugt) --- diff --git a/ChangeLog b/ChangeLog index 8358240..8056f30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ - palmcsv import filter (Marc Tardif) - use better common code for csv filters (Marc Tardif) - translation HOWTO + - wanderlust export filter (Josef Schugt) 0.5.4 - add show_cursor config option (idea from Cheryl Homiak) diff --git a/abook.1 b/abook.1 index b9f156d..452f0a6 100644 --- a/abook.1 +++ b/abook.1 @@ -77,6 +77,8 @@ The following \fIoutputformats\fR are supported: - \fBtext\fP plain text .br - \fBspruce\fP Spruce address book +.br +- \fBwl\fP Wanderlust address book .TP \fB\-\-add-email\fP Read an e-mail message from stdin and add the sender to the addressbook. diff --git a/filter.c b/filter.c index 72ad6ce..5c0a23e 100644 --- a/filter.c +++ b/filter.c @@ -61,6 +61,7 @@ static int mutt_alias_export(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); +static int wl_export_database(FILE *out, struct db_enumerator e); /* * end of function declarations @@ -89,6 +90,7 @@ struct abook_output_filter e_filters[] = { { "palmcsv", N_("Palm comma separated values"), palm_export_database}, { "elm", N_("elm alias"), elm_alias_export }, { "text", N_("plain text"), text_export_database }, + { "wl", N_("Wanderlust address book"), wl_export_database }, { "spruce", N_("Spruce address book"), spruce_export_database }, { "\0", NULL, NULL } }; @@ -1814,3 +1816,35 @@ spruce_export_database (FILE *out, struct db_enumerator e) * end of Spruce export filter */ +/* + * wanderlust addressbook export filter + * + */ + +static int +wl_export_database(FILE *out, struct db_enumerator e) +{ + char emails[MAX_EMAILS][MAX_EMAIL_LEN]; + + fprintf (out, "# Wanderlust address book written by 'abook'\n\n"); + db_enumerate_items(e) { + split_emailstr(e.item, emails); + if (**emails) { + fprintf(out, + "%s\t\"%s\"\t\"%s\"\n", + *emails, + safe_str(database[e.item][NICK]), + safe_str(database[e.item][NAME]) + ); + } + } + + fprintf (out, "\n# End of address book file.\n"); + + return 0; +} + +/* + * end of wanderlust addressbook export filter + */ +