Seeing this code has really brought me back to the upstairs room
in my old house where I wrote most of it back in 2002-2003. I can
see the sunlight coming in the windows, the color of the carpet,
the little alcove where the computer was, the cat sleeping on top
of the big CRT monitor.
Hopefully the stuff I need to add to it now will be straightforward
since it looks like I really took my time and commented it heavily.
It looks pretty clean, especially now that I've reformatted it with
the new screen width an C99 comments. It does seem a bit WET though.
syslog(LOG_DEBUG, "calendar: <%d> attendees: <%s>", num_attendees, attendees_string);
syslog(LOG_DEBUG, "calendar: <%d> attendees: <%s>", num_attendees, attendees_string);
- /* If there are no attendees, there are no invitations to send, so...
- * don't bother putting one together! Punch out, Maverick!
- */
+ // If there are no attendees, there are no invitations to send, so...
+ // don't bother putting one together! Punch out, Maverick!
if (num_attendees == 0) {
icalcomponent_free(the_request);
return;
if (num_attendees == 0) {
icalcomponent_free(the_request);
return;
-/*
- * When a calendar object is being saved, determine whether it's a VEVENT
- * and the user saving it is the organizer. If so, send out invitations
- * to any listed attendees.
- *
- * This function is recursive. The caller can simply supply the same object
- * as both arguments. When it recurses it will alter the second argument
- * while holding on to the top level object. This allows us to go back and
- * grab things like time zones which might be attached.
- *
- */
+// When a calendar object is being saved, determine whether it's a VEVENT
+// and the user saving it is the organizer. If so, send out invitations
+// to any listed attendees.
+//
+// This function is recursive. The caller can simply supply the same object
+// as both arguments. When it recurses it will alter the second argument
+// while holding on to the top level object. This allows us to go back and
+// grab things like time zones which might be attached.
void ical_saving_vevent(icalcomponent *top_level_cal, icalcomponent *cal) {
icalcomponent *c;
icalproperty *organizer = NULL;
void ical_saving_vevent(icalcomponent *top_level_cal, icalcomponent *cal) {
icalcomponent *c;
icalproperty *organizer = NULL;
}
strcpy(organizer_string, "");
}
strcpy(organizer_string, "");
- /*
- * The VEVENT subcomponent is the one we're interested in.
- * Send out invitations if, and only if, this user is the Organizer.
- */
+ // The VEVENT subcomponent is the one we're interested in.
+ // Send out invitations if, and only if, this user is the Organizer.
if (icalcomponent_isa(cal) == ICAL_VEVENT_COMPONENT) {
organizer = icalcomponent_get_first_property(cal, ICAL_ORGANIZER_PROPERTY);
if (organizer != NULL) {
if (icalcomponent_isa(cal) == ICAL_VEVENT_COMPONENT) {
organizer = icalcomponent_get_first_property(cal, ICAL_ORGANIZER_PROPERTY);
if (organizer != NULL) {
if (!strncasecmp(organizer_string, "MAILTO:", 7)) {
strcpy(organizer_string, &organizer_string[7]);
string_trim(organizer_string);
if (!strncasecmp(organizer_string, "MAILTO:", 7)) {
strcpy(organizer_string, &organizer_string[7]);
string_trim(organizer_string);
- /*
- * If the user saving the event is listed as the
- * organizer, then send out invitations.
- */
+ // If the user saving the event is listed as the
+ // organizer, then send out invitations.
if (CtdlIsMe(organizer_string, sizeof organizer_string)) {
ical_send_out_invitations(top_level_cal, cal);
}
if (CtdlIsMe(organizer_string, sizeof organizer_string)) {
ical_send_out_invitations(top_level_cal, cal);
}
-/*
- * Back end for ical_obj_beforesave()
- * This hunts for the UID of the calendar event (becomes Citadel msg EUID),
- * the summary of the event (becomes message subject),
- * and the start time (becomes message date/time).
- */
+// Back end for ical_obj_beforesave()
+// This hunts for the UID of the calendar event (becomes Citadel msg EUID),
+// the summary of the event (becomes message subject),
+// and the start time (becomes message date/time).
void ical_obj_beforesave_backend(char *name, char *filename, char *partnum,
char *disp, void *content, char *cbtype, char *cbcharset, size_t length,
char *encoding, char *cbid, void *cbuserdata)
void ical_obj_beforesave_backend(char *name, char *filename, char *partnum,
char *disp, void *content, char *cbtype, char *cbcharset, size_t length,
char *encoding, char *cbid, void *cbuserdata)
-/*
- * See if we need to prevent the object from being saved (we don't allow
- * MIME types other than text/calendar in "calendar" or "tasks" rooms).
- *
- * If the message is being saved, we also set various message header fields
- * using data found in the iCalendar object.
- */
+// See if we need to prevent the object from being saved (we don't allow
+// MIME types other than text/calendar in "calendar" or "tasks" rooms).
+//
+// If the message is being saved, we also set various message header fields
+// using data found in the iCalendar object.
int ical_obj_beforesave(struct CtdlMessage *msg, struct recptypes *recp) {
// First determine if this is a calendar or tasks room
if ( (CC->room.QRdefaultview != VIEW_CALENDAR)
int ical_obj_beforesave(struct CtdlMessage *msg, struct recptypes *recp) {
// First determine if this is a calendar or tasks room
if ( (CC->room.QRdefaultview != VIEW_CALENDAR)
-/*
- * Things we need to do after saving a calendar event.
- */
+// Things we need to do after saving a calendar event.
void ical_obj_aftersave_backend(char *name, char *filename, char *partnum,
char *disp, void *content, char *cbtype, char *cbcharset, size_t length,
char *encoding, char *cbid, void *cbuserdata)
void ical_obj_aftersave_backend(char *name, char *filename, char *partnum,
char *disp, void *content, char *cbtype, char *cbcharset, size_t length,
char *encoding, char *cbid, void *cbuserdata)
- /* Hunt for the UID and drop it in
- * the "user data" pointer for the MIME parser. When
- * ical_obj_beforesave() sees it there, it'll set the Exclusive msgid
- * to that string.
- */
+ // Hunt for the UID and drop it in
+ // the "user data" pointer for the MIME parser. When
+ // ical_obj_beforesave() sees it there, it'll set the Exclusive msgid
+ // to that string.
if ( (!strcasecmp(cbtype, "text/calendar"))
|| (!strcasecmp(cbtype, "application/ics"))
) {
if ( (!strcasecmp(cbtype, "text/calendar"))
|| (!strcasecmp(cbtype, "application/ics"))
) {
-/*
- * Things we need to do after saving a calendar event.
- * (This will start back end tasks such as automatic generation of invitations,
- * if such actions are appropriate.)
- */
+// Things we need to do after saving a calendar event.
+// (This will start back end tasks such as automatic generation of invitations,
+// if such actions are appropriate.)
int ical_obj_aftersave(struct CtdlMessage *msg, struct recptypes *recp) {
char roomname[ROOMNAMELEN];
int ical_obj_aftersave(struct CtdlMessage *msg, struct recptypes *recp) {
char roomname[ROOMNAMELEN];
- /*
- * If this isn't the Calendar> room, no further action is necessary.
- */
+ // If this isn't the Calendar> room, no further action is necessary.
// First determine if this is our room
CtdlMailboxName(roomname, sizeof roomname, &CC->user, USERCALENDARROOM);
// First determine if this is our room
CtdlMailboxName(roomname, sizeof roomname, &CC->user, USERCALENDARROOM);