From bfaf73535e046f005e045c5d3bd8f4c1354ed40a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 13 Mar 2003 05:20:23 +0000 Subject: [PATCH] * Various changes to the calendar service to handle messages containing fully encapsulated VCALENDAR components instead of only unencapsulated VEVENT subcomponents. We have to move in this direction for compatibility with other products. --- webcit/ChangeLog | 8 ++++++-- webcit/calendar.c | 41 +++++++++++++++++++++++++++++++++++++++++ webcit/event.c | 34 ++++++++++++++++++++++++++++++++++ webcit/ical_dezonify.c | 3 +++ 4 files changed, 84 insertions(+), 2 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index b8a5d6f88..73fdbc3c2 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,10 @@ $Log$ +Revision 410.2 2003/03/13 05:20:23 ajc +* Various changes to the calendar service to handle messages containing + fully encapsulated VCALENDAR components instead of only unencapsulated + VEVENT subcomponents. We have to move in this direction for compatibility + with other products. + Revision 410.1 2003/03/01 22:07:19 ajc * New user registration, as well as existing user re-registration, now uses the vCard editing screen. @@ -1279,5 +1285,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - - diff --git a/webcit/calendar.c b/webcit/calendar.c index 087a2a8b3..1089e115e 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -70,6 +70,9 @@ void display_task(long msgnum) { /* * Process a calendar object * ...at this point it's already been deserialized by cal_process_attachment() + * + * ok for complete vcalendar objects + * */ void cal_process_object(icalcomponent *cal, int recursion_level, @@ -324,6 +327,7 @@ void cal_process_object(icalcomponent *cal, /* * Deserialize a calendar object in a message so it can be processed. * (This is the main entry point for these things) + * ok for complete vcalendar objects */ void cal_process_attachment(char *part_source, long msgnum, char *cal_partnum) { icalcomponent *cal; @@ -501,6 +505,8 @@ void display_individual_task(icalcomponent *vtodo, long msgnum) { /* * Display a task by itself (for editing) + * + * ok for complete vcalendar objects */ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum) { icalcomponent *vtodo; @@ -513,6 +519,22 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum) { if (supplied_vtodo != NULL) { vtodo = supplied_vtodo; + + /* If we're looking at a fully encapsulated VCALENDAR + * rather than a VTODO component, attempt to use the first + * relevant VTODO subcomponent. If there is none, the + * NULL returned by icalcomponent_get_first_component() will + * tell the next iteration of this function to create a + * new one. + */ + if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) { + display_edit_individual_task( + icalcomponent_get_first_component( + vtodo, ICAL_VTODO_COMPONENT + ), msgnum + ); + return; + } } else { vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT); @@ -589,6 +611,8 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum) { /* * Save an edited task + * + * ok */ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) { char buf[SIZ]; @@ -599,6 +623,21 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) { if (supplied_vtodo != NULL) { vtodo = supplied_vtodo; + /* If we're looking at a fully encapsulated VCALENDAR + * rather than a VTODO component, attempt to use the first + * relevant VTODO subcomponent. If there is none, the + * NULL returned by icalcomponent_get_first_component() will + * tell the next iteration of this function to create a + * new one. + */ + if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) { + save_individual_task( + icalcomponent_get_first_component( + vtodo, ICAL_VTODO_COMPONENT + ), msgnum + ); + return; + } } else { vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT); @@ -691,6 +730,8 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) { * type, we load the message and hunt for that MIME type. If found, we load * the relevant part, deserialize it into a libical component, filter it for * the requested object type, and feed it to the specified handler. + * + * ok */ void display_using_handler(long msgnum, char *mimetype, diff --git a/webcit/event.c b/webcit/event.c index 72bd74dba..bf939b53c 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -32,6 +32,8 @@ /* * Display an event by itself (for editing) + * + * ok */ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) { icalcomponent *vevent; @@ -56,6 +58,21 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) if (supplied_vevent != NULL) { vevent = supplied_vevent; + /* If we're looking at a fully encapsulated VCALENDAR + * rather than a VTODO component, attempt to use the first + * relevant VTODO subcomponent. If there is none, the + * NULL returned by icalcomponent_get_first_component() will + * tell the next iteration of this function to create a + * new one. + */ + if (icalcomponent_isa(vevent) == ICAL_VCALENDAR_COMPONENT) { + display_edit_individual_event( + icalcomponent_get_first_component( + vevent, ICAL_VTODO_COMPONENT + ), msgnum + ); + return; + } } else { vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT); @@ -387,6 +404,8 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) /* * Save an edited event + * + * ok */ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) { char buf[SIZ]; @@ -406,6 +425,21 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) { if (supplied_vevent != NULL) { vevent = supplied_vevent; + /* If we're looking at a fully encapsulated VCALENDAR + * rather than a VTODO component, attempt to use the first + * relevant VTODO subcomponent. If there is none, the + * NULL returned by icalcomponent_get_first_component() will + * tell the next iteration of this function to create a + * new one. + */ + if (icalcomponent_isa(vevent) == ICAL_VCALENDAR_COMPONENT) { + save_individual_event( + icalcomponent_get_first_component( + vevent, ICAL_VTODO_COMPONENT + ), msgnum + ); + return; + } } else { vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT); diff --git a/webcit/ical_dezonify.c b/webcit/ical_dezonify.c index 6bf691bbb..169e0f377 100644 --- a/webcit/ical_dezonify.c +++ b/webcit/ical_dezonify.c @@ -5,6 +5,9 @@ * date/time properties to UTC. It also strips out any VTIMEZONE * subcomponents afterwards, because they're irrelevant. * + * Everything here will work on both a fully encapsulated VCALENDAR component + * or any type of subcomponent. + * */ -- 2.39.2