]> code.citadel.org Git - citadel.git/commitdiff
* Correctly serialize and save all day events using date instead of date/time
authorArt Cancro <ajc@citadel.org>
Thu, 14 Nov 2002 04:59:40 +0000 (04:59 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 14 Nov 2002 04:59:40 +0000 (04:59 +0000)
webcit/ChangeLog
webcit/event.c

index b0b471244a8aad0141903b826a7510a78f119954..cb8948cd12c71b4d3668b47ade8e2d9c244a5ff2 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 400.49  2002/11/14 04:59:40  ajc
+* Correctly serialize and save all day events using date instead of date/time
+
 Revision 400.48  2002/11/13 04:49:23  ajc
 * "All day event" shows as a single checkbox, instead of one for the start
   time and one for the end time.  Added nifty JavaScript to zero and shade
@@ -1109,3 +1112,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index b2bb386cc955cd0a2e8e8dbd04b11dc3aab967a7..0cea5ed7b10d1ec10fee657bd9f990a4eaa56231 100644 (file)
@@ -263,20 +263,27 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) {
                        event_start.minute = 0;
                        event_start.second = 0;
                }
-               lprintf(9, "dtstart: %s\n",
-                       icaltime_as_ical_string(event_start)
-               );
-
-       /* FIXME.  Somewhere between here and when we save the event, we are
-        * somehow losing the "is_date" setting of dtstart.  The problem might
-        * be with WebCit or it might be in libical.  Check to see if this
-        * problem goes away when we upgrade libical.  --IG
-        */
 
-               icalcomponent_add_property(vevent,
-                       icalproperty_new_dtstart(event_start)
-               );
-       
+
+               /* The following odd-looking snippet of code looks like it
+                * takes some unnecessary steps.  It is done this way because
+                * libical incorrectly turns an "all day event" into a normal
+                * event starting at midnight (i.e. it serializes as date/time
+                * instead of just date) unless icalvalue_new_date() is used.
+                * So we force it, if this is an all day event.
+                */
+               prop = icalproperty_new_dtstart(event_start);
+               if (all_day_event) {
+                       icalproperty_set_value(prop,
+                               icalvalue_new_date(event_start)
+                       );
+               }
+
+               if (prop) icalcomponent_add_property(vevent, prop);
+               else icalproperty_free(prop);
+
+
+
                while (prop = icalcomponent_get_first_property(vevent,
                      ICAL_DTEND_PROPERTY), prop != NULL) {
                        icalcomponent_remove_property(vevent, prop);