evolution r36658 - in branches/gnome-2-24/calendar: . importers



Author: msuman
Date: Mon Oct 20 04:21:00 2008
New Revision: 36658
URL: http://svn.gnome.org/viewvc/evolution?rev=36658&view=rev

Log:
Milan Crha  <mcrha redhat com> ** Fix for bug #528816 (Disable vCalendar importer when we can parse proper iCalendar from the given file).

Modified:
   branches/gnome-2-24/calendar/ChangeLog
   branches/gnome-2-24/calendar/importers/icalendar-importer.c

Modified: branches/gnome-2-24/calendar/importers/icalendar-importer.c
==============================================================================
--- branches/gnome-2-24/calendar/importers/icalendar-importer.c	(original)
+++ branches/gnome-2-24/calendar/importers/icalendar-importer.c	Mon Oct 20 04:21:00 2008
@@ -474,22 +474,34 @@
 
 	if (g_file_get_contents(filename, &contents, NULL, NULL)) {
 		VObject *vcal;
+		icalcomponent *icalcomp;
 
-		/* parse the file */
-		vcal = Parse_MIME (contents, strlen (contents));
-		g_free (contents);
+		icalcomp = e_cal_util_parse_ics_string (contents);
 
-		if (vcal) {
-			icalcomponent *icalcomp;
+		if (icalcomp && icalcomponent_is_valid (icalcomp)) {
+			/* If we can create proper iCalendar from the file, then
+			   rather use ics importer, because it knows to read more
+			   information than older version, the vCalendar. */
+			ret = FALSE;
+			g_free (contents);
+		} else {
+			if (icalcomp)
+				icalcomponent_free (icalcomp);
 
-			icalcomp = icalvcal_convert (vcal);
+			/* parse the file */
+			vcal = Parse_MIME (contents, strlen (contents));
+			g_free (contents);
+
+			if (vcal) {
+				icalcomp = icalvcal_convert (vcal);
+
+				if (icalcomp) {
+					icalcomponent_free (icalcomp);
+					ret = TRUE;
+				}
 
-			if (icalcomp) {
-				icalcomponent_free (icalcomp);
-				ret = TRUE;
+				cleanVObject (vcal);
 			}
-
-			cleanVObject (vcal);
 		}
 	}
 	g_free (filename);



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