module 'availability.c' for this purpose. Stub function is in place.
$Log$
+Revision 410.36 2003/05/26 03:28:02 ajc
+* Getting closer to doing the availability check. Created new source
+ module 'availability.c' for this purpose. Stub function is in place.
+
Revision 410.35 2003/05/25 04:25:12 ajc
* siteconfig.c: fixed a spelling error
* event.c: add a "Check attendee availability" button, and the code to
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
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 \
- calendar.o calendar_tools.o calendar_view.o event.o $(LIBOBJS)
+ calendar.o calendar_tools.o calendar_view.o event.o \
+ availability.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 calendar.o calendar_tools.o calendar_view.o event.o \
- ical_dezonify.o $(LIBOBJS) $(LIBS) -o webserver
+ availability.o ical_dezonify.o $(LIBOBJS) $(LIBS) -o webserver
.c.o:
$(CC) $(CFLAGS) $(DEFS) -c $(PTHREAD_DEFS) -DWEBCITDIR=\"`pwd`\" $<
--- /dev/null
+/*
+ * $Id$
+ *
+ * Check attendee availability for scheduling a meeting.
+ *
+ */
+
+#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 <time.h>
+#include "webcit.h"
+#include "webserver.h"
+
+
+#ifdef WEBCIT_WITH_CALENDAR_SERVICE
+
+/*
+ * Display an event by itself (for editing)
+ */
+void check_attendee_availability(icalcomponent *vevent) {
+ icalproperty *attendee = NULL;
+ char attendee_string[SIZ];
+
+ if (vevent == NULL) {
+ return;
+ }
+
+ /* If we're looking at a fully encapsulated VCALENDAR
+ * rather than a VEVENT component, attempt to use the first
+ * relevant VEVENT subcomponent. If there is none, the
+ * NULL returned by icalcomponent_get_first_component() will
+ * tell the next iteration of this function to create a
+ * new one.
+ */
+ if (icalcomponent_isa(vevent) == ICAL_VCALENDAR_COMPONENT) {
+ check_attendee_availability(
+ icalcomponent_get_first_component(
+ vevent, ICAL_VEVENT_COMPONENT
+ )
+ );
+ return;
+ }
+
+
+ /*
+ * Iterate through attendees. FIXME do something useful.
+ */
+ for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDEE_PROPERTY);
+ attendee != NULL;
+ attendee = icalcomponent_get_next_property(vevent, ICAL_ATTENDEE_PROPERTY)) {
+
+ strcpy(attendee_string, icalproperty_get_attendee(attendee));
+ if (!strncasecmp(attendee_string, "MAILTO:", 7)) {
+
+ /* screen name or email address */
+ strcpy(attendee_string, &attendee_string[7]);
+ striplt(attendee_string);
+
+ /* FIXME do something with attendee_string */
+ lprintf(9, "FIXME with <%s>\n", attendee_string);
+
+ /* participant status
+ partstat_as_string(buf, attendee); */
+ }
+ }
+
+}
+
+
+#endif /* WEBCIT_WITH_CALENDAR_SERVICE */
/* Or, check attendee availability if the user asked for that. */
if ( (encaps != NULL) && (!strcasecmp(bstr("sc"), "Check attendee availability")) ) {
- /* FIXME ... do the checking and annotating here, idiot */
+ /* Call this function, which does the real work */
+ check_attendee_availability(encaps);
/* This displays the form again, with our annotations */
display_edit_individual_event(encaps, msgnum);
void ical_dezonify(icalcomponent *cal);
void partstat_as_string(char *buf, icalproperty *attendee);
icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp);
+void check_attendee_availability(icalcomponent *supplied_vevent);
#endif
extern char *months[];