aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/itip-utils.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-06-02 12:24:36 +0800
committerBharath Acharya <abharath@src.gnome.org>2008-06-02 12:24:36 +0800
commit851c7fac433e4c5a5ac04398c89480f4500c30a9 (patch)
tree54b0c95289313e4366f98073ec4d2b2037d396ac /calendar/gui/itip-utils.c
parentcef99d25f5913db5b8a4b4d6389920064a41dd26 (diff)
downloadgsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.tar.gz
gsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.tar.zst
gsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.zip
Committing on behalf of Milan Crha <mcrha@redhat.com>
2008-05-29 Milan Crha <mcrha@redhat.com> ** Fix for bug #535459 svn path=/trunk/; revision=35566
Diffstat (limited to 'calendar/gui/itip-utils.c')
-rw-r--r--calendar/gui/itip-utils.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index e529042051..cddb3d9b4f 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -1666,3 +1666,26 @@ itip_publish_comp (ECal *client, gchar *uri, gchar *username,
return TRUE;
}
+static gboolean
+check_time (const struct icaltimetype tmval, gboolean can_null_time)
+{
+ if (icaltime_is_null_time (tmval))
+ return can_null_time;
+
+ return icaltime_is_valid_time (tmval) &&
+ tmval.month >= 1 && tmval.month <= 12 &&
+ tmval.day >= 1 && tmval.day <= 31 &&
+ tmval.hour >= 0 && tmval.hour < 24 &&
+ tmval.minute >= 0 && tmval.minute < 60 &&
+ tmval.second >= 0 && tmval.second < 60;
+}
+
+/* returns whether the passed-in icalcomponent is valid or not. It does some sanity checks on values too. */
+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);
+}