]> code.citadel.org Git - citadel.git/commitdiff
* When sending out invitations, encapsulate the VEVENT component inside a
authorArt Cancro <ajc@citadel.org>
Wed, 4 Dec 2002 05:01:18 +0000 (05:01 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 4 Dec 2002 05:01:18 +0000 (05:01 +0000)
  VCALENDAR component, along with proper metadata such as product ID and
  vcalendar version.  Move the METHOD:REQUEST property to the encapsulating
  component rather than the event itself.  (Still need to add a VTIMEZONE).

citadel/ChangeLog
citadel/serv_calendar.c

index 95a2636a8cf1ac072ca1c0982ea51cf1e03f3347..83aef5b6a64218c42905de435df0b085e346d5c9 100644 (file)
@@ -1,4 +1,10 @@
  $Log$
+ Revision 601.83  2002/12/04 05:01:18  ajc
+ * When sending out invitations, encapsulate the VEVENT component inside a
+   VCALENDAR component, along with proper metadata such as product ID and
+   vcalendar version.  Move the METHOD:REQUEST property to the encapsulating
+   component rather than the event itself.  (Still need to add a VTIMEZONE).
+
  Revision 601.82  2002/12/03 04:49:15  ajc
  * Send out meeting requests!  (Need to test with various clients.)
 
@@ -4277,3 +4283,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 4b4f17d098e78113466bdba89fcce942a61faba8..65bb97fcbad799b7083e95b157d302133bb1f19c 100644 (file)
@@ -7,6 +7,8 @@
  *
  */
 
+#define PRODID "-//Citadel//NONSGML Citadel Calendar//EN"
+
 #include "sysdep.h"
 #include <unistd.h>
 #include <sys/types.h>
@@ -30,7 +32,6 @@
 #include "msgbase.h"
 #include "mime_parser.h"
 
-
 #ifdef HAVE_ICAL_H
 
 #include <ical.h>
@@ -684,8 +685,9 @@ void ical_send_out_invitations(icalcomponent *cal) {
        char attendees_string[SIZ];
        char this_attendee[SIZ];
        icalproperty *attendee = NULL;
-       char *summary_string = NULL;
+       char summary_string[SIZ];
        icalproperty *summary = NULL;
+       icalcomponent *encaps = NULL;
 
        if (cal == NULL) {
                lprintf(3, "ERROR: trying to reply to NULL event?\n");
@@ -711,9 +713,6 @@ void ical_send_out_invitations(icalcomponent *cal) {
                }
        }
 
-       /* Set the method to REQUEST */
-       icalcomponent_set_method(the_request, ICAL_METHOD_REQUEST);
-
        /* Determine who the recipients of this message are (the attendees) */
        strcpy(attendees_string, "");
        for (attendee = icalcomponent_get_first_property(the_request, ICAL_ATTENDEE_PROPERTY); attendee != NULL; attendee = icalcomponent_get_next_property(the_request, ICAL_ATTENDEE_PROPERTY)) {
@@ -732,9 +731,35 @@ void ical_send_out_invitations(icalcomponent *cal) {
 
        lprintf(9, "attendees_string: <%s>\n", attendees_string);
 
+       /* Encapsulate the VEVENT component into a complete VCALENDAR */
+       encaps = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
+       if (encaps == NULL) {
+               lprintf(3, "Error at %s:%d - could not allocate component!\n",
+                       __FILE__, __LINE__);
+               icalcomponent_free(the_request);
+               return;
+       }
+
+       /* Set the Product ID */
+       icalcomponent_add_property(encaps, icalproperty_new_prodid(PRODID));
+
+       /* Set the Version Number */
+       icalcomponent_add_property(encaps, icalproperty_new_version("2.0"));
+
+       /* Set the method to REQUEST */
+       icalcomponent_set_method(encaps, ICAL_METHOD_REQUEST);
+
+       /* FIXME: here we need to insert a VTIMEZONE object. */
+
+       /* 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".
+        */
+       icalcomponent_add_component(encaps, the_request);
+
        /* Serialize it */
-       serialized_request = strdoop(icalcomponent_as_ical_string(the_request));
-       icalcomponent_free(the_request);        /* don't need this anymore */
+       serialized_request = strdoop(icalcomponent_as_ical_string(encaps));
+       icalcomponent_free(encaps);     /* Don't need this anymore. */
        if (serialized_request == NULL) return;
 
        request_message_text = mallok(strlen(serialized_request) + SIZ);