From: Cedric Duval Date: Wed, 6 Sep 2006 02:46:44 +0000 (+0000) Subject: Applied patch from Guillem Jover to add support for bsd calendar export. X-Git-Tag: upstream/0.6.1~2^2~86 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=6a182e3e9a932830341308eb5fb58eb92f5c3682;p=pkg%2Fabook.git Applied patch from Guillem Jover to add support for bsd calendar export. (Debian bug #386217) --- diff --git a/abook.1 b/abook.1 index 452f0a6..bb7ed4e 100644 --- a/abook.1 +++ b/abook.1 @@ -1,4 +1,4 @@ -.TH ABOOK 1 "June 6, 2003" +.TH ABOOK 1 2006-09-06 .nh .SH NAME abook \- text-based address book program @@ -79,6 +79,8 @@ The following \fIoutputformats\fR are supported: - \fBspruce\fP Spruce address book .br - \fBwl\fP Wanderlust address book +.br +- \fBbsdcal\fP BSD calendar .TP \fB\-\-add-email\fP Read an e-mail message from stdin and add the sender to the addressbook. diff --git a/edit.c b/edit.c index 5605a0f..28d5087 100644 --- a/edit.c +++ b/edit.c @@ -33,8 +33,6 @@ extern int views_count; WINDOW *editw; -static int parse_date_string(char *s, int *day, int *month, int *year); - static void editor_tab(const int tab) @@ -421,7 +419,7 @@ static int is_valid_date(const int day, const int month, const int year) return valid; } -static int +int parse_date_string(char *s, int *day, int *month, int *year) { int i = 0; diff --git a/edit.h b/edit.h index aa52141..8f1ada5 100644 --- a/edit.h +++ b/edit.h @@ -4,6 +4,7 @@ void edit_item(int item); void get_first_email(char *str, int item); void add_item(); +int parse_date_string(char *s, int *day, int *month, int *year); #define EDITW_COLS (COLS - 6) #define EDITW_LINES (LINES - 5) diff --git a/filter.c b/filter.c index 70ec2d4..04b9a3b 100644 --- a/filter.c +++ b/filter.c @@ -61,6 +61,7 @@ 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); +static int bsdcal_export_database(FILE *out, struct db_enumerator e); /* * end of function declarations @@ -91,6 +92,7 @@ struct abook_output_filter e_filters[] = { { "text", N_("plain text"), text_export_database }, { "wl", N_("Wanderlust address book"), wl_export_database }, { "spruce", N_("Spruce address book"), spruce_export_database }, + { "bsdcal", N_("BSD calendar"), bsdcal_export_database }, { "\0", NULL, NULL } }; @@ -1876,3 +1878,33 @@ wl_export_database(FILE *out, struct db_enumerator e) * end of wanderlust addressbook export filter */ +/* + * BSD calendar export filter + */ + +static int +bsdcal_export_database(FILE *out, struct db_enumerator e) +{ + db_enumerate_items(e) { + int year, month = 0, day = 0; + char *anniversary = db_fget(e.item, ANNIVERSARY); + + if(anniversary) { + parse_date_string(anniversary, &day, &month, &year); + + fprintf(out, + _("%02d/%02d\tAnniversary of %s\n"), + month, + day, + safe_str(db_name_get(e.item)) + ); + } + } + + return 0; +} + +/* + * end of BSD calendar export filter + */ +