X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fcalendar.c;h=abb731a537a2f1b7a16219570b37f141ea19ce6c;hb=HEAD;hp=58b00a84ef383cf208196bdf59a438ba2dc0fd4d;hpb=ec636368885b210420016b3f544edcbab9189880;p=citadel.git
diff --git a/webcit/calendar.c b/webcit/calendar.c
index 58b00a84e..b1da61c41 100644
--- a/webcit/calendar.c
+++ b/webcit/calendar.c
@@ -1,35 +1,25 @@
-/*
- * Functions which handle calendar objects and their processing/display.
- *
- * Copyright (c) 1996-2012 by the citadel.org team
- *
- * 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.
- *
- *
- *
- *
- */
+// Functions which handle calendar objects and their processing/display.
+//
+// Copyright (c) 1996-2022 by the citadel.org team
+//
+// 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.
#include "webcit.h"
-#include "webserver.h"
+
#include "calendar.h"
-/*
- * Process a calendar object. At this point it's already been deserialized by cal_process_attachment()
- *
- * cal: the calendar object
- * recursion_level: Number of times we've recursed into this function
- * msgnum: Message number on the Citadel server
- * cal_partnum: MIME part number within that message containing the calendar object
- */
+// Process a calendar object. At this point it's already been deserialized by cal_process_attachment()
+//
+// cal: the calendar object
+// recursion_level: Number of times we've recursed into this function
+// msgnum: Message number on the Citadel server
+// cal_partnum: MIME part number within that message containing the calendar object
void cal_process_object(StrBuf *Target,
icalcomponent *cal,
int recursion_level,
@@ -52,24 +42,23 @@ void cal_process_object(StrBuf *Target,
sprintf(divname, "rsvp%04x", ++divcount);
- /* Convert timezones to something easy to display.
- * It's safe to do this in memory because we're only changing it on the
- * display side -- when we tell the server to do something with the object,
- * the server will be working with its original copy in the database.
- */
+ // Convert timezones to something easy to display.
+ // It's safe to do this in memory because we're only changing it on the
+ // display side -- when we tell the server to do something with the object,
+ // the server will be working with its original copy in the database.
if ((cal) && (recursion_level == 0)) {
ical_dezonify(cal);
}
- /* Leading HTML for the display of this object */
+ // Leading HTML for the display of this object
if (recursion_level == 0) {
StrBufAppendPrintf(Target, "
\n");
}
- /* Look for a method */
+ // Look for a method
method = icalcomponent_get_first_property(cal, ICAL_METHOD_PROPERTY);
- /* See what we need to do with this */
+ // See what we need to do with this
if (method != NULL) {
char *title;
the_method = icalproperty_get_method(method);
@@ -116,10 +105,8 @@ void cal_process_object(StrBuf *Target,
StrBufAppendPrintf(Target, "\n");
}
- /*
- * Only show start/end times if we're actually looking at the VEVENT
- * component. Otherwise it shows bogus dates for things like timezone.
- */
+ // Only show start/end times if we're actually looking at the VEVENT
+ // component. Otherwise it shows bogus dates for things like timezone.
if (icalcomponent_isa(cal) == ICAL_VEVENT_COMPONENT) {
p = icalcomponent_get_first_property(cal, ICAL_DTSTART_PROPERTY);
@@ -169,14 +156,14 @@ void cal_process_object(StrBuf *Target,
}
if (icalcomponent_get_first_property(cal, ICAL_RRULE_PROPERTY)) {
- /* Unusual string syntax used here in order to re-use existing translations */
+ // Unusual string syntax used here in order to re-use existing translations
StrBufAppendPrintf(Target, "
%s:%s.\n",
_("Recurrence"),
_("This is a recurring event")
);
}
- /* If the component has attendees, iterate through them. */
+ // If the component has attendees, iterate through them.
for (p = icalcomponent_get_first_property(cal, ICAL_ATTENDEE_PROPERTY);
(p != NULL);
p = icalcomponent_get_next_property(cal, ICAL_ATTENDEE_PROPERTY)) {
@@ -184,34 +171,35 @@ void cal_process_object(StrBuf *Target,
StrBufAppendPrintf(Target, _("Attendee:"));
StrBufAppendPrintf(Target, "
");
ch = icalproperty_get_attendee(p);
- if ((ch != NULL) && !strncasecmp(buf, "MAILTO:", 7)) {
+ if ((ch != NULL) && !strncasecmp(ch, "MAILTO:", 7)) {
- /** screen name or email address */
+ // screen name or email address
safestrncpy(buf, ch + 7, sizeof(buf));
- striplt(buf);
+ string_trim(buf);
StrEscAppend(Target, NULL, buf, 0, 0);
StrBufAppendPrintf(Target, " ");
- /** participant status */
+ // participant status
partstat_as_string(buf, p);
StrEscAppend(Target, NULL, buf, 0, 0);
}
StrBufAppendPrintf(Target, "\n");
}
- /* If the component has subcomponents, recurse through them. */
+ // If the component has subcomponents, recurse through them.
for (c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
- (c != 0);
- c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)) {
- /* Recursively process subcomponent */
+ (c != 0);
+ c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)
+ ) {
+ // Recursively process subcomponent
cal_process_object(Target, c, recursion_level+1, msgnum, cal_partnum);
}
- /* If this is a REQUEST, display conflicts and buttons */
+ // If this is a REQUEST, display conflicts and buttons
if (the_method == ICAL_METHOD_REQUEST) {
- /* Check for conflicts */
- syslog(9, "Checking server calendar for conflicts...\n");
+ // Check for conflicts
+ syslog(LOG_DEBUG, "Checking server calendar for conflicts...");
serv_printf("ICAL conflicts|%ld|%s|", msgnum, cal_partnum);
serv_getln(buf, sizeof buf);
if (buf[0] == '1') {
@@ -239,11 +227,11 @@ void cal_process_object(StrBuf *Target,
StrBufAppendPrintf(Target, "\n");
}
}
- syslog(9, "...done.\n");
+ syslog(LOG_DEBUG, "...done.\n");
StrBufAppendPrintf(Target, "");
- /* Display the Accept/Decline buttons */
+ // Display the Accept/Decline buttons
StrBufAppendPrintf(Target, "
"
"%s "
" "
@@ -262,10 +250,10 @@ void cal_process_object(StrBuf *Target,
}
- /* If this is a REPLY, display update button */
+ // If this is a REPLY, display update button
if (the_method == ICAL_METHOD_REPLY) {
- /* Display the update buttons */
+ // Display the update buttons
StrBufAppendPrintf(Target, ""
"%s "
" "
@@ -281,18 +269,15 @@ void cal_process_object(StrBuf *Target,
}
- /* Trailing HTML for the display of this object */
+ // Trailing HTML for the display of this object
if (recursion_level == 0) {
StrBufAppendPrintf(Target, "
\n");
}
}
-/*
- * Deserialize a calendar object in a message so it can be displayed.
- */
-void cal_process_attachment(wc_mime_attachment *Mime)
-{
+// Deserialize a calendar object in a message so it can be displayed.
+void cal_process_attachment(wc_mime_attachment *Mime) {
icalcomponent *cal;
cal = icalcomponent_new_from_string(ChrPtr(Mime->Data));
@@ -305,18 +290,13 @@ void cal_process_attachment(wc_mime_attachment *Mime)
cal_process_object(Mime->Data, cal, 0, Mime->msgnum, ChrPtr(Mime->PartNum));
- /* Free the memory we obtained from libical's constructor */
+ // Free the memory we obtained from libical's constructor
icalcomponent_free(cal);
}
-
-
-/*
- * Respond to a meeting request - accept/decline meeting
- */
-void respond_to_request(void)
-{
+// Respond to a meeting request - accept/decline meeting
+void respond_to_request(void) {
char buf[1024];
begin_ajax_response();
@@ -334,11 +314,13 @@ void respond_to_request(void)
wc_printf(_("You have accepted this meeting invitation. "
"It has been entered into your calendar.")
);
- } else if (!strcasecmp(bstr("sc"), "tentative")) {
+ }
+ else if (!strcasecmp(bstr("sc"), "tentative")) {
wc_printf(_("You have tentatively accepted this meeting invitation. "
"It has been 'pencilled in' to your calendar.")
);
- } else if (!strcasecmp(bstr("sc"), "decline")) {
+ }
+ else if (!strcasecmp(bstr("sc"), "decline")) {
wc_printf(_("You have declined this meeting invitation. "
"It has