$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
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
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:
--- /dev/null
+/*
+ * $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 */
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
* 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;
{
char buf[SIZ];
- decode_base64(buf, cookie, strlen(cookie));
+ CtdlDecodeBase64(buf, cookie, strlen(cookie));
if (session != NULL)
*session = extract_int(buf, 0);
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);
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 ***/
+
}
}
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))
}
/* 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;
+ }
+
}
}
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,
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 *);
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);