* Various changes to the calendar service to handle messages containing
authorArt Cancro <ajc@citadel.org>
Thu, 13 Mar 2003 05:20:23 +0000 (05:20 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 13 Mar 2003 05:20:23 +0000 (05:20 +0000)
  fully encapsulated VCALENDAR components instead of only unencapsulated
  VEVENT subcomponents.  We have to move in this direction for compatibility
  with other products.

webcit/ChangeLog
webcit/calendar.c
webcit/event.c
webcit/ical_dezonify.c

index b8a5d6f8890a053522f647fe00af6f6103ed8e23..73fdbc3c28a5a748f830e71c5c6c31ee2aa29e1b 100644 (file)
@@ -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 <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
-
index 087a2a8b3f26a071b72d16e931eda146de4593e4..1089e115e73f5b7767f2b0beb8f0cfeff70c5dc5 100644 (file)
@@ -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,
index 72bd74dba9f38588044d262e71cb077982040eab..bf939b53c3f54c5c7cfa285736a9c1777bfcddfb 100644 (file)
@@ -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);
index 6bf691bbb78272f9acc74664136c80517f3667b5..169e0f377ab0d4a07869c98bceba284ba38964c8 100644 (file)
@@ -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.
+ *
  */