/* Now that we've processed this message, we don't need it
* anymore. So delete it.
*/
- CtdlDeleteMessages(CC->room.QRname, msgnum, "", 1);
+ CtdlDeleteMessages(CC->room.QRname, &msgnum, 1, "", 1);
/* Free the memory we allocated and return a response. */
icalcomponent_free(ird.cal);
/* Now that we've processed this message, we don't need it
* anymore. So delete it. (Maybe make this optional?)
*/
- CtdlDeleteMessages(CC->room.QRname, msgnum, "", 1);
+ CtdlDeleteMessages(CC->room.QRname, &msgnum, 1, "", 1);
/* Free the memory we allocated and return a response. */
icalcomponent_free(ird.cal);
cprintf("%d Conflicting events:\n", LISTING_FOLLOWS);
- CtdlForEachMessage(MSGS_ALL, 0, "text/calendar",
+ CtdlForEachMessage(MSGS_ALL, 0, NULL, "text/calendar",
NULL,
ical_hunt_for_conflicts_backend,
(void *) cal
/* Add busy time from events */
lprintf(CTDL_DEBUG, "Adding busy time from events\n");
- CtdlForEachMessage(MSGS_ALL, 0, "text/calendar",
+ CtdlForEachMessage(MSGS_ALL, 0, NULL, "text/calendar",
NULL, ical_freebusy_backend, (void *)fb
);
icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH);
/* Now go through the room encapsulating all calendar items. */
- CtdlForEachMessage(MSGS_ALL, 0, "text/calendar",
+ CtdlForEachMessage(MSGS_ALL, 0, NULL,
+ "text/calendar",
NULL,
ical_getics_backend,
(void *) encaps
}
-/*
- * Back end for ical_putics()
- * This function simply takes an icalcomponent supplied by the caller,
- * re-encapsulates it into a VCALENDAR component if necessary, and
- * saves it to the current room as a message.
- */
-void ical_putics_savemessage(icalcomponent *cal)
-{
- /* FIXME write this */
-}
-
-
-
/*
* Delete all of the calendar items in the current room, and replace them
* with calendar items from a client-supplied data stream.
/* We got our data stream -- now do something with it. */
- /* FIXME -- right here -- blow away the existing contents of the room */
+ /* Delete the existing messages in the room, because we are replacing
+ * the entire calendar with an entire new (or updated) calendar.
+ * (Careful: this opens an S_ROOMS critical section!)
+ */
+ CtdlDeleteMessages(CC->room.QRname, NULL, 0, "", 0);
/* If the top-level component is *not* a VCALENDAR, we can drop it right
* in. This will almost never happen.
*/
if (icalcomponent_isa(cal) != ICAL_VCALENDAR_COMPONENT) {
- ical_putics_savemessage(cal);
+ ical_write_to_cal(&CC->user, cal);
}
/*
* In the more likely event that we're looking at a VCALENDAR with the VEVENT
for (c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
(c != NULL);
c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)) {
- ical_putics_savemessage(cal);
+ ical_write_to_cal(&CC->user, c);
}
}
int recursion_level
) {
icalcomponent *c;
- icalproperty *method = NULL;
- icalproperty_method the_method = ICAL_METHOD_NONE;
icalproperty *p;
- struct icaltimetype t;
- time_t tt;
char buf[256];
- /* Look for a method */
- method = icalcomponent_get_first_property(cal, ICAL_METHOD_PROPERTY);
-
- /* See what we need to do with this */
- if (method != NULL) {
- the_method = icalproperty_get_method(method);
- switch(the_method) {
- case ICAL_METHOD_REQUEST:
- cprintf("Meeting invitation\n");
- break;
- case ICAL_METHOD_REPLY:
- cprintf("Attendee's reply to your invitation\n");
- break;
- case ICAL_METHOD_PUBLISH:
- cprintf("Published event\n");
- break;
- default:
- cprintf("This is an unknown type of calendar item.\n");
- break;
- }
- }
-
p = icalcomponent_get_first_property(cal, ICAL_SUMMARY_PROPERTY);
if (p != NULL) {
- cprintf("Summary: %s\n", (const char *)icalproperty_get_comment(p));
+ cprintf("%s\n", (const char *)icalproperty_get_comment(p));
}
p = icalcomponent_get_first_property(cal, ICAL_LOCATION_PROPERTY);
if (p != NULL) {
- cprintf("Location: %s\n", (const char *)icalproperty_get_comment(p));
- }
-
- /*
- * 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);
- if (p != NULL) {
- t = icalproperty_get_dtstart(p);
-
- if (t.is_date) {
- cprintf("Date: %s %d, %d\n",
- ascmonths[t.month - 1],
- t.day, t.year
- );
- }
- else {
- tt = icaltime_as_timet(t);
- fmt_date(buf, sizeof buf, tt, 0);
- cprintf("Starting date/time: %s\n", buf);
- }
- }
-
- p = icalcomponent_get_first_property(cal, ICAL_DTEND_PROPERTY);
- if (p != NULL) {
- t = icalproperty_get_dtend(p);
- tt = icaltime_as_timet(t);
- fmt_date(buf, sizeof buf, tt, 0);
- cprintf("Ending date/time: %s\n", buf);
- }
-
+ cprintf("%s\n", (const char *)icalproperty_get_comment(p));
}
p = icalcomponent_get_first_property(cal, ICAL_DESCRIPTION_PROPERTY);
if (p != NULL) {
- cprintf("Description: %s\n", (const char *)icalproperty_get_comment(p));
+ cprintf("%s\n", (const char *)icalproperty_get_comment(p));
}
/* 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)) {
- cprintf("Attendee: ");
safestrncpy(buf, icalproperty_get_attendee(p), sizeof buf);
if (!strncasecmp(buf, "MAILTO:", 7)) {
/*
- * Function to output a calendar item as plain text. Nobody uses MSG0
+ * Function to output vcalendar data as plain text. Nobody uses MSG0
* anymore, so really this is just so we expose the vCard data to the full
* text indexer.
*/
free(stringy_cal);
if (cal == NULL) {
- cprintf("There was an error parsing this calendar item.\n");
return;
}