aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/importers
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/importers')
-rw-r--r--addressbook/importers/evolution-ldif-importer.c27
-rw-r--r--addressbook/importers/evolution-vcard-importer.c22
2 files changed, 35 insertions, 14 deletions
diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c
index 77babb95a5..c7a883dc4e 100644
--- a/addressbook/importers/evolution-ldif-importer.c
+++ b/addressbook/importers/evolution-ldif-importer.c
@@ -32,7 +32,7 @@
#include <importer/evolution-importer.h>
#include <importer/GNOME_Evolution_Importer.h>
#include <widgets/misc/e-source-selector.h>
-#include <util/eab-destination.h>
+#include <util/e-destination.h>
#define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Addressbook_LDIF_ImporterFactory"
#define COMPONENT_IID "OAFIID:GNOME_Evolution_Addressbook_LDIF_Importer"
@@ -353,7 +353,8 @@ getNextLDIFEntry( FILE *f )
static void
resolve_list_card (LDIFImporter *gci, EContact *contact)
{
- GList *email, *l, *new_email = NULL;
+ GList *email, *l;
+ GList *email_attrs = NULL;
char *full_name;
/* set file_as to full_name so we don't later try and figure
@@ -372,26 +373,26 @@ resolve_list_card (LDIFImporter *gci, EContact *contact)
/* break list chains here, since we don't support them just yet */
if (dn_contact && !e_contact_get (dn_contact, E_CONTACT_IS_LIST)) {
- EABDestination *dest;
- gchar *dest_xml;
+ EDestination *dest;
+ EVCardAttribute *attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
/* Hard-wired for default e-mail, since netscape only exports 1 email address */
- dest = eab_destination_new ();
- eab_destination_set_contact (dest, dn_contact, 0);
- dest_xml = eab_destination_export (dest);
+ dest = e_destination_new ();
+ e_destination_set_contact (dest, dn_contact, 0);
+
+ e_destination_export_to_vcard_attribute (dest, attr);
+
g_object_unref (dest);
- if (dest_xml) {
- new_email = g_list_append (new_email, dest_xml);
- }
+ email_attrs = g_list_append (email_attrs, attr);
}
}
- e_contact_set (contact, E_CONTACT_EMAIL, new_email);
+ e_contact_set_attributes (contact, E_CONTACT_EMAIL, email_attrs);
g_list_foreach (email, (GFunc) g_free, NULL);
g_list_free (email);
- g_list_foreach (new_email, (GFunc) g_free, NULL);
- g_list_free (new_email);
+ g_list_foreach (email_attrs, (GFunc) e_vcard_attribute_free, NULL);
+ g_list_free (email_attrs);
}
static GList *
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index 83bec58892..f457cefafc 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -40,13 +40,13 @@
#include <bonobo/bonobo-shlib-factory.h>
#include <bonobo/bonobo-control.h>
-
#include <libebook/e-book.h>
#include <importer/evolution-importer.h>
#include <importer/GNOME_Evolution_Importer.h>
#include <widgets/misc/e-source-selector.h>
#include <util/eab-book-util.h>
+#include <util/e-destination.h>
#define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_ImporterFactory"
#define COMPONENT_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_Importer"
@@ -70,6 +70,7 @@ process_item_fn (EvolutionImporter *importer,
VCardImporter *gci = (VCardImporter *) closure;
EContact *contact;
EContactPhoto *photo;
+ GList *attrs, *attr;
if (gci->iterator == NULL)
gci->iterator = gci->contactlist;
@@ -105,6 +106,25 @@ process_item_fn (EvolutionImporter *importer,
e_contact_photo_free (photo);
}
+ /* Deal with our XML EDestination stuff in EMAIL attributes, if there is any. */
+ attrs = e_contact_get_attributes (contact, E_CONTACT_EMAIL);
+ for (attr = attrs; attr; attr = attr->next) {
+ EVCardAttribute *a = attr->data;
+ GList *v = e_vcard_attribute_get_values (a);
+
+ if (v && v->data) {
+ if (!strncmp ((char*)v->data, "<?xml", 5)) {
+ EDestination *dest = e_destination_import ((char*)v->data);
+
+ e_destination_export_to_vcard_attribute (dest, a);
+
+ g_object_unref (dest);
+
+ }
+ }
+ }
+ e_contact_set_attributes (contact, E_CONTACT_EMAIL, attrs);
+
/* FIXME Error checking */
e_book_add_contact (gci->book, contact, NULL);