aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-01-23 07:44:35 +0800
committerChris Toshok <toshok@src.gnome.org>2004-01-23 07:44:35 +0800
commit93e268731dad2c7529879ac99aef1e1ab216463d (patch)
treed3e8187bed29a4aec750ebc4e4b4a38e972caa67
parentc9b56375fe7b21673fd813d3e957b64fe6f9f7f0 (diff)
downloadgsoc2013-evolution-93e268731dad2c7529879ac99aef1e1ab216463d.tar.gz
gsoc2013-evolution-93e268731dad2c7529879ac99aef1e1ab216463d.tar.zst
gsoc2013-evolution-93e268731dad2c7529879ac99aef1e1ab216463d.zip
[ fixes bug #53184 ] handle the fact that the xml 1.4 spits out contains
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. svn path=/trunk/; revision=24374
-rw-r--r--addressbook/ChangeLog7
-rw-r--r--addressbook/gui/component/addressbook-migrate.c30
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 &gt;) 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;
}