[evolution-patches] Patch for address book import.
- From: Sushma Rai <rsushma novell com>
- To: Evolution Patches List <evolution-patches lists ximian com>
- Subject: [evolution-patches] Patch for address book import.
- Date: Wed, 13 Jul 2005 11:59:19 +0530
Hi,
This patch is to fix the ldif file import.
Since my previous patch is not committed yet, it contains the 
changes, which previous patch also had.
Please review,
-Sushma.
Index: importers/evolution-ldif-importer.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/importers/evolution-ldif-importer.c,v
retrieving revision 1.12
diff -u -p -r1.12 evolution-ldif-importer.c
--- importers/evolution-ldif-importer.c	12 Jul 2005 04:04:09 -0000	1.12
+++ importers/evolution-ldif-importer.c	13 Jul 2005 06:09:32 -0000
@@ -443,7 +443,6 @@ static gboolean
 ldif_import_contacts(void *d)
 {
 	LDIFImporter *gci = d;
-	FILE * file;
 	EContact *contact;
 	GSList *iter;
 	int count = 0;
@@ -452,7 +451,7 @@ ldif_import_contacts(void *d)
 	   ones till the end */
 
 	if (gci->state == 0) {
-		while (count < 50 && (contact = getNextLDIFEntry(gci, file))) {
+		while (count < 50 && (contact = getNextLDIFEntry(gci, gci->file))) {
 			if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
 				gci->list_contacts = g_slist_prepend(gci->list_contacts, contact);
 			} else {
@@ -548,7 +547,7 @@ ldif_supported(EImport *ei, EImportTarge
 	if (s->uri_src == NULL)
 		return TRUE;
 
-	if (!strncmp(s->uri_src, "file:///", 8))
+	if (strncmp(s->uri_src, "file:///", 8) != 0)
 		return FALSE;
 
 	ext = strrchr(s->uri_src, '.');
@@ -575,6 +574,7 @@ ldif_import_done(LDIFImporter *gci)
 	if (gci->idle_id)
 		g_source_remove(gci->idle_id);
 
+	fclose (gci->file);
 	g_object_unref(gci->book);
 	g_slist_foreach(gci->contacts, (GFunc) g_object_unref, NULL);
 	g_slist_foreach(gci->list_contacts, (GFunc) g_object_unref, NULL);
@@ -604,7 +604,7 @@ ldif_import(EImport *ei, EImportTarget *
 		return;
 	}
 
-	file = fopen(s->uri_src, "r");
+	file = fopen(s->uri_src+7, "r");
 	if (file == NULL) {
 		g_message(G_STRLOC ":Can't open .ldif file");
 		e_import_complete(ei, target);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]