From 78ec5fde6654a7118b0e7e6d203fcece872af28a Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 17 Feb 2004 02:16:11 +0000 Subject: fix for the weird-arsed e-contact list api. and fix a small memleak. 2004-02-17 Not Zed * importers/pine-importer.c (import_contact): fix for the weird-arsed e-contact list api. and fix a small memleak. svn path=/trunk/; revision=24753 --- mail/importers/pine-importer.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'mail/importers/pine-importer.c') diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c index 519f1beffd..b47030fbfd 100644 --- a/mail/importers/pine-importer.c +++ b/mail/importers/pine-importer.c @@ -62,6 +62,7 @@ #include "mail/mail-component.h" #include +#include #define KEY "pine-mail-imported" @@ -206,9 +207,22 @@ import_contact(EBook *book, char *line) addr[len-1] = 0; addrs = g_strsplit(addr+1, ",", 0); list = NULL; - for (i=0;addrs[i];i++) - list = g_list_append(list, addrs[i]); + /* So ... this api is just insane ... we set plain strings as the contact email if it + is a normal contact, but need to do this xml crap for mailing lists */ + for (i=0;addrs[i];i++) { + EABDestination *d; + char *xml; + + d = eab_destination_new(); + eab_destination_set_email(d, addrs[i]); + xml = eab_destination_export(d); + if (xml) + list = g_list_append(list, xml); + g_object_unref(d); + } e_contact_set(card, E_CONTACT_EMAIL, list); + g_list_foreach(list, (GFunc)g_free, NULL); + g_list_free(list); g_strfreev(addrs); e_contact_set(card, E_CONTACT_IS_LIST, GINT_TO_POINTER(TRUE)); } else { -- cgit v1.2.3