From 795e78fade04b38642625edaac699585626ea927 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 5 Jan 2024 10:33:17 -0500 Subject: [PATCH] serv_calendar.c: more formatting changes --- .../server/modules/calendar/serv_calendar.c | 368 +++++++++--------- 1 file changed, 178 insertions(+), 190 deletions(-) diff --git a/citadel/server/modules/calendar/serv_calendar.c b/citadel/server/modules/calendar/serv_calendar.c index a02426cba..e963b6d6e 100644 --- a/citadel/server/modules/calendar/serv_calendar.c +++ b/citadel/server/modules/calendar/serv_calendar.c @@ -480,12 +480,14 @@ void ical_merge_attendee_reply(icalcomponent *event, icalcomponent *reply) { // Iterate through the attendees looking for a match. STARTOVER: for (e_attendee = icalcomponent_get_first_property(event, ICAL_ATTENDEE_PROPERTY); - e_attendee != NULL; - e_attendee = icalcomponent_get_next_property(event, ICAL_ATTENDEE_PROPERTY)) { + e_attendee != NULL; + e_attendee = icalcomponent_get_next_property(event, ICAL_ATTENDEE_PROPERTY) + ) { for (r_attendee = icalcomponent_get_first_property(reply, ICAL_ATTENDEE_PROPERTY); - r_attendee != NULL; - r_attendee = icalcomponent_get_next_property(reply, ICAL_ATTENDEE_PROPERTY)) { + r_attendee != NULL; + r_attendee = icalcomponent_get_next_property(reply, ICAL_ATTENDEE_PROPERTY) + ) { // Check to see if these two attendees match... const char *e, *r; @@ -763,46 +765,43 @@ int ical_ctdl_is_overlap( } } - /* First, check for all-day events */ + // First, check for all-day events if (t1start.is_date || t2start.is_date) { - /* If event 1 ends before event 2 starts, we're in the clear. */ + // If event 1 ends before event 2 starts, we're in the clear. if (icaltime_compare_date_only(t1end, t2start) < 0) return(0); - /* If event 2 ends before event 1 starts, we're also ok. */ + // If event 2 ends before event 1 starts, we're also ok. if (icaltime_compare_date_only(t2end, t1start) < 0) return(0); return(1); } - /* syslog(LOG_DEBUG, "Comparing t1start %d:%d t1end %d:%d t2start %d:%d t2end %d:%d", - t1start.hour, t1start.minute, t1end.hour, t1end.minute, - t2start.hour, t2start.minute, t2end.hour, t2end.minute); - */ + // syslog(LOG_DEBUG, "Comparing t1start %d:%d t1end %d:%d t2start %d:%d t2end %d:%d", + // t1start.hour, t1start.minute, t1end.hour, t1end.minute, + // t2start.hour, t2start.minute, t2end.hour, t2end.minute); - /* Now check for overlaps using date *and* time. */ + // Now check for overlaps using date *and* time. - /* If event 1 ends before event 2 starts, we're in the clear. */ + // If event 1 ends before event 2 starts, we're in the clear. if (icaltime_compare(t1end, t2start) <= 0) return(0); - /* syslog(LOG_DEBUG, "calendar: first passed"); */ + // syslog(LOG_DEBUG, "calendar: first passed"); - /* If event 2 ends before event 1 starts, we're also ok. */ + // If event 2 ends before event 1 starts, we're also ok. if (icaltime_compare(t2end, t1start) <= 0) return(0); - /* syslog(LOG_DEBUG, "calendar: second passed"); */ + // syslog(LOG_DEBUG, "calendar: second passed"); - /* Otherwise, they overlap. */ + // Otherwise, they overlap. return(1); } -/* - * Phase 6 of "hunt for conflicts" - * called by ical_conflicts_phase5() - * - * Now both the proposed and existing events have been boiled down to start and end times. - * Check for overlap and output any conflicts. - * - * Returns nonzero if a conflict was reported. This allows the caller to stop iterating. - */ +// Phase 6 of "hunt for conflicts" +// called by ical_conflicts_phase5() +// +// Now both the proposed and existing events have been boiled down to start and end times. +// Check for overlap and output any conflicts. +// +// Returns nonzero if a conflict was reported. This allows the caller to stop iterating. int ical_conflicts_phase6(struct icaltimetype t1start, struct icaltimetype t1end, struct icaltimetype t2start, @@ -826,7 +825,7 @@ int ical_conflicts_phase6(struct icaltimetype t1start, // syslog(LOG_DEBUG, " EXISTING END: %s", ctime(&tt)); // debugging cruft - /* compare and output */ + // compare and output if (ical_ctdl_is_overlap(t1start, t1end, t2start, t2end)) { cprintf("%ld||%s|%s|%d|\n", @@ -861,20 +860,20 @@ void ical_conflicts_phase5(struct icaltimetype t1start, struct icaltimetype t2start, t2end; icalproperty *p; - /* recur variables */ + // recur variables icalproperty *rrule = NULL; struct icalrecurrencetype recur; icalrecur_iterator *ritr = NULL; struct icaldurationtype dur; int num_recur = 0; - /* initialization */ + // initialization strcpy(conflict_event_uid, ""); strcpy(conflict_event_summary, ""); t2start = icaltime_null_time(); t2end = icaltime_null_time(); - /* existing event stuff */ + // existing event stuff p = ical_ctdl_get_subprop(existing_event, ICAL_DTSTART_PROPERTY); if (p == NULL) return; if (p != NULL) t2start = icalproperty_get_dtstart(p); @@ -931,9 +930,8 @@ void ical_conflicts_phase5(struct icaltimetype t1start, } if (ical_conflicts_phase6(t1start, t1end, t2start, t2end, - existing_msgnum, conflict_event_uid, conflict_event_summary, compare_uid)) - { - num_recur = MAX_RECUR + 1; /* force it out of scope, no need to continue */ + existing_msgnum, conflict_event_uid, conflict_event_summary, compare_uid)) { + num_recur = MAX_RECUR + 1; // force it out of scope, no need to continue } if (rrule) { @@ -947,7 +945,7 @@ void ical_conflicts_phase5(struct icaltimetype t1start, } if (icaltime_compare(t2start, t1end) < 0) { - num_recur = MAX_RECUR + 1; /* force it out of scope */ + num_recur = MAX_RECUR + 1; // force it out of scope } } while ( (rrule) && (!icaltime_is_null_time(t2start)) && (num_recur < MAX_RECUR) ); @@ -955,13 +953,11 @@ void ical_conflicts_phase5(struct icaltimetype t1start, } -/* - * Phase 4 of "hunt for conflicts" - * Called by ical_hunt_for_conflicts_backend() - * - * At this point we've got it boiled down to two icalcomponent events in memory. - * If they conflict, output something to the client. - */ +// Phase 4 of "hunt for conflicts" +// Called by ical_hunt_for_conflicts_backend() +// +// At this point we've got it boiled down to two icalcomponent events in memory. +// If they conflict, output something to the client. void ical_conflicts_phase4(icalcomponent *proposed_event, icalcomponent *existing_event, long existing_msgnum) @@ -970,18 +966,18 @@ void ical_conflicts_phase4(icalcomponent *proposed_event, icalproperty *p; char compare_uid[SIZ]; - /* recur variables */ + // recur variables icalproperty *rrule = NULL; struct icalrecurrencetype recur; icalrecur_iterator *ritr = NULL; struct icaldurationtype dur; int num_recur = 0; - /* initialization */ + // initialization t1end = icaltime_null_time(); *compare_uid = '\0'; - /* proposed event stuff */ + // proposed event stuff p = ical_ctdl_get_subprop(proposed_event, ICAL_DTSTART_PROPERTY); if (p == NULL) @@ -1056,10 +1052,8 @@ void ical_conflicts_phase4(icalcomponent *proposed_event, } -/* - * Phase 3 of "hunt for conflicts" - * Called by ical_hunt_for_conflicts() - */ +// Phase 3 of "hunt for conflicts" +// Called by ical_hunt_for_conflicts() void ical_hunt_for_conflicts_backend(long msgnum, void *data) { icalcomponent *proposed_event; struct CtdlMessage *msg = NULL; @@ -1087,17 +1081,15 @@ void ical_hunt_for_conflicts_backend(long msgnum, void *data) { } -/* - * Phase 2 of "hunt for conflicts" operation. - * At this point we have a calendar object which represents the VEVENT that - * is proposed for addition to the calendar. Now hunt through the user's - * calendar room, and output zero or more existing VEVENTs which conflict - * with this one. - */ +// Phase 2 of "hunt for conflicts" operation. +// At this point we have a calendar object which represents the VEVENT that +// is proposed for addition to the calendar. Now hunt through the user's +// calendar room, and output zero or more existing VEVENTs which conflict +// with this one. void ical_hunt_for_conflicts(icalcomponent *cal) { char hold_rm[ROOMNAMELEN]; - strcpy(hold_rm, CC->room.QRname); /* save current room */ + strcpy(hold_rm, CC->room.QRname); // save current room if (CtdlGetRoom(&CC->room, USERCALENDARROOM) != 0) { CtdlGetRoom(&CC->room, hold_rm); @@ -1115,7 +1107,7 @@ void ical_hunt_for_conflicts(icalcomponent *cal) { ); cprintf("000\n"); - CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */ + CtdlGetRoom(&CC->room, hold_rm); // return to saved room } @@ -1138,12 +1130,14 @@ void ical_conflicts(long msgnum, char *partnum) { memset(&ird, 0, sizeof ird); strcpy(ird.desired_partnum, partnum); - mime_parser(CM_RANGE(msg, eMessageText), - *ical_locate_part, /* callback function */ - NULL, NULL, - (void *) &ird, /* user data */ - 0 - ); + mime_parser( + CM_RANGE(msg, eMessageText), + *ical_locate_part, // callback function + NULL, + NULL, + (void *) &ird, // user data + 0 + ); CM_Free(msg); @@ -1157,12 +1151,10 @@ void ical_conflicts(long msgnum, char *partnum) { } -/* - * Look for busy time in a VEVENT and add it to the supplied VFREEBUSY. - * - * fb The VFREEBUSY component to which we are appending - * top_level_cal The top-level VCALENDAR component which contains a VEVENT to be added - */ +// Look for busy time in a VEVENT and add it to the supplied VFREEBUSY. +// +// fb The VFREEBUSY component to which we are appending +// top_level_cal The top-level VCALENDAR component which contains a VEVENT to be added void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal) { icalcomponent *cal; icalproperty *p; @@ -1171,7 +1163,7 @@ void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal) { icaltimetype dtstart; icaltimetype dtend; - /* recur variables */ + // recur variables icalproperty *rrule = NULL; struct icalrecurrencetype recur; icalrecur_iterator *ritr = NULL; @@ -1180,13 +1172,12 @@ void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal) { if (!top_level_cal) return; - /* Find the VEVENT component containing an event */ + // Find the VEVENT component containing an event cal = icalcomponent_get_first_component(top_level_cal, ICAL_VEVENT_COMPONENT); if (!cal) return; - /* If this event is not opaque, the user isn't publishing it as - * busy time, so don't bother doing anything else. - */ + // If this event is not opaque, the user isn't publishing it as + // busy time, so don't bother doing anything else. p = icalcomponent_get_first_property(cal, ICAL_TRANSP_PROPERTY); if (p != NULL) { v = icalproperty_get_value(p); @@ -1197,9 +1188,7 @@ void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal) { } } - /* - * Now begin calculating the event start and end times. - */ + // Now begin calculating the event start and end times. p = icalcomponent_get_first_property(cal, ICAL_DTSTART_PROPERTY); if (!p) return; dtstart = icalproperty_get_dtstart(p); @@ -1226,7 +1215,7 @@ void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal) { memset (&dur, 0, sizeof(struct icaldurationtype)); } - /* Is a recurrence specified? If so, get ready to process it... */ + // Is a recurrence specified? If so, get ready to process it... rrule = ical_ctdl_get_subprop(cal, ICAL_RRULE_PROPERTY); if (rrule) { recur = icalproperty_get_rrule(rrule); @@ -1234,16 +1223,15 @@ void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal) { } do { - /* Convert the DTSTART and DTEND properties to an icalperiod. */ + // Convert the DTSTART and DTEND properties to an icalperiod. this_event_period.start = dtstart; if (!icaltime_is_null_time(dtend)) { this_event_period.end = dtend; } - /* Convert the timestamps to UTC. It's ok to do this because we've already expanded - * recurrences and this data is never going to get used again. - */ + // Convert the timestamps to UTC. It's ok to do this because we've already expanded + // recurrences and this data is never going to get used again. this_event_period.start = icaltime_convert_to_zone( this_event_period.start, icaltimezone_get_utc_timezone() @@ -1253,12 +1241,11 @@ void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal) { icaltimezone_get_utc_timezone() ); - /* Now add it. */ + // Now add it. icalcomponent_add_property(fb, icalproperty_new_freebusy(this_event_period)); - /* Make sure the DTSTART property of the freebusy *list* is set to - * the DTSTART property of the *earliest event*. - */ + // Make sure the DTSTART property of the freebusy *list* is set to + // the DTSTART property of the *earliest event*. p = icalcomponent_get_first_property(fb, ICAL_DTSTART_PROPERTY); if (p == NULL) { icalcomponent_set_dtstart(fb, this_event_period.start); @@ -1269,9 +1256,8 @@ void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal) { } } - /* Make sure the DTEND property of the freebusy *list* is set to - * the DTEND property of the *latest event*. - */ + // Make sure the DTEND property of the freebusy *list* is set to + // the DTEND property of the *latest event*. p = icalcomponent_get_first_property(fb, ICAL_DTEND_PROPERTY); if (p == NULL) { icalcomponent_set_dtend(fb, this_event_period.end); @@ -1309,30 +1295,30 @@ void ical_freebusy_backend(long msgnum, void *data) { struct CtdlMessage *msg = NULL; struct ical_respond_data ird; - fb = (icalcomponent *)data; /* User-supplied data will be the VFREEBUSY component */ + fb = (icalcomponent *)data; // User-supplied data will be the VFREEBUSY component msg = CtdlFetchMessage(msgnum, 1); if (msg == NULL) return; memset(&ird, 0, sizeof ird); strcpy(ird.desired_partnum, "_HUNT_"); - mime_parser(CM_RANGE(msg, eMessageText), - *ical_locate_part, /* callback function */ - NULL, NULL, - (void *) &ird, /* user data */ - 0 - ); + mime_parser( + CM_RANGE(msg, eMessageText), + *ical_locate_part, // callback function + NULL, + NULL, + (void *) &ird, // user data + 0 + ); CM_Free(msg); if (ird.cal) { - ical_add_to_freebusy(fb, ird.cal); /* Add VEVENT times to VFREEBUSY */ + ical_add_to_freebusy(fb, ird.cal); // Add VEVENT times to VFREEBUSY icalcomponent_free(ird.cal); } } -/* - * Grab another user's free/busy times - */ +// Grab another user's free/busy times void ical_freebusy(char *who) { struct ctdluser usbuf; char calendar_room_name[ROOMNAMELEN]; @@ -1348,10 +1334,10 @@ void ical_freebusy(char *who) { int i = 0; int config_lines = 0; - /* First try an exact match. */ + // First try an exact match. found_user = CtdlGetUser(&usbuf, who); - /* If not found, try it as an unqualified email address. */ + // If not found, try it as an unqualified email address. if (found_user != 0) { strcpy(buf, who); recp = validate_recipients(buf, NULL, 0); @@ -1364,9 +1350,7 @@ void ical_freebusy(char *who) { } } - /* If still not found, try it as an address qualified with the - * primary FQDN of this Citadel node. - */ + // If still not found, try it as an address qualified with the primary FQDN of this Citadel node. if (found_user != 0) { snprintf(buf, sizeof buf, "%s@%s", who, CtdlGetConfigStr("c_fqdn")); syslog(LOG_DEBUG, "calendar: trying <%s>", buf); @@ -1379,9 +1363,7 @@ void ical_freebusy(char *who) { } } - /* Still not found? Try qualifying it with every domain we - * might have addresses in. - */ + // Still not found? Try qualifying it with every domain we might have addresses in. if (found_user != 0) { config_lines = num_tokens(inetcfg, '\n'); for (i=0; ((i < config_lines) && (found_user != 0)); ++i) { @@ -1389,8 +1371,9 @@ void ical_freebusy(char *who) { extract_token(host, buf, 0, '|', sizeof host); extract_token(type, buf, 1, '|', sizeof type); - if ( (!strcasecmp(type, "localhost")) - || (!strcasecmp(type, "directory")) ) { + if ( (!strcasecmp(type, "localhost")) + || (!strcasecmp(type, "directory")) + ) { snprintf(buf, sizeof buf, "%s@%s", who, host); syslog(LOG_DEBUG, "calendar: trying <%s>", buf); recp = validate_recipients(buf, NULL, 0); @@ -1409,10 +1392,9 @@ void ical_freebusy(char *who) { return; } - CtdlMailboxName(calendar_room_name, sizeof calendar_room_name, - &usbuf, USERCALENDARROOM); + CtdlMailboxName(calendar_room_name, sizeof calendar_room_name, &usbuf, USERCALENDARROOM); - strcpy(hold_rm, CC->room.QRname); /* save current room */ + strcpy(hold_rm, CC->room.QRname); // save current room if (CtdlGetRoom(&CC->room, calendar_room_name) != 0) { cprintf("%d Cannot open calendar\n", ERROR + ROOM_NOT_FOUND); @@ -1420,7 +1402,7 @@ void ical_freebusy(char *who) { return; } - /* Create a VFREEBUSY subcomponent */ + // Create a VFREEBUSY subcomponent syslog(LOG_DEBUG, "calendar: creating VFREEBUSY component"); fb = icalcomponent_new_vfreebusy(); if (fb == NULL) { @@ -1429,13 +1411,13 @@ void ical_freebusy(char *who) { return; } - /* Set the method to PUBLISH */ + // Set the method to PUBLISH icalcomponent_set_method(fb, ICAL_METHOD_PUBLISH); - /* Set the DTSTAMP to right now. */ + // Set the DTSTAMP to right now. icalcomponent_set_dtstamp(fb, icaltime_from_timet_with_zone(time(NULL), 0, icaltimezone_get_utc_timezone())); - /* Add the user's email address as ORGANIZER */ + // Add the user's email address as ORGANIZER sprintf(buf, "MAILTO:%s", who); if (strchr(buf, '@') == NULL) { strcat(buf, "@"); @@ -1446,13 +1428,12 @@ void ical_freebusy(char *who) { } icalcomponent_add_property(fb, icalproperty_new_organizer(buf)); - /* Add busy time from events */ + // Add busy time from events syslog(LOG_DEBUG, "calendar: adding busy time from events"); CtdlForEachMessage(MSGS_ALL, 0, NULL, NULL, NULL, ical_freebusy_backend, (void *)fb ); - /* If values for DTSTART and DTEND are still not present, set them - * to yesterday and tomorrow as default values. - */ + // If values for DTSTART and DTEND are still not present, set them + // to yesterday and tomorrow as default values. if (icalcomponent_get_first_property(fb, ICAL_DTSTART_PROPERTY) == NULL) { icalcomponent_set_dtstart(fb, icaltime_from_timet_with_zone(time(NULL)-86400L, 0, icaltimezone_get_utc_timezone())); } @@ -1460,7 +1441,7 @@ void ical_freebusy(char *who) { icalcomponent_set_dtend(fb, icaltime_from_timet_with_zone(time(NULL)+86400L, 0, icaltimezone_get_utc_timezone())); } - /* Put the freebusy component into the calendar component */ + // Put the freebusy component into the calendar component syslog(LOG_DEBUG, "calendar: encapsulating"); encaps = ical_encapsulate_subcomponent(fb); if (encaps == NULL) { @@ -1471,14 +1452,14 @@ void ical_freebusy(char *who) { return; } - /* Set the method to PUBLISH */ + // Set the method to PUBLISH syslog(LOG_DEBUG, "calendar: setting method"); icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH); - /* Serialize it */ + // Serialize it syslog(LOG_DEBUG, "calendar: serializing"); serialized_request = icalcomponent_as_ical_string_r(encaps); - icalcomponent_free(encaps); /* Don't need this anymore. */ + icalcomponent_free(encaps); // Don't need this anymore. cprintf("%d Free/busy for %s\n", LISTING_FOLLOWS, usbuf.fullname); if (serialized_request != NULL) { @@ -1487,7 +1468,7 @@ void ical_freebusy(char *who) { } cprintf("\n000\n"); - /* Go back to the room from which we came... */ + // Go back to the room from which we came... CtdlGetRoom(&CC->room, hold_rm); } @@ -1512,11 +1493,13 @@ void ical_getics_backend(long msgnum, void *data) { if (msg == NULL) return; memset(&ird, 0, sizeof ird); strcpy(ird.desired_partnum, "_HUNT_"); - mime_parser(CM_RANGE(msg, eMessageText), - *ical_locate_part, /* callback function */ - NULL, NULL, - (void *) &ird, /* user data */ - 0 + mime_parser( + CM_RANGE(msg, eMessageText), + *ical_locate_part, /* callback function */ + NULL, + NULL, + (void *) &ird, /* user data */ + 0 ); CM_Free(msg); @@ -1539,8 +1522,9 @@ void ical_getics_backend(long msgnum, void *data) { */ else { for (c = icalcomponent_get_first_component(ird.cal, ICAL_ANY_COMPONENT); - (c != NULL); - c = icalcomponent_get_next_component(ird.cal, ICAL_ANY_COMPONENT)) { + (c != NULL); + c = icalcomponent_get_next_component(ird.cal, ICAL_ANY_COMPONENT) + ) { /* For VTIMEZONE components, suppress duplicates of the same tzid */ @@ -1688,8 +1672,9 @@ void ical_putics(void) { /* Non-VTIMEZONE components each get written as individual messages. * But we also need to attach the relevant VTIMEZONE components to them. */ - if ( (icalcomponent_isa(c) != ICAL_VTIMEZONE_COMPONENT) - && (encaps = icalcomponent_new_vcalendar()) ) { + if ( (icalcomponent_isa(c) != ICAL_VTIMEZONE_COMPONENT) + && (encaps = icalcomponent_new_vcalendar()) + ) { icalcomponent_add_property(encaps, icalproperty_new_prodid(PRODID)); icalcomponent_add_property(encaps, icalproperty_new_version("2.0")); icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH); @@ -1985,22 +1970,22 @@ void ical_send_out_invitations(icalcomponent *top_level_cal, icalcomponent *cal) /* Look for properties containing timezone parameters, to see if we need to attach VTIMEZONEs */ for (p = icalcomponent_get_first_property(the_request, ICAL_ANY_PROPERTY); - p != NULL; - p = icalcomponent_get_next_property(the_request, ICAL_ANY_PROPERTY)) - { - if ( (icalproperty_isa(p) == ICAL_COMPLETED_PROPERTY) - || (icalproperty_isa(p) == ICAL_CREATED_PROPERTY) - || (icalproperty_isa(p) == ICAL_DATEMAX_PROPERTY) - || (icalproperty_isa(p) == ICAL_DATEMIN_PROPERTY) - || (icalproperty_isa(p) == ICAL_DTEND_PROPERTY) - || (icalproperty_isa(p) == ICAL_DTSTAMP_PROPERTY) - || (icalproperty_isa(p) == ICAL_DTSTART_PROPERTY) - || (icalproperty_isa(p) == ICAL_DUE_PROPERTY) - || (icalproperty_isa(p) == ICAL_EXDATE_PROPERTY) - || (icalproperty_isa(p) == ICAL_LASTMODIFIED_PROPERTY) - || (icalproperty_isa(p) == ICAL_MAXDATE_PROPERTY) - || (icalproperty_isa(p) == ICAL_MINDATE_PROPERTY) - || (icalproperty_isa(p) == ICAL_RECURRENCEID_PROPERTY) + p != NULL; + p = icalcomponent_get_next_property(the_request, ICAL_ANY_PROPERTY) + ) { + if ( (icalproperty_isa(p) == ICAL_COMPLETED_PROPERTY) + || (icalproperty_isa(p) == ICAL_CREATED_PROPERTY) + || (icalproperty_isa(p) == ICAL_DATEMAX_PROPERTY) + || (icalproperty_isa(p) == ICAL_DATEMIN_PROPERTY) + || (icalproperty_isa(p) == ICAL_DTEND_PROPERTY) + || (icalproperty_isa(p) == ICAL_DTSTAMP_PROPERTY) + || (icalproperty_isa(p) == ICAL_DTSTART_PROPERTY) + || (icalproperty_isa(p) == ICAL_DUE_PROPERTY) + || (icalproperty_isa(p) == ICAL_EXDATE_PROPERTY) + || (icalproperty_isa(p) == ICAL_LASTMODIFIED_PROPERTY) + || (icalproperty_isa(p) == ICAL_MAXDATE_PROPERTY) + || (icalproperty_isa(p) == ICAL_MINDATE_PROPERTY) + || (icalproperty_isa(p) == ICAL_RECURRENCEID_PROPERTY) ) { t = icalproperty_get_dtstart(p); // it's safe to use dtstart for all of them @@ -2160,8 +2145,9 @@ void ical_saving_vevent(icalcomponent *top_level_cal, icalcomponent *cal) { /* If the component has subcomponents, recurse through them. */ for (c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT); - (c != NULL); - c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)) { + (c != NULL); + c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT) + ) { /* Recursively process subcomponent */ ical_saving_vevent(top_level_cal, c); } @@ -2188,34 +2174,30 @@ void ical_obj_beforesave_backend(char *name, char *filename, char *partnum, if (!msg) return; /* We're only interested in calendar data. */ - if ( (strcasecmp(cbtype, "text/calendar")) - && (strcasecmp(cbtype, "application/ics")) ) { + if ( (strcasecmp(cbtype, "text/calendar")) + && (strcasecmp(cbtype, "application/ics")) + ) { return; } - /* 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. whole_cal = icalcomponent_new_from_string(content); cal = whole_cal; if (cal != NULL) { if (icalcomponent_isa(cal) == ICAL_VCALENDAR_COMPONENT) { - nested_event = icalcomponent_get_first_component( - cal, ICAL_VEVENT_COMPONENT); + nested_event = icalcomponent_get_first_component(cal, ICAL_VEVENT_COMPONENT); if (nested_event != NULL) { cal = nested_event; } else { - nested_todo = icalcomponent_get_first_component( - cal, ICAL_VTODO_COMPONENT); + nested_todo = icalcomponent_get_first_component( cal, ICAL_VTODO_COMPONENT); if (nested_todo != NULL) { cal = nested_todo; } } } - + if (cal != NULL) { /* Set the message EUID to the iCalendar UID */ @@ -2277,8 +2259,8 @@ void ical_obj_beforesave_backend(char *name, char *filename, char *partnum, */ 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) - && (CC->room.QRdefaultview != VIEW_TASKS) + if ( (CC->room.QRdefaultview != VIEW_CALENDAR) + && (CC->room.QRdefaultview != VIEW_TASKS) ) { return(0); /* Not an iCalendar-centric room */ } @@ -2294,12 +2276,14 @@ int ical_obj_beforesave(struct CtdlMessage *msg, struct recptypes *recp) { } /* Do all of our lovely back-end parsing */ - mime_parser(CM_RANGE(msg, eMessageText), - *ical_obj_beforesave_backend, - NULL, NULL, - (void *)msg, - 0 - ); + mime_parser( + CM_RANGE(msg, eMessageText), + *ical_obj_beforesave_backend, + NULL, + NULL, + (void *)msg, + 0 + ); return(0); } @@ -2315,8 +2299,9 @@ void ical_obj_aftersave_backend(char *name, char *filename, char *partnum, icalcomponent *cal; /* We're only interested in calendar items here. */ - if ( (strcasecmp(cbtype, "text/calendar")) - && (strcasecmp(cbtype, "application/ics")) ) { + if ( (strcasecmp(cbtype, "text/calendar")) + && (strcasecmp(cbtype, "application/ics")) + ) { return; } @@ -2325,8 +2310,9 @@ void ical_obj_aftersave_backend(char *name, char *filename, char *partnum, * 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")) + ) { cal = icalcomponent_new_from_string(content); if (cal != NULL) { ical_saving_vevent(cal, cal); @@ -2361,12 +2347,14 @@ int ical_obj_aftersave(struct CtdlMessage *msg, struct recptypes *recp) { if (CM_IsEmpty(msg, eMessageText)) return(1); // Now recurse through it looking for our icalendar data - mime_parser(CM_RANGE(msg, eMessageText), - *ical_obj_aftersave_backend, - NULL, NULL, - NULL, - 0 - ); + mime_parser( + CM_RANGE(msg, eMessageText), + *ical_obj_aftersave_backend, + NULL, + NULL, + NULL, + 0 + ); return(0); } @@ -2390,17 +2378,17 @@ void ical_fixed_output_backend(icalcomponent *cal, int recursion_level) { char buf[256]; const char *ch; - p = icalcomponent_get_first_property(cal, ICAL_SUMMARY_PROPERTY); + p = icalcomponent_get_first_property(cal, ICAL_SUMMARY_PROPERTY); if (p != NULL) { cprintf("%s\n", (const char *)icalproperty_get_comment(p)); } - p = icalcomponent_get_first_property(cal, ICAL_LOCATION_PROPERTY); + p = icalcomponent_get_first_property(cal, ICAL_LOCATION_PROPERTY); if (p != NULL) { cprintf("%s\n", (const char *)icalproperty_get_comment(p)); } - p = icalcomponent_get_first_property(cal, ICAL_DESCRIPTION_PROPERTY); + p = icalcomponent_get_first_property(cal, ICAL_DESCRIPTION_PROPERTY); if (p != NULL) { cprintf("%s\n", (const char *)icalproperty_get_comment(p)); } @@ -2408,8 +2396,7 @@ void ical_fixed_output_backend(icalcomponent *cal, int recursion_level) { // 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)) { ch = icalproperty_get_attendee(p); - if ((ch != NULL) && - !strncasecmp(ch, "MAILTO:", 7)) { + if ((ch != NULL) && !strncasecmp(ch, "MAILTO:", 7)) { // screen name or email address safestrncpy(buf, ch + 7, sizeof(buf)); @@ -2421,8 +2408,9 @@ void ical_fixed_output_backend(icalcomponent *cal, int recursion_level) { // 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)) { + (c != 0); + c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT) + ) { // Recursively process subcomponent ical_fixed_output_backend(c, recursion_level+1); } -- 2.30.2