X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fevent.c;h=5f9d3213ddb0b8714ae11190fb20eba5a0c367c0;hb=fb6f6fa4ec4e3277e30d84326d48e6850822d318;hp=5ad4636a3fef9948c39c55ad8c1eac25cd2d2eb8;hpb=68c34720bd22b8831fe78d8e6c8f985eb79c6eb5;p=citadel.git diff --git a/webcit/event.c b/webcit/event.c index 5ad4636a3..5f9d3213d 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -1,23 +1,15 @@ /* - * $Id$ - * * Editing calendar events. * - * Copyright (c) 1996-2010 by the citadel.org team + * Copyright (c) 1996-2012 by the citadel.org team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. + * This program is open source software. You can redistribute it and/or + * modify it under the terms of the GNU General Public License, version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "webcit.h" @@ -46,7 +38,10 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char buf[SIZ]; int organizer_is_me = 0; int i, j = 0; + /************************************************************ + * Uncomment this to see the UID in calendar events for debugging int sequence = 0; + */ char weekday_labels[7][32]; char month_labels[12][32]; long weekstart = 0; @@ -67,7 +62,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, int which_rrend_is_preselected; int which_rryeartype_is_preselected; - + const char *ch; char *tabnames[3]; const char *frequency_units[8]; const char *ordinals[6]; @@ -97,7 +92,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, get_pref_long("weekstart", &weekstart, 17); if (weekstart > 6) weekstart = 0; - lprintf(9, "display_edit_individual_event(%ld) calview=%s year=%s month=%s day=%s\n", + syslog(9, "display_edit_individual_event(%ld) calview=%s year=%s month=%s day=%s\n", msgnum, bstr("calview"), bstr("year"), bstr("month"), bstr("day") ); @@ -159,13 +154,15 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, /* Learn the sequence */ p = icalcomponent_get_first_property(vevent, ICAL_SEQUENCE_PROPERTY); + /************************************************************ + * Uncomment this to see the UID in calendar events for debugging if (p != NULL) { sequence = icalproperty_get_sequence(p); } - + */ /* Begin output */ - output_headers(1, 1, 2, 0, 0, 0); - wc_printf("
\n"); + output_headers(1, 1, 1, 0, 0, 0); + wc_printf("
\n"); wc_printf("

"); wc_printf(_("Add or edit an event")); wc_printf("

"); @@ -173,8 +170,6 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wc_printf("
\n"); - wc_printf("
"); - /************************************************************ * Uncomment this to see the UID in calendar events for debugging wc_printf("UID == "); @@ -182,8 +177,8 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, if (p != NULL) { escputs((char *)icalproperty_get_comment(p)); } - wc_printf("
\n"); - wc_printf("SEQUENCE == %d
\n", sequence); + wc_printf("
\n"); + wc_printf("SEQUENCE == %d
\n", sequence); *************************************************************/ wc_printf("
\n"); @@ -440,7 +435,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wc_printf("\n"); /* same table style as the event tab */ wc_printf("\n"); @@ -774,8 +769,6 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, end_tab(3, 3); wc_printf("\n"); - wc_printf("\n"); /* end 'fix_scrollbar_bug' div */ - StrBufAppendPrintf(WC->trailing_javascript, "eventEditAllDay(); \n" "RecurrenceShowHide(); \n" @@ -811,6 +804,7 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr char organizer_string[SIZ]; int sequence = 0; enum icalproperty_transp formtransp = ICAL_TRANSP_NONE; + const char *ch; if (supplied_vevent != NULL) { vevent = supplied_vevent; @@ -1105,15 +1099,15 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr foundit = 0; for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDEE_PROPERTY); attendee != NULL; attendee = icalcomponent_get_next_property(vevent, ICAL_ATTENDEE_PROPERTY)) { - if (!strcasecmp(attendee_string, - icalproperty_get_attendee(attendee))) + ch = icalproperty_get_attendee(attendee); + if ((ch != NULL) && !strcasecmp(attendee_string, ch)) ++foundit; } if (foundit == 0) { icalcomponent_add_property(vevent, - icalproperty_new_attendee(attendee_string) + icalproperty_new_attendee(attendee_string) ); } } @@ -1123,9 +1117,9 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr * Remove any attendees *not* listed in the web form */ STARTOVER: for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDEE_PROPERTY); attendee != NULL; attendee = icalcomponent_get_next_property(vevent, ICAL_ATTENDEE_PROPERTY)) { - strcpy(attendee_string, icalproperty_get_attendee(attendee)); - if (!strncasecmp(attendee_string, "MAILTO:", 7)) { - strcpy(attendee_string, &attendee_string[7]); + ch = icalproperty_get_attendee(attendee); + if ((ch != NULL) && !strncasecmp(ch, "MAILTO:", 7)) { + safestrncpy(attendee_string, ch + 7, sizeof(attendee_string)); striplt(attendee_string); foundit = 0; for (i=0; iImportantMessage, &buf[4]); + case '4': + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {} + break; + case '2': + AppendImportantMessage(buf + 4, - 1); + break; + default: + break; } icalmemory_free_ring (); icalcomponent_free(encaps); @@ -1209,7 +1207,7 @@ STARTOVER: for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDE /* If this was a save or delete, go back to the calendar or summary view. */ if (!havebstr("check_button")) { if (!strcasecmp(bstr("calview"), "summary")) { - summary(); + display_summary_page(); } else { readloop(readfwd, eUseDefault);
"); wc_printf(_("Attendees")); - wc_printf("
" + wc_printf("
" ""); wc_printf(_("(One per line)")); wc_printf("\n"); @@ -449,7 +444,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wc_printf( " " - "" + "" "", _("Attendees"), _("Contacts") @@ -467,11 +462,11 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDEE_PROPERTY); attendee != NULL; attendee = icalcomponent_get_next_property(vevent, ICAL_ATTENDEE_PROPERTY)) { - strcpy(attendee_string, icalproperty_get_attendee(attendee)); - if (!strncasecmp(attendee_string, "mailto:", 7)) { + ch = icalproperty_get_attendee(attendee); + if ((ch != NULL) && !strncasecmp(ch, "mailto:", 7)) { /* screen name or email address */ - strcpy(attendee_string, &attendee_string[7]); + safestrncpy(attendee_string, ch + 7, sizeof(attendee_string)); striplt(attendee_string); if (i++) wc_printf("\n"); escputs(attendee_string); @@ -596,7 +591,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, } wc_printf(_("on day %s%d%s of the month"), "", rrmday, ""); - wc_printf("
\n"); + wc_printf("
\n"); wc_printf(""); - wc_printf(" %s
\n", _("of the month")); + wc_printf(" %s
\n", _("of the month")); wc_printf("\n"); /* end 'monthday_selector' div */ @@ -658,7 +653,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, ((which_rryeartype_is_preselected == 0) ? "checked='checked'" : "") ); wc_printf(_("every ")); - wc_printf("%s
", _("year on this date")); + wc_printf("%s
", _("year on this date")); wc_printf(""); - wc_printf("
\n"); + wc_printf("
\n"); wc_printf("\n"); /* end 'yearday_selector' div */ @@ -722,7 +717,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, "%s onChange=\"RecurrenceShowHide();\">", ((which_rrend_is_preselected == 0) ? "checked='checked'" : "") ); - wc_printf("%s
\n", _("No ending date")); + wc_printf("%s
\n", _("No ending date")); wc_printf(" ", recur.count); wc_printf(_("times")); - wc_printf("
\n"); + wc_printf("
\n"); wc_printf("\n"); + wc_printf("
\n"); wc_printf("