]> git.deb.at Git - pkg/abook.git/commitdiff
vcard export: ADR field's components now respect the order
authorSébastien Guillet <seguillet@laposte.net>
Sun, 13 Jan 2013 11:49:10 +0000 (12:49 +0100)
committerRaphaël Droz <raphael.droz+floss@gmail.com>
Sun, 13 Jan 2013 11:49:10 +0000 (12:49 +0100)
 defined by the rfc6350 section-6.3.1.

filter.c

index a22a0c766ad7c26853b9aae48d9cdd9b11722685..4d1abd893f018cdacc9e6e2e8c41852eb76889a1 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -2027,15 +2027,18 @@ vcard_export_item(FILE *out, int item)
 
        free(name);
 
-       if(db_fget(item, ADDRESS))
-         fprintf(out, "ADR:;;%s;%s;%s;%s;%s;%s\r\n",
-                 safe_str(db_fget(item, ADDRESS)),
-                 safe_str(db_fget(item, ADDRESS2)),
-                 safe_str(db_fget(item, CITY)),
-                 safe_str(db_fget(item, STATE)),
-                 safe_str(db_fget(item, ZIP)),
-                 safe_str(db_fget(item, COUNTRY))
-                 );
+       // see rfc6350 section 6.3.1
+       if(db_fget(item, ADDRESS)) {
+               fprintf(out, "ADR:;%s;%s;%s;%s;%s;%s\r\n",
+                       // pobox (unsupported)
+                       safe_str(db_fget(item, ADDRESS2)), // ext (n°, ...)
+                       safe_str(db_fget(item, ADDRESS)), // street
+                       safe_str(db_fget(item, CITY)), // locality
+                       safe_str(db_fget(item, STATE)), // region
+                       safe_str(db_fget(item, ZIP)), // code (postal)
+                       safe_str(db_fget(item, COUNTRY)) // country
+                       );
+       }
 
        if(db_fget(item, PHONE))
          fprintf(out, "TEL;HOME:%s\r\n",