[evolution-patches] improve import of .vcf files containing multiple vcards



Hi,

eab_contact_list_from_string currently expects vcards to be separated by
2 new lines characters when they are concatenated in a single file. The
attached patch looks for an "END:VCARD" string instead.

Christophe
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1684
diff -u -r1.1684 ChangeLog
--- addressbook/ChangeLog	30 Apr 2004 18:23:16 -0000	1.1684
+++ addressbook/ChangeLog	1 May 2004 12:02:36 -0000
@@ -1,3 +1,9 @@
+2004-05-01  Christophe Fergeau  <teuf gnome org>
+
+	* util/eab-book-util.c (eab_contact_list_from_string): don't assume
+	that if a file contains several vcards, they will be neatly separated
+	by \n\n
+
 2004-04-30  Chris Toshok  <toshok ximian com>
 
 	* util/e-destination.c (e_destination_set_contact): don't use
Index: addressbook/util/eab-book-util.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/util/eab-book-util.c,v
retrieving revision 1.4
diff -u -r1.4 eab-book-util.c
--- addressbook/util/eab-book-util.c	23 Jan 2004 19:35:02 -0000	1.4
+++ addressbook/util/eab-book-util.c	1 May 2004 12:02:36 -0000
@@ -199,22 +199,21 @@
 	do {
 		char *temp;
 
-		blank_line = strstr (q, "\n\n");
+		blank_line = strstr (q, "END:VCARD");
 		if (blank_line) {
+			blank_line += strlen ("END:VCARD");
 			temp = g_strndup (q, blank_line - q);
 		}
 		else {
 			temp = g_strdup (q);
 		}
-
-		contacts = g_list_append (contacts, e_contact_new_from_vcard (temp));
+		g_strstrip (temp);
+		if ((temp != NULL) && (*temp != '\0')) {
+			contacts = g_list_append (contacts, e_contact_new_from_vcard (temp));
+		}
 
 		g_free (temp);
-
-		if (blank_line)
-			q = blank_line + 2;
-		else
-			q = NULL;
+		q = blank_line;
 	} while (blank_line);
 
 	g_free (p);

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]