]> code.citadel.org Git - citadel.git/blobdiff - webcit/event.c
* start migrating important message to strbuf; have both meanwhile.
[citadel.git] / webcit / event.c
index 9f7bdfc2b4dbb9c59c17d7ac791fd61b0f2afe07..26dd217bd100725d506de64b3ff980463f25414f 100644 (file)
@@ -242,25 +242,34 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
                }
        }
        else {
-               /*
-                * If this is an all-day-event, set the end time to be identical to
-                * the start time (the hour/minute/second will be set to midnight).
-                * Otherwise extract or create it.
-                */
-               if (t_start.is_date) {
-                       t_end = t_start;
+               if (created_new_vevent == 1) {
+                       /* set default duration */
+                       if (t_start.is_date) {
+                               /*
+                                * If this is an all-day-event, set the end time to be identical to
+                                * the start time (the hour/minute/second will be set to midnight).
+                                */
+                               t_end = t_start;
+                       }
+                       else {
+                               /*
+                                * If this is not an all-day event and there is no
+                                * end time specified, make the default one hour
+                                * from the start time.
+                                */
+                               t_end = t_start;
+                               t_end.hour += 1;
+                               t_end.second = 0;
+                               t_end = icaltime_normalize(t_end);
+                               /* t_end = icaltime_from_timet(now, 0); */
+                       }
                }
                else {
                        /*
-                        * If this is not an all-day event and there is no
-                        * end time specified, make the default one hour
-                        * from the start time.
+                        * If an existing event has no end date/time this is
+                        * supposed to mean end = start.
                         */
                        t_end = t_start;
-                       t_end.hour += 1;
-                       t_end.second = 0;
-                       t_end = icaltime_normalize(t_end);
-                       /* t_end = icaltime_from_timet(now, 0); */
                }
        }
        display_icaltimetype_as_webform(&t_end, "dtend", 0);
@@ -284,7 +293,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
         */
        if (icalcomponent_get_first_property(vevent, ICAL_ORGANIZER_PROPERTY)
           == NULL) {
-               sprintf(organizer_string, "MAILTO:%s", WC->cs_inet_email);
+               sprintf(organizer_string, "MAILTO:%s", ChrPtr(WC->cs_inet_email));
                icalcomponent_add_property(vevent,
                        icalproperty_new_organizer(organizer_string)
                );