]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/modules/calendar/serv_calendar.c
Release version 997 generated by do-release.sh
[citadel.git] / citadel / server / modules / calendar / serv_calendar.c
index 4d86058276178341e488c71a2346c4b0324d48c2..23b4ce93432b1ae08d71b6bc916a444c10d35ffb 100644 (file)
@@ -102,7 +102,6 @@ void ical_write_to_cal(struct ctdluser *u, icalcomponent *cal) {
 
        // If the caller did not supply a user, write to the currently selected room
        if (!u) {
-               struct CitContext *CCC = CC;
                StrBuf *MsgBody;
 
                msg = malloc(sizeof(struct CtdlMessage));
@@ -110,8 +109,8 @@ void ical_write_to_cal(struct ctdluser *u, icalcomponent *cal) {
                msg->cm_magic = CTDLMESSAGE_MAGIC;
                msg->cm_anon_type = MES_NORMAL;
                msg->cm_format_type = 4;
-               CM_SetField(msg, eAuthor, CCC->user.fullname);
-               CM_SetField(msg, eOriginalRoom, CCC->room.QRname);
+               CM_SetField(msg, eAuthor, CC->user.fullname);
+               CM_SetField(msg, eOriginalRoom, CC->room.QRname);
 
                MsgBody = NewStrBufPlain(NULL, serlen + 100);
                StrBufAppendBufPlain(MsgBody, HKEY("Content-type: text/calendar\r\n\r\n"), 0);
@@ -1490,26 +1489,23 @@ void ical_getics_backend(long msgnum, void *data) {
 
        if (ird.cal == NULL) return;
 
-       // Here we go: put the VEVENT into the VCALENDAR.  We now no longer
-       // are responsible for "the_request"'s memory -- it will be freed
-       // when we free "encaps".
+       // Here we go: put the VEVENT componment into the VCALENDAR container.
 
-       // If the top-level component is *not* a VCALENDAR, we can drop it right in.
-       // This will almost never happen.
+       // If the top-level component is *not* a VCALENDAR container, we can drop it right in.
+       // This is rare but we have to be able to handle it.
        if (icalcomponent_isa(ird.cal) != ICAL_VCALENDAR_COMPONENT) {
                icalcomponent_add_component(encaps, ird.cal);
+               // And now, the parent VCALENDAR container owns the child component's memory.
        }
 
-       // In the more likely event that we're looking at a VCALENDAR with the VEVENT
-       // and other components encapsulated inside, we have to extract them.
+       // In the more likely event that we're looking at a VCALENDAR container with the VEVENT
+       // and other components encapsulated inside, we have to extract them first.
        else {
                for     (c = icalcomponent_get_first_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
-
                        if (icalcomponent_isa(c) == ICAL_VTIMEZONE_COMPONENT) {
                                icalproperty *p = icalcomponent_get_first_property(c, ICAL_TZID_PROPERTY);
                                if (p) {
@@ -1525,7 +1521,7 @@ void ical_getics_backend(long msgnum, void *data) {
                                icalcomponent_add_component(encaps, icalcomponent_new_clone(c));
                        }
                }
-               icalcomponent_free(ird.cal);
+               icalcomponent_free(ird.cal);            // we cloned this component so free the original.
        }
 }
 
@@ -2350,8 +2346,8 @@ void cmd_ical(char *argbuf) {
        // All other commands require a user to be logged in.
        if (CtdlAccessCheck(ac_logged_in)) return;
 
-       if (!strcasecmp(subcmd, "report")) {
-               calendar_report();
+       if (!strcasecmp(subcmd, "query")) {
+               calendar_query();
                return;
        }