]> git.deb.at Git - pkg/abook.git/commitdiff
added second address field
authorJaakko Heinonen <jheinonen@users.sourceforge.net>
Fri, 12 Oct 2001 09:31:44 +0000 (09:31 +0000)
committerJaakko Heinonen <jheinonen@users.sourceforge.net>
Fri, 12 Oct 2001 09:31:44 +0000 (09:31 +0000)
database.c
database.h
filter.c

index 973c0a5a0c3928c17b45e900aaf731ef5b2baf05..e9d939e57d1de7b46babb2d97c0ce045eea659f6 100644 (file)
@@ -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 */
index 4354c93f82b4004ef0b9cad03b41653cc024d5d5..142d1b01eb7be0666a0e76f6cc437311ee77621e 100644 (file)
@@ -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
index f96d3fdb48015089c9d61fc4ef1e4e68bc4e39fe..e143ae4b0fabc8f864b7b83b1b8f85339f04a6ca 100644 (file)
--- 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);