From f58c45ce13747878fcb9e913d2d3dc5406ebef51 Mon Sep 17 00:00:00 2001 From: Sushma Rai Date: Wed, 13 Jul 2005 08:29:39 +0000 Subject: Fix for address book import problems. svn path=/trunk/; revision=29750 --- addressbook/ChangeLog | 12 ++++++++++++ addressbook/importers/evolution-ldif-importer.c | 8 ++++---- addressbook/importers/evolution-vcard-importer.c | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 640c480f42..78db70937b 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,15 @@ +2005-07-13 Sushma Rai + + * addressbook/importers/evolution-vcard-importer.c (vcard_supported): + Return false in the source URI does not start with "file://". + + * addressbook/importers/evolution-ldif-importer.c + (ldif_import_contacts): Using the proper file pointer. + (ldif_supported): Return false in the source URI does not start with + "file://". + (ldif_import_done): Close the file opened. + (ldif_import): Opening the proper file. + 2005-07-09 Veerapuram Varadhan * gui/component/addressbook-component.c: (impl_createControls): diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c index d5b6aa8dbc..b989fb5385 100644 --- a/addressbook/importers/evolution-ldif-importer.c +++ b/addressbook/importers/evolution-ldif-importer.c @@ -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, EImportTarget *target, EImportImporter *im) 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 *target, EImportImporter *im) 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); diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index c53d687d26..e4be880dea 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -419,7 +419,7 @@ vcard_supported(EImport *ei, EImportTarget *target, EImportImporter *im) if (s->uri_src == NULL) return TRUE; - if (!strncmp(s->uri_src, "file:///", 8)) + if (strncmp(s->uri_src, "file:///", 8) != 0) return FALSE; /* FIXME: need to parse the url properly */ -- cgit v1.2.3