aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-05-25 01:35:49 +0800
committerChris Toshok <toshok@src.gnome.org>2004-05-25 01:35:49 +0800
commit34f977f6dc01f2af3cadbbcecbdf4212eee2f392 (patch)
tree263a3f9377c6f1872db458569d10cceedcfd012d /addressbook
parent321e9a1cf7473808eef43771c7052c84664fa81d (diff)
downloadgsoc2013-evolution-34f977f6dc01f2af3cadbbcecbdf4212eee2f392.tar.gz
gsoc2013-evolution-34f977f6dc01f2af3cadbbcecbdf4212eee2f392.tar.zst
gsoc2013-evolution-34f977f6dc01f2af3cadbbcecbdf4212eee2f392.zip
[ fixes bug #40013 ]
2004-05-24 Chris Toshok <toshok@ximian.com> [ fixes bug #40013 ] * importers/evolution-vcard-importer.c (process_item_fn): for TEL attribute that don't specify a location (HOME/WORK/OTHER), default to "OTHER". For TEL attributes that *only* specify a location, default to "VOICE". svn path=/trunk/; revision=26063
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog9
-rw-r--r--addressbook/importers/evolution-vcard-importer.c51
2 files changed, 60 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 1370a919c0..92939906aa 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,12 @@
+2004-05-24 Chris Toshok <toshok@ximian.com>
+
+ [ fixes bug #40013 ]
+
+ * importers/evolution-vcard-importer.c (process_item_fn): for TEL
+ attribute that don't specify a location (HOME/WORK/OTHER), default
+ to "OTHER". For TEL attributes that *only* specify a location,
+ default to "VOICE".
+
2004-05-21 H P Nadig <hpnadig@pacific.net.in>
Fixes #58516.
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index eedacef874..950eac9b7f 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -149,6 +149,57 @@ process_item_fn (EvolutionImporter *importer,
}
e_contact_set_attributes (contact, E_CONTACT_EMAIL, attrs);
+ /*
+ Deal with TEL attributes that don't conform to what we need.
+
+ 1. if there's no location (HOME/WORK/OTHER), default to OTHER.
+ 2. if there's *only* a location specified, default to VOICE.
+ */
+ attrs = e_vcard_get_attributes (E_VCARD (contact));
+ for (attr = attrs; attr; attr = attr->next) {
+ EVCardAttribute *a = attr->data;
+ gboolean location_only = TRUE;
+ gboolean no_location = TRUE;
+ GList *params, *param;
+
+ if (g_ascii_strcasecmp (e_vcard_attribute_get_name (a),
+ EVC_TEL))
+ continue;
+
+ params = e_vcard_attribute_get_params (a);
+ for (param = params; param; param = param->next) {
+ EVCardAttributeParam *p = param->data;
+ GList *vs, *v;
+
+ if (g_ascii_strcasecmp (e_vcard_attribute_param_get_name (p),
+ EVC_TYPE))
+ continue;
+
+ vs = e_vcard_attribute_param_get_values (p);
+ for (v = vs; v; v = v->next) {
+ if (!g_ascii_strcasecmp ((char*)v->data, "WORK") ||
+ !g_ascii_strcasecmp ((char*)v->data, "HOME") ||
+ !g_ascii_strcasecmp ((char*)v->data, "OTHER"))
+ no_location = FALSE;
+ else
+ location_only = FALSE;
+ }
+ }
+
+ if (location_only) {
+ /* add VOICE */
+ e_vcard_attribute_add_param_with_value (a,
+ e_vcard_attribute_param_new (EVC_TYPE),
+ "VOICE");
+ }
+ if (no_location) {
+ /* add OTHER */
+ e_vcard_attribute_add_param_with_value (a,
+ e_vcard_attribute_param_new (EVC_TYPE),
+ "OTHER");
+ }
+ }
+
/* Work around the fact that these fields no longer show up in the UI */
add_to_notes (contact, E_CONTACT_OFFICE);
add_to_notes (contact, E_CONTACT_SPOUSE);