Starting to bring over calendar server code from webcit-classic.
authorArt Cancro <ajc@citadel.org>
Wed, 27 Dec 2023 23:45:03 +0000 (18:45 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 27 Dec 2023 23:45:03 +0000 (18:45 -0500)
webcit-ng/Makefile
webcit-ng/server/caldav_reports.c
webcit-ng/server/calendar_functions.c
webcit-ng/server/webcit.h
webcit/calendar.c

index c29a595c8522bd927f2384687bd7cf251f100274..291a9a888ccd43db01693337241b92cc72bb2266 100644 (file)
@@ -14,7 +14,7 @@ SOURCES := $(wildcard $(SRC)/*.c)
 OBJECTS := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES))
 
 webcit: $(OBJECTS)
-       gcc $(CFLAGS) $(OBJECTS) $(LDFLAGS) -lcitadel -lpthread -lcrypto -lssl -lexpat -o webcit
+       gcc $(CFLAGS) $(OBJECTS) $(LDFLAGS) -lcitadel -lpthread -lcrypto -lssl -lexpat -lical -o webcit
 
 $(SRC)/%.c: $(HEADERS)
        touch $@
index d30894968e68343c63e76dcefc7277569abcea52..7fe12ff3ae2b38c0a6245f5d45fe4023da6fc8da 100644 (file)
@@ -101,7 +101,7 @@ void caldav_xml_chardata(void *data, const XML_Char * s, int len) {
 //
 // NOTE: this function expects that "MSGP text/calendar" was issued at the beginning
 // of a REPORT operation to set our preferred MIME type to calendar data.
-StrBuf *fetch_ical(struct ctdlsession * c, long msgnum) {
+StrBuf *fetch_ical(struct ctdlsession *c, long msgnum) {
        char buf[1024];
        StrBuf *Buf = NULL;
 
index fe179cb008cc86daa3953026a7118fd58a2af9b0..d127b63de7d0e0f73b9097700f3dd3996c07fe36 100644 (file)
@@ -10,6 +10,7 @@
 
 // Client is requesting a message list
 void calendar_msglist(struct http_transaction *h, struct ctdlsession *c, char *range) {
+       char buf[SIZ];
 
        // Determine the date/time range requested by the client
        time_t lo = atol(range);
@@ -30,6 +31,12 @@ void calendar_msglist(struct http_transaction *h, struct ctdlsession *c, char *r
                return;
        }
 
+       // We're going to make a lot of MSG4 calls, and the preferred MIME type we want is "text/calendar".
+       // The iCalendar standard is mature now, and we are no longer interested in text/x-vcal or application/ics.
+       ctdl_printf(c, "MSGP text/calendar");
+       ctdl_readline(c, buf, sizeof buf);
+
+       // Iterate through our message list.
        for (i = 0; i < array_len(msglist); ++i) {
                long m;
                memcpy(&m, array_get_element_at(msglist, i), sizeof(long));
@@ -41,6 +48,11 @@ void calendar_msglist(struct http_transaction *h, struct ctdlsession *c, char *r
                // 3. figure out range
                // we should steal code from webcit-classic for this
 
+               StrBuf *one_item;
+               one_item = fetch_ical(c, m);
+               syslog(LOG_DEBUG, "calendar item:\n---\n\033[33m%s\n---\033[0m", ChrPtr(one_item));
+               FreeStrBuf(&one_item);
+
        }
        array_free(msglist);
 
index b678ceffc2007e0b33a802533ef1d11207788090..1a187fef815f03aa7e6c3d2b1aae14fb76c1b00c 100644 (file)
@@ -34,6 +34,7 @@
 #include <stdarg.h>
 #include <limits.h>
 #include <iconv.h>
+#include <libical/ical.h>
 #include <libcitadel.h>
 #define OPENSSL_NO_KRB5                                // Work around RedHat's b0rken OpenSSL includes
 #include <openssl/ssl.h>
index f0f34ef84e05a4344b449df7032f2cbf2a7394d2..ce49b34558729079dd231829963decab134a7db7 100644 (file)
@@ -668,7 +668,7 @@ void load_ical_object(long msgnum, int unread,
                                      || (!strcasecmp(mime_content_type, "application/ics"))
                                      || (!strcasecmp(mime_content_type, "text/vtodo"))
                                      || (!strcasecmp(mime_content_type, "text/todo"))
-                                       ) {
+                               ) {
                                        strcpy(relevant_partnum, mime_partnum);
                                }
                        }