From 2c166904b9f5bd317fb832e841872322d004ef59 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 14 Jun 2004 08:31:19 +0000 Subject: handle LIST field types. (ldif_fields[]): Add a list type. E_CONTACT_EMAIL 2004-06-14 Not Zed * importers/evolution-ldif-importer.c (parseLine): handle LIST field types. (ldif_fields[]): Add a list type. E_CONTACT_EMAIL is a list field type. See #58855. svn path=/trunk/; revision=26333 --- addressbook/importers/evolution-ldif-importer.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'addressbook/importers') diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c index eb6fb63825..31bf39e7f6 100644 --- a/addressbook/importers/evolution-ldif-importer.c +++ b/addressbook/importers/evolution-ldif-importer.c @@ -52,11 +52,12 @@ static struct { char *ldif_attribute; EContactField contact_field; #define FLAG_ADDRESS 0x01 +#define FLAG_LIST 0x02 int flags; } ldif_fields[] = { { "cn", E_CONTACT_FULL_NAME }, - { "mail", E_CONTACT_EMAIL }, + { "mail", E_CONTACT_EMAIL, FLAG_LIST }, #if 0 { "givenname", E_CONTACT_GIVEN_NAME }, #endif @@ -260,6 +261,16 @@ parseLine (EContact *contact, EContactAddress *address, char **buf) else if (!g_ascii_strcasecmp (ptr, "streetaddress")) address->street = g_strdup (ldif_value->str); } + else if (ldif_fields[i].flags & FLAG_LIST) { + GList *list; + + list = e_contact_get (contact, ldif_fields[i].contact_field); + list = g_list_append (list, g_strdup (ldif_value->str)); + e_contact_set (contact, ldif_fields[i].contact_field, list); + + g_list_foreach (list, (GFunc) g_free, NULL); + g_list_free (list); + } else { /* FIXME is everything a string? */ e_contact_set (contact, ldif_fields[i].contact_field, ldif_value->str); -- cgit v1.2.3