From: Art Cancro Date: Sun, 15 Sep 2002 03:16:24 +0000 (+0000) Subject: * Changed decode_base64() to CtdlDecodeBase64() to avoid conflict with X-Git-Tag: v7.86~6238 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=9aa5d78867f8aa9c0d6b788f4f97da3facbc42af * Changed decode_base64() to CtdlDecodeBase64() to avoid conflict with function namespace in libical --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 91f204800..9df2c45bc 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -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 1998-12-03 Nathan Bryant * webserver.c: warning fix + diff --git a/webcit/Makefile.in b/webcit/Makefile.in index 1c8fe12d2..e2f726a43 100644 --- a/webcit/Makefile.in +++ b/webcit/Makefile.in @@ -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 index 000000000..795a0532f --- /dev/null +++ b/webcit/calendar.c @@ -0,0 +1,62 @@ +/* + * $Id$ + * + * Functions which handle calendar objects and their processing/display. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "webcit.h" +#include "webserver.h" + +#ifdef HAVE_ICAL_H +#include +#endif + + +#ifndef HAVE_ICAL_H + +/* + * Handler stub for builds with no calendar library available + */ +void cal_process_attachment(char *part_source) { + + wprintf("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.
\n" + ); + +} + +#else /* HAVE_ICAL_H */ + +/* + * Handler stub for builds with no calendar library available + */ +void cal_process_attachment(char *part_source) { + + wprintf("This is a calendar object. " + "Handler coming soon!
"); + +} + +#endif /* HAVE_ICAL_H */ diff --git a/webcit/cookie_conversion.c b/webcit/cookie_conversion.c index d0bec8b52..b9db3f909 100644 --- a/webcit/cookie_conversion.c +++ b/webcit/cookie_conversion.c @@ -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); diff --git a/webcit/messages.c b/webcit/messages.c index f4a43e3fb..d5d98b155 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -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; + } + } diff --git a/webcit/mime_parser.c b/webcit/mime_parser.c index 681fc3896..9579d5cb8 100644 --- a/webcit/mime_parser.c +++ b/webcit/mime_parser.c @@ -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, diff --git a/webcit/webcit.h b/webcit/webcit.h index eb950d0f5..7453c62a8 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -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);