* Changed decode_base64() to CtdlDecodeBase64() to avoid conflict with
authorArt Cancro <ajc@citadel.org>
Sun, 15 Sep 2002 03:16:24 +0000 (03:16 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 15 Sep 2002 03:16:24 +0000 (03:16 +0000)
  function namespace in libical

webcit/ChangeLog
webcit/Makefile.in
webcit/calendar.c [new file with mode: 0644]
webcit/cookie_conversion.c
webcit/messages.c
webcit/mime_parser.c
webcit/webcit.h

index 91f204800725e0ee436ae7a7f36b678aed725ddd..9df2c45bca4066c888930662f95358e83bad3174 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 400.11  2002/09/15 03:16:24  ajc
+* Changed decode_base64() to CtdlDecodeBase64() to avoid conflict with
+  function namespace in libical
+
 Revision 400.10  2002/09/15 02:50:55  ajc
 * Duh.  I don't need to twiddle CFLAGS when autoconf provides -DHAVE_ZLIB_H
 
@@ -970,3 +974,4 @@ 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 1c8fe12d254b28f926cdf2cfa702b151a60ebd13..e2f726a434a54bfcec0babbec565376f2dc833d8 100644 (file)
@@ -27,13 +27,14 @@ webserver: webserver.o context_loop.o tools.o \
        webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \
        roomops.o messages.o userlist.o paging.o sysmsgs.o useredit.o \
        vcard.o vcard_edit.o preferences.o html2html.o listsub.o \
-       mime_parser.o graphics.o netconf.o siteconfig.o subst.o $(LIBOBJS)
+       mime_parser.o graphics.o netconf.o siteconfig.o subst.o \
+       calendar.o $(LIBOBJS)
        $(CC) webserver.o context_loop.o tools.o cookie_conversion.o \
        webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o listsub.o \
        roomops.o messages.o userlist.o paging.o sysmsgs.o useredit.o \
        locate_host.o siteconfig.o subst.o vcard.o vcard_edit.o floors.o \
        mime_parser.o graphics.o netconf.o preferences.o html2html.o \
-       summary.o \
+       summary.o calendar.o \
        $(LIBOBJS) $(LIBS) -o webserver
 
 .c.o:
diff --git a/webcit/calendar.c b/webcit/calendar.c
new file mode 100644 (file)
index 0000000..795a053
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * $Id$
+ *
+ * Functions which handle calendar objects and their processing/display.
+ *
+ */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <limits.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string.h>
+#include <pwd.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include <signal.h>
+#include "webcit.h"
+#include "webserver.h"
+
+#ifdef HAVE_ICAL_H
+#include <ical.h>
+#endif
+
+
+#ifndef HAVE_ICAL_H
+
+/*
+ * Handler stub for builds with no calendar library available
+ */
+void cal_process_attachment(char *part_source) {
+
+       wprintf("<I>This message contains calendaring/scheduling information,"
+               " but support for calendars is not available on this "
+               "particular system.  Please ask your system administrator to "
+               "install a new version of the Citadel web service with "
+               "calendaring enabled.</I><BR>\n"
+       );
+
+}
+
+#else /* HAVE_ICAL_H */
+
+/*
+ * Handler stub for builds with no calendar library available
+ */
+void cal_process_attachment(char *part_source) {
+
+       wprintf("<B><I>This is a calendar object.  "
+               "Handler coming soon!</I></B><BR>");
+
+}
+
+#endif /* HAVE_ICAL_H */
index d0bec8b521ef4a10bbc0f603276625536d3b02c2..b9db3f90969588d5393e542a44be70daad830fea 100644 (file)
@@ -27,7 +27,7 @@ typedef unsigned char byte;         /* Byte type */
 static byte dtable[SIZ];             /* base64 encode / decode table */
 
 /*
- * decode_base64() and encode_base64() are adaptations of code by
+ * CtdlDecodeBase64() and encode_base64() are adaptations of code by
  * John Walker, found in full in the file "base64.c" included with the Citadel
  * server.  The difference between those functions and these is that
  * these are intended to encode/decode small string buffers, and those are
@@ -94,7 +94,7 @@ void encode_base64(char *dest, char *source)
  * Convert base64-encoded to binary.  Returns the length of the decoded data.
  * It will stop after reading 'length' bytes.
  */
-int decode_base64(char *dest, char *source, size_t length)
+int CtdlDecodeBase64(char *dest, char *source, size_t length)
 {
     int i, c;
     int dpos = 0;
@@ -175,7 +175,7 @@ void cookie_to_stuff(char *cookie, int *session, char *user, char *pass, char *r
 {
        char buf[SIZ];
 
-       decode_base64(buf, cookie, strlen(cookie));
+       CtdlDecodeBase64(buf, cookie, strlen(cookie));
 
        if (session != NULL)
                *session = extract_int(buf, 0);
index f4a43e3fbe727c03ff86ea6daea78ea4bf317ade..d5d98b155e6b187a267cfbbfb07dfd181c0d89a5 100644 (file)
@@ -216,13 +216,15 @@ void read_message(long msgnum) {
        int nhdr = 0;
        int bq = 0;
        char vcard_partnum[SIZ];
-       char *vcard_source = NULL;
+       char cal_partnum[SIZ];
+       char *part_source = NULL;
 
        strcpy(from, "");
        strcpy(node, "");
        strcpy(rfca, "");
        strcpy(reply_to, "");
        strcpy(vcard_partnum, "");
+       strcpy(cal_partnum, "");
 
        serv_printf("MSG4 %ld", msgnum);
        serv_gets(buf);
@@ -330,10 +332,17 @@ void read_message(long msgnum) {
                                        msgnum, mime_partnum);
                        }
 
+                       /*** begin handler prep ***/
                        if (!strcasecmp(mime_content_type, "text/x-vcard")) {
                                strcpy(vcard_partnum, mime_partnum);
                        }
 
+                       if (!strcasecmp(mime_content_type, "text/calendar")) {
+                               strcpy(cal_partnum, mime_partnum);
+                       }
+
+                       /*** end handler prep ***/
+
                }
 
        }
@@ -456,9 +465,10 @@ void read_message(long msgnum) {
                free(mime_http);
        }
 
+       /* Handler for vCard parts */
        if (strlen(vcard_partnum) > 0) {
-               vcard_source = load_mimepart(msgnum, vcard_partnum);
-               if (vcard_source != NULL) {
+               part_source = load_mimepart(msgnum, vcard_partnum);
+               if (part_source != NULL) {
 
                        /* If it's my vCard I can edit it */
                        if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
@@ -470,11 +480,23 @@ void read_message(long msgnum) {
                        }
 
                        /* In all cases, display the full card */
-                       display_vcard(vcard_source, 0, 1);
-                       free(vcard_source);
+                       display_vcard(part_source, 0, 1);
+               }
+       }
+
+       /* Handler for calendar parts */
+       if (strlen(cal_partnum) > 0) {
+               part_source = load_mimepart(msgnum, cal_partnum);
+               if (part_source != NULL) {
+                       cal_process_attachment(part_source);
                }
        }
 
+       if (part_source) {
+               free(part_source);
+               part_source = NULL;
+       }
+
 }
 
 
index 681fc3896dd15b2204b2179198cbe826ee917023..9579d5cb858e4016eb962d1c47e0d1e08c29db95 100644 (file)
@@ -204,7 +204,7 @@ void mime_decode(char *partnum,
        }
 
        if (!strcasecmp(encoding, "base64")) {
-               bytes_decoded = decode_base64(decoded, part_start, length);
+               bytes_decoded = CtdlDecodeBase64(decoded, part_start, length);
        }
        else if (!strcasecmp(encoding, "quoted-printable")) {
                bytes_decoded = decode_quoted_printable(decoded,
index eb950d0f53468b3902123146a95157f9ce171eeb..7453c62a8e8215850e5b7226097999ffb88632e5 100644 (file)
@@ -308,7 +308,7 @@ char *memreadline(char *start, char *buf, int maxlen);
 int num_tokens (char *source, char tok);
 void extract_token(char *dest, char *source, int parmnum, char separator);
 void remove_token(char *source, int parmnum, char separator);
-int decode_base64(char *dest, char *source, size_t length);
+int CtdlDecodeBase64(char *dest, char *source, size_t length);
 char *load_mimepart(long msgnum, char *partnum);
 int pattern2(char *search, char *patn);
 void do_edit_vcard(long, char *, char *);
@@ -341,3 +341,4 @@ void do_listsub(void);
 void toggle_self_service(void);
 void summary(void);
 ssize_t write(int fd, const void *buf, size_t count);
+void cal_process_attachment(char *part_source);