From 776ddff67439e876b48dc1dfd0545288b42b2498 Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson Date: Tue, 8 Jun 2004 02:39:00 +0000 Subject: Fixes #57795. 2004-06-07 Hans Petter Jansson Fixes #57795. * gui/component/addressbook-migrate.c (migrate_contacts): Change the "POSTAL" address in 1.4 to "OTHER" in 1.5. svn path=/trunk/; revision=26243 --- addressbook/gui/component/addressbook-migrate.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'addressbook/gui/component') diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c index ae50765225..859b71103f 100644 --- a/addressbook/gui/component/addressbook-migrate.c +++ b/addressbook/gui/component/addressbook-migrate.c @@ -300,6 +300,31 @@ migrate_contacts (MigrationContext *context, EBook *old_book, EBook *new_book) "VOICE"); attr = attr->next; } + /* Replace "POSTAL" (1.4) addresses with "OTHER" (1.5) */ + else if (!strcmp ("ADR", e_vcard_attribute_get_name (a))) { + GList *params, *param; + gboolean found = FALSE; + EVCardAttributeParam *p; + + params = e_vcard_attribute_get_params (a); + for (param = params; param; param = param->next) { + p = param->data; + if (!strcmp (EVC_TYPE, e_vcard_attribute_param_get_name (p))) { + GList *v = e_vcard_attribute_param_get_values (p); + if (v && v->data && !strcmp ("POSTAL", v->data)) { + found = TRUE; + break; + } + } + } + + if (found) { + e_vcard_attribute_param_remove_values (p); + e_vcard_attribute_param_add_value (p, "OTHER"); + } + + 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 -- cgit v1.2.3