diff options
-rw-r--r-- | addressbook/ChangeLog | 7 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-migrate.c | 30 |
2 files changed, 37 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index ffd2fab031..e656ad2861 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,12 @@ 2004-01-22 Chris Toshok <toshok@ximian.com> + [ fixes bug #53184 ] + * gui/component/addressbook-migrate.c (migrate_contacts): handle + the fact that the xml 1.4 spits out contains unescaped ';'s in the + EMAIL attributes for mailing lists. + +2004-01-22 Chris Toshok <toshok@ximian.com> + [ fixes bug #52944 ] * gui/component/addressbook-migrate.c (migrate_contacts): do some massaging of contacts as we import them, to fix up the differences diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c index 60b87d4dd6..1514e72434 100644 --- a/addressbook/gui/component/addressbook-migrate.c +++ b/addressbook/gui/component/addressbook-migrate.c @@ -283,6 +283,36 @@ migrate_contacts (EBook *old_book, EBook *new_book) "VOICE"); attr = attr->next; } + /* this is kinda gross. The new vcard parser + needs ';'s to be escaped by \'s. but the + 1.4 vcard generator would put unescaped xml + (including entities like >) in the value + of attributes, so we need to go through and + escape those ';'s. */ + else if (!strcmp ("EMAIL", e_vcard_attribute_get_name (a))) { + GList *v = e_vcard_attribute_get_values (a); + + if (v && v->data) { + if (!strncmp ((char*)v->data, "<?xml", 5)) { + /* k, this is the nasty part. we glomb all the + value strings back together again (if there is + more than one), then work our magic */ + GString *str = g_string_new (""); + while (v) { + g_string_append (str, v->data); + if (v->next) + g_string_append_c (str, ';'); + v = v->next; + } + + e_vcard_attribute_remove_values (a); + e_vcard_attribute_add_value (a, str->str); + g_string_free (str, TRUE); + } + } + + attr = attr->next; + } else { attr = attr->next; } |