* Getting closer to doing the availability check. Created new source
authorArt Cancro <ajc@citadel.org>
Mon, 26 May 2003 03:28:02 +0000 (03:28 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 26 May 2003 03:28:02 +0000 (03:28 +0000)
  module 'availability.c' for this purpose.  Stub function is in place.

webcit/ChangeLog
webcit/Makefile.in
webcit/availability.c [new file with mode: 0644]
webcit/event.c
webcit/webcit.h

index d494bfeef290041a530d877cc560d3880550f1fa..6b8709cd097fc33e40548c030183454e5ffdf369 100644 (file)
@@ -1,4 +1,8 @@
 $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
@@ -1421,4 +1425,3 @@ 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 8912801c48eab1033f6ffb0d04162d118c8d2e06..58222854864ac6915aba02c7649280430a128b08 100644 (file)
@@ -28,14 +28,15 @@ webserver: webserver.o context_loop.o tools.o ical_dezonify.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 \
-       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`\" $<
diff --git a/webcit/availability.c b/webcit/availability.c
new file mode 100644 (file)
index 0000000..ceb806e
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * $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 */
index 898039e115fedec29895a1d990b061dd6e934d42..92a3817c4e0965a25b22ab83068ab6e21c449500 100644 (file)
@@ -678,7 +678,8 @@ STARTOVER:  lprintf(9, "Remove unlisted attendees\n");
                /* 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);
index 2f3b340a1f4c1da9b5ad40d9beaeac3eef861b4d..6ec1c553c35cbd15616d3ed90ed2314cc65c1ff5 100644 (file)
@@ -408,6 +408,7 @@ void handle_rsvp(void);
 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[];