]> code.citadel.org Git - citadel.git/blobdiff - webcit/event.c
* split tasks view into its own file
[citadel.git] / webcit / event.c
index ea4e848511943b45ad29d6a98c87422512fbd3d6..d1c7bbc6be69b444398b3f5d1120dccf0cf3c9c8 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "webcit.h"
 #include "webserver.h"
+#include "calendar.h"
 
 /*
  * Display an event by itself (for editing)
@@ -13,7 +14,7 @@
  * msgnum              reference on the citserver
  */
 void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from,
-       int unread, struct calview *calv)
+       int unread, calview *calv)
 {
        icalcomponent *vevent;
        icalproperty *p;
@@ -765,7 +766,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
  * msgnum:             the index on the citserver
  */
 void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from,
-                       int unread, struct calview *calv) {
+                       int unread, calview *calv) {
        char buf[SIZ];
        icalproperty *prop;
        icalcomponent *vevent, *encaps;
@@ -811,7 +812,7 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr
 
        if ( (havebstr("save_button"))
           || (havebstr("check_button")) ) {
-               StrBuf *Buf = NewStrBuf();
+
                /* Replace values in the component with ones from the form */
 
                while (prop = icalcomponent_get_first_property(vevent,
@@ -820,21 +821,17 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr
                        icalproperty_free(prop);
                }
 
+               /* Add NOW() to the calendar object... */
+               icalcomponent_set_dtstamp(vevent, 
+                                         icaltime_from_timet(
+                                                 time(NULL), 0));
+
                if (havebstr("summary")) {
-                       FlushStrBuf(Buf);
-                       StrBufRFC2047encode(&Buf, sbstr("summary"));
-                       icalcomponent_add_property(
-                               vevent,
-                               icalproperty_new_summary(ChrPtr(Buf)));
+                       icalcomponent_add_property(vevent,
+                                       icalproperty_new_summary(bstr("summary")));
                } else {
-                       StrBuf *Untitled;
-                       FlushStrBuf(Buf);
-                       Untitled = NewStrBufPlain(_("Untitled Event"), -1);
-                       StrBufRFC2047encode(&Buf, Untitled);
-                       FreeStrBuf(&Untitled);
-                       icalcomponent_add_property(
-                               vevent,
-                               icalproperty_new_summary(ChrPtr(Buf)));
+                       icalcomponent_add_property(vevent,
+                                       icalproperty_new_summary(_("Untitled Event")));
                }
        
                while (prop = icalcomponent_get_first_property(vevent,
@@ -843,11 +840,8 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr
                        icalproperty_free(prop);
                }
                if (havebstr("location")) {
-                       FlushStrBuf(Buf);
-                       StrBufRFC2047encode(&Buf, sbstr("location"));
-                       icalcomponent_add_property(
-                               vevent,
-                               icalproperty_new_location(ChrPtr(Buf)));
+                       icalcomponent_add_property(vevent,
+                                       icalproperty_new_location(bstr("location")));
                }
                while (prop = icalcomponent_get_first_property(vevent,
                                  ICAL_DESCRIPTION_PROPERTY), prop != NULL) {
@@ -855,11 +849,8 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr
                        icalproperty_free(prop);
                }
                if (havebstr("description")) {
-                       FlushStrBuf(Buf);
-                       StrBufRFC2047encode(&Buf, sbstr("description"));
-                       icalcomponent_add_property(
-                               vevent,
-                               icalproperty_new_description(ChrPtr(Buf)));
+                       icalcomponent_add_property(vevent,
+                               icalproperty_new_description(bstr("description")));
                }
 
                while (prop = icalcomponent_get_first_property(vevent,
@@ -1170,7 +1161,7 @@ STARTOVER:        for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDE
                        icalcomponent_free(encaps);
                        encaps = NULL;
                }
-               FreeStrBuf(&Buf);
+
        }
 
        /*