diff options
author | Not Zed <NotZed@Ximian.com> | 2004-06-14 16:31:19 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-06-14 16:31:19 +0800 |
commit | 2c166904b9f5bd317fb832e841872322d004ef59 (patch) | |
tree | 60effa09873aacd793c0c897e6ad6adf6cc05cde /addressbook/importers | |
parent | 87ae2d3b9c329297dbe8cc06583d4ce7deb7aec1 (diff) | |
download | gsoc2013-evolution-2c166904b9f5bd317fb832e841872322d004ef59.tar.gz gsoc2013-evolution-2c166904b9f5bd317fb832e841872322d004ef59.tar.zst gsoc2013-evolution-2c166904b9f5bd317fb832e841872322d004ef59.zip |
handle LIST field types. (ldif_fields[]): Add a list type. E_CONTACT_EMAIL
2004-06-14 Not Zed <NotZed@Ximian.com>
* 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
Diffstat (limited to 'addressbook/importers')
-rw-r--r-- | addressbook/importers/evolution-ldif-importer.c | 13 |
1 files changed, 12 insertions, 1 deletions
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); |