Calendar system now handles invitations and rsvp's
authorArt Cancro <ajc@citadel.org>
Wed, 12 Dec 2007 03:58:05 +0000 (03:58 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 12 Dec 2007 03:58:05 +0000 (03:58 +0000)
using the MIME type 'application/ics' as well as the conventional
'text/calendar'.  As a result, it now smoothly interoperates with
systems such as Google Calendar.

citadel/modules/calendar/serv_calendar.c
webcit/calendar.c
webcit/ical_dezonify.c
webcit/messages.c

index 01f336ca16211f4de8d459ca5b8b1116a303ac5f..cc3f58c810819bc792325c5ccdfda9eaaa82ee41 100644 (file)
@@ -383,7 +383,8 @@ void ical_locate_part(char *name, char *filename, char *partnum, char *disp,
                }
        }
 
-       if (strcasecmp(cbtype, "text/calendar")) {
+       if (  (strcasecmp(cbtype, "text/calendar"))
+          && (strcasecmp(cbtype, "application/ics")) ) {
                return;
        }
 
@@ -529,7 +530,8 @@ void ical_locate_original_event(char *name, char *filename, char *partnum, char
 
        struct original_event_container *oec = NULL;
 
-       if (strcasecmp(cbtype, "text/calendar")) {
+       if (  (strcasecmp(cbtype, "text/calendar"))
+          && (strcasecmp(cbtype, "application/ics")) ) {
                return;
        }
        oec = (struct original_event_container *) cbuserdata;
@@ -1883,7 +1885,8 @@ void ical_ctdl_set_exclusive_msgid(char *name, char *filename, char *partnum,
        imm = (struct icalmessagemod *)cbuserdata;
 
        /* We're only interested in calendar data. */
-       if (strcasecmp(cbtype, "text/calendar")) {
+       if (  (strcasecmp(cbtype, "text/calendar"))
+          && (strcasecmp(cbtype, "application/ics")) ) {
                return;
        }
 
@@ -2018,7 +2021,8 @@ void ical_obj_aftersave_backend(char *name, char *filename, char *partnum,
        icalcomponent *cal;
 
        /* We're only interested in calendar items here. */
-       if (strcasecmp(cbtype, "text/calendar")) {
+       if (  (strcasecmp(cbtype, "text/calendar"))
+          && (strcasecmp(cbtype, "application/ics")) ) {
                return;
        }
 
@@ -2027,7 +2031,8 @@ void ical_obj_aftersave_backend(char *name, char *filename, char *partnum,
         * ical_obj_beforesave() sees it there, it'll set the Exclusive msgid
         * to that string.
         */
-       if (!strcasecmp(cbtype, "text/calendar")) {
+       if (  (!strcasecmp(cbtype, "text/calendar"))
+          || (!strcasecmp(cbtype, "application/ics")) ) {
                cal = icalcomponent_new_from_string(content);
                if (cal != NULL) {
                        ical_saving_vevent(cal);
@@ -2183,6 +2188,7 @@ CTDL_MODULE_INIT(calendar)
                CtdlRegisterSessionHook(ical_session_startup, EVT_START);
                CtdlRegisterSessionHook(ical_session_shutdown, EVT_STOP);
                CtdlRegisterFixedOutputHook("text/calendar", ical_fixed_output);
+               CtdlRegisterFixedOutputHook("application/ics", ical_fixed_output);
                CtdlRegisterCleanupHook(serv_calendar_destroy);
 #endif
        }
index 3ced19b1d177605966ae6a6630a3836d18bcb918..3fc2ae018a7b67da9370f6ae3390123dd735af05 100644 (file)
@@ -764,7 +764,6 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) {
  *
  */
 void display_using_handler(long msgnum,
-                       char *mimetype,
                        icalcomponent_kind which_kind,
                        void (*callback)(icalcomponent *, long)
        ) {
@@ -792,13 +791,12 @@ void display_using_handler(long msgnum,
                        extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
                        mime_length = extract_int(&buf[5], 5);
 
-                       if (!strcasecmp(mime_content_type, "text/calendar")) {
+                       if (  (!strcasecmp(mime_content_type, "text/calendar"))
+                          || (!strcasecmp(mime_content_type, "application/ics"))
+                          || (!strcasecmp(mime_content_type, "text/vtodo"))
+                       ) {
                                strcpy(relevant_partnum, mime_partnum);
                        }
-                       else if (!strcasecmp(mime_content_type, "text/vtodo")) {
-                               strcpy(relevant_partnum, mime_partnum);
-                       }
-
                }
        }
 
@@ -837,7 +835,7 @@ void display_using_handler(long msgnum,
  * \param msgnum number of the mesage in our db
  */
 void display_calendar(long msgnum) {
-       display_using_handler(msgnum, "text/calendar",
+       display_using_handler(msgnum,
                                ICAL_VEVENT_COMPONENT,
                                display_individual_cal);
 }
@@ -847,7 +845,7 @@ void display_calendar(long msgnum) {
  * \param msgnum number of the mesage in our db
  */
 void display_task(long msgnum) {
-       display_using_handler(msgnum, "text/calendar",
+       display_using_handler(msgnum,
                                ICAL_VTODO_COMPONENT,
                                display_individual_cal);
 }
@@ -866,7 +864,7 @@ void display_edit_task(void) {
        msgnum = atol(bstr("msgnum"));
        if (msgnum > 0L) {
                /** existing task */
-               display_using_handler(msgnum, "text/calendar",
+               display_using_handler(msgnum,
                                ICAL_VTODO_COMPONENT,
                                display_edit_individual_task);
        }
@@ -884,7 +882,7 @@ void save_task(void) {
 
        msgnum = atol(bstr("msgnum"));
        if (msgnum > 0L) {
-               display_using_handler(msgnum, "text/calendar",
+               display_using_handler(msgnum,
                                ICAL_VTODO_COMPONENT,
                                save_individual_task);
        }
@@ -902,7 +900,7 @@ void display_edit_event(void) {
        msgnum = atol(bstr("msgnum"));
        if (msgnum > 0L) {
                /* existing event */
-               display_using_handler(msgnum, "text/calendar",
+               display_using_handler(msgnum,
                                ICAL_VEVENT_COMPONENT,
                                display_edit_individual_event);
        }
@@ -921,7 +919,7 @@ void save_event(void) {
        msgnum = atol(bstr("msgnum"));
 
        if (msgnum > 0L) {
-               display_using_handler(msgnum, "text/calendar",
+               display_using_handler(msgnum,
                                ICAL_VEVENT_COMPONENT,
                                save_individual_event);
        }
@@ -979,5 +977,3 @@ void do_freebusy(char *req) {
 
 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
 
-
-/*@}*/
index d189ddd825bbbf6a322aa24346301a5eab247445..509c8deb9ccbbeba94b10b782a3579265d9026d3 100644 (file)
@@ -123,14 +123,18 @@ void ical_dezonify_backend(icalcomponent *cal,
                }
 
                if (t == NULL) {
-                       t = get_default_icaltimezone();
+                       icaltimezone_convert_time(&TheTime,
+                                               get_default_icaltimezone(),
+                                               icaltimezone_get_utc_timezone()
+                       );
+               }
+               else {
+                       icaltimezone_convert_time(&TheTime,
+                                               t,
+                                               icaltimezone_get_utc_timezone()
+                       );
+                       icaltimezone_free (t, 1);
                }
-
-               icaltimezone_convert_time(&TheTime,
-                                       t,
-                                       icaltimezone_get_utc_timezone()
-               );
-               icaltimezone_free (t, 1);
                TheTime.is_utc = 1;
        }
 
index ed90acba343cddb75906c1f58008102b76fdc278..0fe526f2341c257ad4d275769669a6d938fd022a 100644 (file)
@@ -883,7 +883,8 @@ void read_message(long msgnum, int printable_view, char *section) {
                                strcpy(vcard_partnum, mime_partnum);
                        }
 
-                       if (!strcasecmp(mime_content_type, "text/calendar")) {
+                       if (  (!strcasecmp(mime_content_type, "text/calendar"))
+                          || (!strcasecmp(mime_content_type, "application/ics")) ) {
                                strcpy(cal_partnum, mime_partnum);
                        }