4 * Editing calendar events.
26 * Display an event by itself (for editing)
27 * supplied_vevent the event to edit
28 * msgnum reference on the citserver
30 void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from, int unread) {
31 icalcomponent *vevent;
34 struct icaltimetype t_start, t_end;
37 int created_new_vevent = 0;
38 icalproperty *organizer = NULL;
39 char organizer_string[SIZ];
40 icalproperty *attendee = NULL;
41 char attendee_string[SIZ];
43 int organizer_is_me = 0;
46 char weekday_labels[7][32];
48 lprintf(9, "display_edit_individual_event(%ld) calview=%s year=%s month=%s day=%s\n",
49 msgnum, bstr("calview"), bstr("year"), bstr("month"), bstr("day")
52 /* populate the weekday names - begin */
54 localtime_r(&now, &tm_now);
55 while (tm_now.tm_wday != 0) {
57 localtime_r(&now, &tm_now);
60 localtime_r(&now, &tm_now);
61 wc_strftime(weekday_labels[i], 32, "%A", &tm_now);
64 /* populate the weekday names - end */
67 strcpy(organizer_string, "");
68 strcpy(attendee_string, "");
70 if (supplied_vevent != NULL) {
71 vevent = supplied_vevent;
73 * If we're looking at a fully encapsulated VCALENDAR
74 * rather than a VEVENT component, attempt to use the first
75 * relevant VEVENT subcomponent. If there is none, the
76 * NULL returned by icalcomponent_get_first_component() will
77 * tell the next iteration of this function to create a
80 if (icalcomponent_isa(vevent) == ICAL_VCALENDAR_COMPONENT) {
81 display_edit_individual_event(
82 icalcomponent_get_first_component(
83 vevent, ICAL_VEVENT_COMPONENT),
90 vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT);
91 created_new_vevent = 1;
94 /* Learn the sequence */
95 p = icalcomponent_get_first_property(vevent, ICAL_SEQUENCE_PROPERTY);
97 sequence = icalproperty_get_sequence(p);
101 output_headers(1, 1, 2, 0, 0, 0);
102 wprintf("<div id=\"banner\">\n");
104 wprintf(_("Add or edit an event"));
108 wprintf("<div id=\"content\" class=\"service\">\n");
110 wprintf("<div class=\"fix_scrollbar_bug\">");
112 /************************************************************
113 * Uncomment this to see the UID in calendar events for debugging
115 p = icalcomponent_get_first_property(vevent, ICAL_UID_PROPERTY);
117 escputs((char *)icalproperty_get_comment(p));
120 wprintf("SEQUENCE == %d<br />\n", sequence);
121 *************************************************************/
123 wprintf("<FORM NAME=\"EventForm\" METHOD=\"POST\" action=\"save_event\">\n");
124 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
126 wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgnum\" VALUE=\"%ld\">\n",
128 wprintf("<INPUT TYPE=\"hidden\" NAME=\"calview\" VALUE=\"%s\">\n",
130 wprintf("<INPUT TYPE=\"hidden\" NAME=\"year\" VALUE=\"%s\">\n",
132 wprintf("<INPUT TYPE=\"hidden\" NAME=\"month\" VALUE=\"%s\">\n",
134 wprintf("<INPUT TYPE=\"hidden\" NAME=\"day\" VALUE=\"%s\">\n",
143 tabbed_dialog(3, tabnames);
146 /* Put it in a borderless table so it lines up nicely */
147 wprintf("<TABLE border=0 width=100%%>\n");
149 wprintf("<TR><TD><B>");
150 wprintf(_("Summary"));
151 wprintf("</B></TD><TD>\n"
152 "<INPUT TYPE=\"text\" NAME=\"summary\" "
153 "MAXLENGTH=\"64\" SIZE=\"64\" VALUE=\"");
154 p = icalcomponent_get_first_property(vevent, ICAL_SUMMARY_PROPERTY);
156 escputs((char *)icalproperty_get_comment(p));
158 wprintf("\"></TD></TR>\n");
160 wprintf("<TR><TD><B>");
161 wprintf(_("Location"));
162 wprintf("</B></TD><TD>\n"
163 "<INPUT TYPE=\"text\" NAME=\"location\" "
164 "MAXLENGTH=\"64\" SIZE=\"64\" VALUE=\"");
165 p = icalcomponent_get_first_property(vevent, ICAL_LOCATION_PROPERTY);
167 escputs((char *)icalproperty_get_comment(p));
169 wprintf("\"></TD></TR>\n");
171 wprintf("<TR><TD><B>");
173 wprintf("</B></TD><TD>\n");
174 p = icalcomponent_get_first_property(vevent, ICAL_DTSTART_PROPERTY);
176 t_start = icalproperty_get_dtstart(p);
177 if (t_start.is_date) {
184 localtime_r(&now, &tm_now);
185 if (havebstr("year")) {
186 tm_now.tm_year = ibstr("year") - 1900;
187 tm_now.tm_mon = ibstr("month") - 1;
188 tm_now.tm_mday = ibstr("day");
190 if (havebstr("hour")) {
191 tm_now.tm_hour = ibstr("hour");
192 tm_now.tm_min = ibstr("minute");
201 t_start = icaltime_from_timet_with_zone(
203 ((yesbstr("alldayevent")) ? 1 : 0),
204 icaltimezone_get_utc_timezone()
209 display_icaltimetype_as_webform(&t_start, "dtstart");
211 wprintf("<INPUT TYPE=\"checkbox\" id=\"alldayevent\" NAME=\"alldayevent\" "
212 "VALUE=\"yes\" onclick=\"eventEditAllDay();\""
214 (t_start.is_date ? "CHECKED=\"CHECKED\"" : "" ),
218 wprintf("</TD></TR>\n");
221 * If this is an all-day-event, set the end time to be identical to
222 * the start time (the hour/minute/second will be set to midnight).
223 * Otherwise extract or create it.
225 wprintf("<TR><TD><B>");
227 wprintf("</B></TD><TD id=\"dtendcell\">\n");
228 if (t_start.is_date) {
232 p = icalcomponent_get_first_property(vevent,
233 ICAL_DTEND_PROPERTY);
235 t_end = icalproperty_get_dtend(p);
239 * If this is not an all-day event and there is no
240 * end time specified, make the default one hour
241 * from the start time.
246 t_end = icaltime_normalize(t_end);
247 /* t_end = icaltime_from_timet(now, 0); */
250 display_icaltimetype_as_webform(&t_end, "dtend");
251 wprintf("</TD></TR>\n");
253 wprintf("<TR><TD><B>");
255 wprintf("</B></TD><TD>\n"
256 "<TEXTAREA NAME=\"description\" wrap=soft "
257 "ROWS=5 COLS=80 WIDTH=80>\n"
259 p = icalcomponent_get_first_property(vevent, ICAL_DESCRIPTION_PROPERTY);
261 escputs((char *)icalproperty_get_comment(p));
263 wprintf("</TEXTAREA></TD></TR>");
266 * For a new event, the user creating the event should be the
267 * organizer. Set this field accordingly.
269 if (icalcomponent_get_first_property(vevent, ICAL_ORGANIZER_PROPERTY)
271 sprintf(organizer_string, "MAILTO:%s", WC->cs_inet_email);
272 icalcomponent_add_property(vevent,
273 icalproperty_new_organizer(organizer_string)
278 * Determine who is the organizer of this event.
279 * We need to determine "me" or "not me."
281 organizer = icalcomponent_get_first_property(vevent, ICAL_ORGANIZER_PROPERTY);
282 if (organizer != NULL) {
283 strcpy(organizer_string, icalproperty_get_organizer(organizer));
284 if (!strncasecmp(organizer_string, "MAILTO:", 7)) {
285 strcpy(organizer_string, &organizer_string[7]);
286 striplt(organizer_string);
287 serv_printf("ISME %s", organizer_string);
288 serv_getln(buf, sizeof buf);
295 wprintf("<TR><TD><B>");
296 wprintf(_("Organizer"));
297 wprintf("</B></TD><TD>");
298 escputs(organizer_string);
299 if (organizer_is_me) {
300 wprintf(" <FONT SIZE=-1><I>");
301 wprintf(_("(you are the organizer)"));
302 wprintf("</I></FONT>\n");
306 * Transmit the organizer as a hidden field. We don't want the user
307 * to be able to change it, but we do want it fed back to the server,
308 * especially if this is a new event and there is no organizer already
309 * in the calendar object.
311 wprintf("<INPUT TYPE=\"hidden\" NAME=\"organizer\" VALUE=\"");
312 escputs(organizer_string);
315 wprintf("</TD></TR>\n");
318 wprintf("<TR><TD><B>");
319 wprintf(_("Show time as:"));
320 wprintf("</B></TD><TD>");
322 p = icalcomponent_get_first_property(vevent, ICAL_TRANSP_PROPERTY);
324 /** No transparency found. Default to opaque (busy). */
325 p = icalproperty_new_transp(ICAL_TRANSP_OPAQUE);
327 icalcomponent_add_property(vevent, p);
331 v = icalproperty_get_value(p);
337 wprintf("<INPUT TYPE=\"radio\" NAME=\"transp\" VALUE=\"transparent\"");
338 if (v != NULL) if (icalvalue_get_transp(v) == ICAL_TRANSP_TRANSPARENT)
342 wprintf(" ");
344 wprintf("<INPUT TYPE=\"radio\" NAME=\"transp\" VALUE=\"opaque\"");
345 if (v != NULL) if (icalvalue_get_transp(v) == ICAL_TRANSP_OPAQUE)
350 wprintf("</TD></TR>\n");
353 /** Done with properties. */
354 wprintf("</TABLE>\n");
358 /* Attendees tab (need to move things here) */
360 wprintf("<TABLE border=0 width=100%%>\n"); /* same table style as the event tab */
361 wprintf("<TR><TD><B>");
362 wprintf(_("Attendees"));
365 wprintf(_("(One per line)"));
366 wprintf("</font>\n");
368 /** Pop open an address book -- begin **/
370 " <a href=\"javascript:PopOpenAddressBook('attendees_box|%s');\" "
372 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
377 /* Pop open an address book -- end **/
380 "<TEXTAREA %s NAME=\"attendees\" id=\"attendees_box\" wrap=soft "
381 "ROWS=3 COLS=80 WIDTH=80>\n",
382 (organizer_is_me ? "" : "DISABLED ")
385 for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDEE_PROPERTY);
387 attendee = icalcomponent_get_next_property(vevent, ICAL_ATTENDEE_PROPERTY)) {
388 strcpy(attendee_string, icalproperty_get_attendee(attendee));
389 if (!strncasecmp(attendee_string, "MAILTO:", 7)) {
391 /** screen name or email address */
392 strcpy(attendee_string, &attendee_string[7]);
393 striplt(attendee_string);
394 if (i++) wprintf("\n");
395 escputs(attendee_string);
398 /** participant status */
399 partstat_as_string(buf, attendee);
403 wprintf("</TEXTAREA></TD></TR>\n");
404 wprintf("</TABLE>\n");
409 icalproperty *rrule = NULL;
410 struct icalrecurrencetype recur;
412 rrule = icalcomponent_get_first_property(vevent, ICAL_RRULE_PROPERTY);
414 recur = icalproperty_get_rrule(rrule);
417 /* blank recurrence with some sensible defaults */
418 memset(&recur, 0, sizeof(struct icalrecurrencetype));
421 recur.freq = ICAL_WEEKLY_RECURRENCE;
424 wprintf("<INPUT TYPE=\"checkbox\" id=\"is_recur\" NAME=\"is_recur\" "
426 "onclick=\"RecurrenceShowHide();\""
428 (rrule ? "CHECKED=\"CHECKED\"" : "" ),
429 _("This is a repeating event")
432 wprintf("<div id=\"rrule\">\n"); /* begin 'rrule' div */
434 wprintf("<table border=0 width=100%%>\n"); /* same table style as the event tab */
436 /* Table row displaying raw RRULE data, FIXME remove when finished */
438 wprintf("<tr><td><b>");
440 wprintf("</b></td><td>");
441 wprintf("<tt>%s</tt>", icalrecurrencetype_as_string(&recur));
442 wprintf("</td></tr>\n");
445 char *frequency_units[] = {
456 wprintf("<tr><td><b>");
457 wprintf(_("Repeats"));
458 wprintf("</b></td><td>");
459 if ((recur.freq < 0) || (recur.freq > 6)) recur.freq = 4;
460 wprintf("%s ", _("every"));
462 wprintf("<input type=\"text\" name=\"interval\" maxlength=\"3\" size=\"3\" ");
463 wprintf("value=\"%d\"> ", recur.interval);
465 wprintf("<select name=\"freq\" size=\"1\">\n");
466 for (i=0; i<(sizeof frequency_units / sizeof(char *)); ++i) {
468 /* We only want to offer daily, weekly, monthly, or yearly, which are
469 * options 3 through 6, but if one of the others hapens to be selected,
470 * we will grudgingly add it to the list of options.
472 if ( (i == recur.freq) || ((i>=3) && (i<=6)) ) {
473 wprintf("<option %s value=\"%d\">%s</option>\n",
474 ((i == recur.freq) ? "selected" : ""),
481 wprintf("</td></tr>\n");
483 wprintf("<tr><td><b>");
484 wprintf("%s", _("on these weekdays:"));
485 wprintf("</b></td><td>");
488 char weekday_is_selected[7];
489 memset(weekday_is_selected, 0, 7);
491 for (i=0; i<ICAL_BY_DAY_SIZE; ++i) {
492 if (recur.by_day[i] == ICAL_RECURRENCE_ARRAY_MAX) {
493 i = ICAL_RECURRENCE_ARRAY_MAX; /* all done */
496 for (j=0; j<7; ++j) {
497 if (icalrecurrencetype_day_day_of_week(recur.by_day[i]) == j+1) {
498 weekday_is_selected[j] = 1;
504 for (i=0; i<7; ++i) {
505 wprintf("<input type=\"checkbox\" name=\"weekday%d\" value=\"yes\"", i);
506 if (weekday_is_selected[i]) wprintf(" checked");
507 wprintf(">%s</input>\n", weekday_labels[i]);
510 wprintf("</td></tr>\n");
511 wprintf("</table>\n");
512 wprintf("</div>\n"); /* end 'rrule' div */
516 /* submit buttons (common area beneath the tabs) */
519 "<INPUT TYPE=\"submit\" NAME=\"save_button\" VALUE=\"%s\">"
521 "<INPUT TYPE=\"submit\" NAME=\"delete_button\" VALUE=\"%s\">\n"
523 "<INPUT TYPE=\"submit\" NAME=\"check_button\" "
526 "<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">\n"
530 _("Check attendee availability"),
533 wprintf("</FORM>\n");
538 wprintf("<script type=\"text/javascript\"> \n"
539 "eventEditAllDay(); \n"
540 "RecurrenceShowHide(); \n"
543 address_book_popup();
546 if (created_new_vevent) {
547 icalcomponent_free(vevent);
552 * Save an edited event
554 * supplied_vevent: the event to save
555 * msgnum: the index on the citserver
557 void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from, int unread) {
560 icalcomponent *vevent, *encaps;
561 int created_new_vevent = 0;
562 int all_day_event = 0;
563 struct icaltimetype event_start, t;
564 icalproperty *attendee = NULL;
565 char attendee_string[SIZ];
568 char form_attendees[SIZ];
569 char organizer_string[SIZ];
571 enum icalproperty_transp formtransp = ICAL_TRANSP_NONE;
573 if (supplied_vevent != NULL) {
574 vevent = supplied_vevent;
576 * If we're looking at a fully encapsulated VCALENDAR
577 * rather than a VEVENT component, attempt to use the first
578 * relevant VEVENT subcomponent. If there is none, the
579 * NULL returned by icalcomponent_get_first_component() will
580 * tell the next iteration of this function to create a
583 if (icalcomponent_isa(vevent) == ICAL_VCALENDAR_COMPONENT) {
584 save_individual_event(
585 icalcomponent_get_first_component(
586 vevent, ICAL_VEVENT_COMPONENT),
593 vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT);
594 created_new_vevent = 1;
597 if ( (havebstr("save_button"))
598 || (havebstr("check_button")) ) {
600 /** Replace values in the component with ones from the form */
602 while (prop = icalcomponent_get_first_property(vevent,
603 ICAL_SUMMARY_PROPERTY), prop != NULL) {
604 icalcomponent_remove_property(vevent, prop);
605 icalproperty_free(prop);
608 if (havebstr("summary")) {
610 icalcomponent_add_property(vevent,
611 icalproperty_new_summary(bstr("summary")));
613 icalcomponent_add_property(vevent,
614 icalproperty_new_summary("Untitled Event"));
617 while (prop = icalcomponent_get_first_property(vevent,
618 ICAL_LOCATION_PROPERTY), prop != NULL) {
619 icalcomponent_remove_property(vevent, prop);
620 icalproperty_free(prop);
622 if (havebstr("location")) {
623 icalcomponent_add_property(vevent,
624 icalproperty_new_location(bstr("location")));
626 while (prop = icalcomponent_get_first_property(vevent,
627 ICAL_DESCRIPTION_PROPERTY), prop != NULL) {
628 icalcomponent_remove_property(vevent, prop);
629 icalproperty_free(prop);
631 if (havebstr("description")) {
632 icalcomponent_add_property(vevent,
633 icalproperty_new_description(bstr("description")));
636 while (prop = icalcomponent_get_first_property(vevent,
637 ICAL_DTSTART_PROPERTY), prop != NULL) {
638 icalcomponent_remove_property(vevent, prop);
639 icalproperty_free(prop);
642 if (yesbstr("alldayevent")) {
650 icaltime_from_webform_dateonly(&event_start, "dtstart");
653 icaltime_from_webform(&event_start, "dtstart");
657 * The following odd-looking snippet of code looks like it
658 * takes some unnecessary steps. It is done this way because
659 * libical incorrectly turns an "all day event" into a normal
660 * event starting at midnight (i.e. it serializes as date/time
661 * instead of just date) unless icalvalue_new_date() is used.
662 * So we force it, if this is an all day event.
664 prop = icalproperty_new_dtstart(event_start);
666 icalproperty_set_value(prop, icalvalue_new_date(event_start));
669 if (prop) icalcomponent_add_property(vevent, prop);
670 else icalproperty_free(prop);
672 while (prop = icalcomponent_get_first_property(vevent,
673 ICAL_DTEND_PROPERTY), prop != NULL) {
674 icalcomponent_remove_property(vevent, prop);
675 icalproperty_free(prop);
677 while (prop = icalcomponent_get_first_property(vevent,
678 ICAL_DURATION_PROPERTY), prop != NULL) {
679 icalcomponent_remove_property(vevent, prop);
680 icalproperty_free(prop);
683 if (all_day_event == 0) {
684 icaltime_from_webform(&t, "dtend");
685 icalcomponent_add_property(vevent,
686 icalproperty_new_dtend(icaltime_normalize(t)
691 /** See if transparency is indicated */
692 if (havebstr("transp")) {
693 if (!strcasecmp(bstr("transp"), "opaque")) {
694 formtransp = ICAL_TRANSP_OPAQUE;
696 else if (!strcasecmp(bstr("transp"), "transparent")) {
697 formtransp = ICAL_TRANSP_TRANSPARENT;
700 while (prop = icalcomponent_get_first_property(vevent, ICAL_TRANSP_PROPERTY),
702 icalcomponent_remove_property(vevent, prop);
703 icalproperty_free(prop);
706 icalcomponent_add_property(vevent, icalproperty_new_transp(formtransp));
709 /** Give this event a UID if it doesn't have one. */
710 if (icalcomponent_get_first_property(vevent,
711 ICAL_UID_PROPERTY) == NULL) {
713 icalcomponent_add_property(vevent, icalproperty_new_uid(buf));
716 /** Increment the sequence ID */
717 while (prop = icalcomponent_get_first_property(vevent,
718 ICAL_SEQUENCE_PROPERTY), (prop != NULL) ) {
719 i = icalproperty_get_sequence(prop);
720 if (i > sequence) sequence = i;
721 icalcomponent_remove_property(vevent, prop);
722 icalproperty_free(prop);
725 icalcomponent_add_property(vevent,
726 icalproperty_new_sequence(sequence)
730 * Set the organizer, only if one does not already exist *and*
731 * the form is supplying one
733 strcpy(buf, bstr("organizer"));
734 if ( (icalcomponent_get_first_property(vevent,
735 ICAL_ORGANIZER_PROPERTY) == NULL)
736 && (!IsEmptyStr(buf)) ) {
738 /** set new organizer */
739 sprintf(organizer_string, "MAILTO:%s", buf);
740 icalcomponent_add_property(vevent,
741 icalproperty_new_organizer(organizer_string)
747 * Add any new attendees listed in the web form
750 /* First, strip out the parenthesized partstats. */
751 strcpy(form_attendees, bstr("attendees"));
752 stripout(form_attendees, '(', ')');
754 /* Next, change any commas to newlines, because we want newline-separated attendees. */
755 j = strlen(form_attendees);
756 for (i=0; i<j; ++i) {
757 if (form_attendees[i] == ',') {
758 form_attendees[i] = '\n';
759 while (isspace(form_attendees[i+1])) {
760 strcpy(&form_attendees[i+1], &form_attendees[i+2]);
766 for (i=0; i<num_tokens(form_attendees, '\n'); ++i) {
767 extract_token(buf, form_attendees, i, '\n', sizeof buf);
769 if (!IsEmptyStr(buf)) {
770 sprintf(attendee_string, "MAILTO:%s", buf);
773 for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDEE_PROPERTY); attendee != NULL; attendee = icalcomponent_get_next_property(vevent, ICAL_ATTENDEE_PROPERTY)) {
774 if (!strcasecmp(attendee_string,
775 icalproperty_get_attendee(attendee)))
781 icalcomponent_add_property(vevent,
782 icalproperty_new_attendee(attendee_string)
789 * Remove any attendees *not* listed in the web form
791 STARTOVER: for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDEE_PROPERTY); attendee != NULL; attendee = icalcomponent_get_next_property(vevent, ICAL_ATTENDEE_PROPERTY)) {
792 strcpy(attendee_string, icalproperty_get_attendee(attendee));
793 if (!strncasecmp(attendee_string, "MAILTO:", 7)) {
794 strcpy(attendee_string, &attendee_string[7]);
795 striplt(attendee_string);
797 for (i=0; i<num_tokens(form_attendees, '\n'); ++i) {
798 extract_token(buf, form_attendees, i, '\n', sizeof buf);
800 if (!strcasecmp(buf, attendee_string)) ++foundit;
803 icalcomponent_remove_property(vevent, attendee);
804 icalproperty_free(attendee);
811 * Encapsulate event into full VCALENDAR component. Clone it first,
812 * for two reasons: one, it's easier to just free the whole thing
813 * when we're done instead of unbundling, but more importantly, we
814 * can't encapsulate something that may already be encapsulated
817 encaps = ical_encapsulate_subcomponent(icalcomponent_new_clone(vevent));
819 /* Set the method to PUBLISH */
820 icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH);
822 /** If the user clicked 'Save' then save it to the server. */
823 if ( (encaps != NULL) && (havebstr("save_button")) ) {
824 serv_puts("ENT0 1|||4|||1|");
825 serv_getln(buf, sizeof buf);
827 serv_puts("Content-type: text/calendar");
829 serv_puts(icalcomponent_as_ical_string(encaps));
832 if ( (buf[0] == '8') || (buf[0] == '4') ) {
833 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
837 strcpy(WC->ImportantMessage, &buf[4]);
839 icalmemory_free_ring ();
840 icalcomponent_free(encaps);
844 /** Or, check attendee availability if the user asked for that. */
845 if ( (encaps != NULL) && (havebstr("check_button")) ) {
847 /* Call this function, which does the real work */
848 check_attendee_availability(encaps);
850 /** This displays the form again, with our annotations */
851 display_edit_individual_event(encaps, msgnum, from, unread);
853 icalcomponent_free(encaps);
856 if (encaps != NULL) {
857 icalcomponent_free(encaps);
864 * If the user clicked 'Delete' then delete it.
866 if ( (havebstr("delete_button")) && (msgnum > 0L) ) {
867 serv_printf("DELE %ld", lbstr("msgnum"));
868 serv_getln(buf, sizeof buf);
871 if (created_new_vevent) {
872 icalcomponent_free(vevent);
875 /* If this was a save or delete, go back to the calendar view. */
876 if (!havebstr("check_button")) {