From b8d68c6688de833d72742a6239e57c3970ab7114 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 1 Apr 2003 16:06:15 +0000 Subject: added filename (tasks.ics/calendar.ics) to the URI if it does not contain 2003-04-01 Rodrigo Moya * importers/icalendar-importer.c (load_file_fn, vcal_load_file_fn): added filename (tasks.ics/calendar.ics) to the URI if it does not contain it. svn path=/trunk/; revision=20611 --- calendar/importers/icalendar-importer.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'calendar/importers') diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 9f336a4d05..467545a0ca 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -292,11 +292,22 @@ load_file_fn (EvolutionImporter *importer, icalcomp = icalparser_parse_string (contents); if (icalcomp) { - if (cal_client_open_calendar (ici->client, physical_uri, TRUE) + char *real_uri; + + if (!g_strncasecmp (physical_uri, "file", 4) && + g_strcasecmp (physical_uri + (strlen (physical_uri) - strlen ("calendar.ics")), + "calendar.ics")) { + real_uri = g_concat_dir_and_file (physical_uri, "calendar.ics"); + } else + real_uri = g_strdup (physical_uri); + + if (cal_client_open_calendar (ici->client, real_uri, TRUE) && cal_client_open_default_tasks (ici->tasks_client, FALSE)) { ici->icalcomp = icalcomp; ret = TRUE; } + + g_free (real_uri); } } @@ -413,11 +424,22 @@ vcal_load_file_fn (EvolutionImporter *importer, icalcomp = load_vcalendar_file (filename); if (icalcomp) { - if (cal_client_open_calendar (ici->client, physical_uri, TRUE) + char *real_uri; + + if (!g_strncasecmp (physical_uri, "file", 4) && + g_strcasecmp (physical_uri + (strlen (physical_uri) - strlen ("calendar.ics")), + "calendar.ics")) { + real_uri = g_concat_dir_and_file (physical_uri, "calendar.ics"); + } else + real_uri = g_strdup (physical_uri); + + if (cal_client_open_calendar (ici->client, real_uri, TRUE) && cal_client_open_default_tasks (ici->tasks_client, FALSE)) { ici->icalcomp = icalcomp; ret = TRUE; } + + g_free (real_uri); } return ret; -- cgit v1.2.3