From: Jaakko Heinonen Date: Fri, 12 Oct 2001 09:31:44 +0000 (+0000) Subject: added second address field X-Git-Tag: upstream/0.6.1~2^2~328 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=14afac6aa99dbefeedc6bbc793faf9ba1de2eca7;p=pkg%2Fabook.git added second address field --- diff --git a/database.c b/database.c index 973c0a5..e9d939e 100644 --- a/database.c +++ b/database.c @@ -58,6 +58,7 @@ struct abook_field abook_fields[ITEM_FIELDS] = { {"Name", "name", TAB_CONTACT},/* NAME */ {"E-mails", "email", TAB_CONTACT},/* EMAIL */ {"Address", "address", TAB_ADDRESS},/* ADDRESS */ + {"Address2", "address2", TAB_ADDRESS},/* ADDRESS2 */ {"City", "city", TAB_ADDRESS},/* CITY */ {"State/Province","state", TAB_ADDRESS},/* STATE */ {"ZIP/Postal Code","zip", TAB_ADDRESS},/* ZIP */ diff --git a/database.h b/database.h index 4354c93..142d1b0 100644 --- a/database.h +++ b/database.h @@ -11,6 +11,7 @@ enum { NAME, EMAIL, ADDRESS, + ADDRESS2, CITY, STATE, ZIP, @@ -21,7 +22,7 @@ enum { MOBILEPHONE, NICK, URL, - NOTES + NOTES, }; #define LAST_FIELD NOTES diff --git a/filter.c b/filter.c index f96d3fd..e143ae4 100644 --- a/filter.c +++ b/filter.c @@ -415,7 +415,7 @@ export(char filtname[FILTNAME_LEN], char *filename) static void ldif_fix_string(char *str); -#define LDIF_ITEM_FIELDS 15 +#define LDIF_ITEM_FIELDS 16 typedef char* ldif_item[LDIF_ITEM_FIELDS]; @@ -423,6 +423,7 @@ static ldif_item ldif_field_names = { "cn", "mail", "streetaddress", + "streetaddress2", "locality", "st", "postalcode", @@ -441,6 +442,7 @@ static int ldif_conv_table[LDIF_ITEM_FIELDS] = { NAME, /* "cn" */ EMAIL, /* "mail" */ ADDRESS, /* "streetaddress" */ + ADDRESS2, /* "streetaddress2" */ CITY, /* "locality" */ STATE, /* "st" */ ZIP, /* "postalcode" */ @@ -1222,8 +1224,9 @@ gcrd_export_database(FILE *out, struct db_enumerator e) free(name); if ( database[e.item][ADDRESS] ) - fprintf(out, "ADR:;;%s;%s;%s;%s;%s\n", + fprintf(out, "ADR:;;%s;%s;%s;%s;%s;%s\n", safe_str(database[e.item][ADDRESS]), + safe_str(database[e.item][ADDRESS2]), safe_str(database[e.item][CITY]), safe_str(database[e.item][STATE]), safe_str(database[e.item][ZIP]), @@ -1320,7 +1323,10 @@ mutt_alias_export(FILE *out, struct db_enumerator e) static void text_write_address_us(FILE *out, int i) { fprintf(out, "\n%s", database[i][ADDRESS]); - + + if (database[i][ADDRESS2]) + fprintf(out, "\n%s", database[i][ADDRESS2]); + if (database[i][CITY]) fprintf(out, "\n%s", database[i][CITY]); @@ -1354,7 +1360,10 @@ text_write_address_uk(FILE *out, int i) { static void text_write_address_eu(FILE *out, int i) { fprintf(out, "\n%s", database[i][ADDRESS]); - + + if (database[i][ADDRESS2]) + fprintf(out, "\n%s", database[i][ADDRESS2]); + if (database[i][ZIP] || database[i][CITY]) { fputc('\n', out);