[evolution/gnome-3-0] Bug #656810 - Too strict checking for validity of received calendars



commit 213bb761b1cddb18840e9c9a3150a57af503568d
Author: Milan Crha <mcrha redhat com>
Date:   Thu Aug 18 17:30:19 2011 +0200

    Bug #656810 - Too strict checking for validity of received calendars

 calendar/gui/itip-utils.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 6163d59..b59cb9f 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -1906,8 +1906,22 @@ check_time (const struct icaltimetype tmval, gboolean can_null_time)
 gboolean
 is_icalcomp_valid (icalcomponent *icalcomp)
 {
-	return  icalcomp &&
-		icalcomponent_is_valid (icalcomp) &&
-		check_time (icalcomponent_get_dtstart (icalcomp), FALSE) &&
-		check_time (icalcomponent_get_dtend (icalcomp), TRUE);
+	if (!icalcomp || !icalcomponent_is_valid (icalcomp))
+		return FALSE;
+
+	switch (icalcomponent_isa (icalcomp)) {
+	case ICAL_VEVENT_COMPONENT:
+		return	check_time (icalcomponent_get_dtstart (icalcomp), FALSE) &&
+			check_time (icalcomponent_get_dtend (icalcomp), TRUE);
+	case ICAL_VTODO_COMPONENT:
+		return	check_time (icalcomponent_get_dtstart (icalcomp), TRUE) &&
+			check_time (icalcomponent_get_due (icalcomp), TRUE);
+	case ICAL_VJOURNAL_COMPONENT:
+		return	check_time (icalcomponent_get_dtstart (icalcomp), TRUE) &&
+			check_time (icalcomponent_get_dtend (icalcomp), TRUE);
+	default:
+		break;
+	}
+
+	return TRUE;
 }



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