struct recptypes now uses dynamically allocated
[citadel.git] / citadel / serv_calendar.c
index 758f9b0ce0468fb25286ad6a7c1da7757b158755..91570069c4e37dcc60a152e03d36ca7e21163521 100644 (file)
@@ -240,7 +240,7 @@ void ical_send_a_reply(icalcomponent *request, char *action) {
                                                        if (me_attend) icalproperty_free(me_attend);
                                                        me_attend = icalproperty_new_clone(attendee);
                                                }
-                                               free(recp);
+                                               free_recipients(recp);
                                        }
                                }
                        }
@@ -314,6 +314,7 @@ void ical_send_a_reply(icalcomponent *request, char *action) {
                        "",                     /* cc */
                        CC->room.QRname, 0, FMT_RFC822,
                        "",
+                       "",
                        summary_string,         /* Use summary for subject */
                        NULL,
                        reply_message_text);
@@ -322,6 +323,7 @@ void ical_send_a_reply(icalcomponent *request, char *action) {
                        valid = validate_recipients(organizer_string);
                        CtdlSubmitMsg(msg, valid, "");
                        CtdlFreeMessage(msg);
+                       free_recipients(valid);
                }
        }
        free(serialized_reply);
@@ -685,6 +687,7 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) {
                        roomname,
                        0, FMT_RFC822,
                        "",
+                       "",
                        "",             /* no subject */
                        NULL,
                        message_text);
@@ -971,7 +974,8 @@ void ical_hunt_for_conflicts(icalcomponent *cal) {
 
        cprintf("%d Conflicting events:\n", LISTING_FOLLOWS);
 
-       CtdlForEachMessage(MSGS_ALL, 0, NULL, "text/calendar",
+       CtdlForEachMessage(MSGS_ALL, 0, NULL,
+               NULL,
                NULL,
                ical_hunt_for_conflicts_backend,
                (void *) cal
@@ -1186,7 +1190,7 @@ void ical_freebusy(char *who) {
                        if (recp->num_local == 1) {
                                found_user = getuser(&usbuf, recp->recp_local);
                        }
-                       free(recp);
+                       free_recipients(recp);
                }
        }
 
@@ -1201,7 +1205,7 @@ void ical_freebusy(char *who) {
                        if (recp->num_local == 1) {
                                found_user = getuser(&usbuf, recp->recp_local);
                        }
-                       free(recp);
+                       free_recipients(recp);
                }
        }
 
@@ -1224,7 +1228,7 @@ void ical_freebusy(char *who) {
                                        if (recp->num_local == 1) {
                                                found_user = getuser(&usbuf, recp->recp_local);
                                        }
-                                       free(recp);
+                                       free_recipients(recp);
                                }
                        }
                }
@@ -1276,9 +1280,7 @@ void ical_freebusy(char *who) {
 
        /* Add busy time from events */
        lprintf(CTDL_DEBUG, "Adding busy time from events\n");
-       CtdlForEachMessage(MSGS_ALL, 0, NULL, "text/calendar",
-               NULL, ical_freebusy_backend, (void *)fb
-       );
+       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.
@@ -1412,12 +1414,12 @@ void ical_getics(void)
        /* Set the Version Number */
        icalcomponent_add_property(encaps, icalproperty_new_version("2.0"));
 
-       /* Set the method to REQUEST */
+       /* Set the method to PUBLISH */
        icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH);
 
        /* Now go through the room encapsulating all calendar items. */
        CtdlForEachMessage(MSGS_ALL, 0, NULL,
-               "text/calendar",
+               NULL,
                NULL,
                ical_getics_backend,
                (void *) encaps
@@ -1757,6 +1759,7 @@ void ical_send_out_invitations(icalcomponent *cal) {
                        "",                     /* No single recipient here */
                        CC->room.QRname, 0, FMT_RFC822,
                        "",
+                       "",
                        summary_string,         /* Use summary for subject */
                        NULL,
                        request_message_text);
@@ -1765,7 +1768,7 @@ void ical_send_out_invitations(icalcomponent *cal) {
                        valid = validate_recipients(attendees_string);
                        CtdlSubmitMsg(msg, valid, "");
                        CtdlFreeMessage(msg);
-                       free (valid);
+                       free_recipients(valid);
                }
        }
        free(serialized_request);
@@ -1801,8 +1804,7 @@ void ical_saving_vevent(icalcomponent *cal) {
         * 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);
+               organizer = icalcomponent_get_first_property(cal, ICAL_ORGANIZER_PROPERTY);
                if (organizer != NULL) {
                        if (icalproperty_get_organizer(organizer)) {
                                strcpy(organizer_string,