aboutsummaryrefslogtreecommitdiffstats
path: root/mail/importers
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-02-17 10:16:11 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-02-17 10:16:11 +0800
commit78ec5fde6654a7118b0e7e6d203fcece872af28a (patch)
treeeb7f0134ee135a2fb3bfb7d079d4a9caf0b35ad1 /mail/importers
parent3cc6e89e669f8d99c39de2e558e79ae69cf43dd9 (diff)
downloadgsoc2013-evolution-78ec5fde6654a7118b0e7e6d203fcece872af28a.tar.gz
gsoc2013-evolution-78ec5fde6654a7118b0e7e6d203fcece872af28a.tar.zst
gsoc2013-evolution-78ec5fde6654a7118b0e7e6d203fcece872af28a.zip
fix for the weird-arsed e-contact list api. and fix a small memleak.
2004-02-17 Not Zed <NotZed@Ximian.com> * 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
Diffstat (limited to 'mail/importers')
-rw-r--r--mail/importers/pine-importer.c18
1 files changed, 16 insertions, 2 deletions
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 <libebook/e-book.h>
+#include <addressbook/util/eab-destination.h>
#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 {