From: Art Cancro Date: Mon, 26 May 2003 03:28:02 +0000 (+0000) Subject: * Getting closer to doing the availability check. Created new source X-Git-Tag: v7.86~5883 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=78fef9db3948d4c38ed7392c33bc30a85baac8ff;p=citadel.git * Getting closer to doing the availability check. Created new source module 'availability.c' for this purpose. Stub function is in place. --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index d494bfeef..6b8709cd0 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -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 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/Makefile.in b/webcit/Makefile.in index 8912801c4..582228548 100644 --- a/webcit/Makefile.in +++ b/webcit/Makefile.in @@ -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 index 000000000..ceb806e9d --- /dev/null +++ b/webcit/availability.c @@ -0,0 +1,86 @@ +/* + * $Id$ + * + * Check attendee availability for scheduling a meeting. + * + */ + +#include +#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 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 */ diff --git a/webcit/event.c b/webcit/event.c index 898039e11..92a3817c4 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -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); diff --git a/webcit/webcit.h b/webcit/webcit.h index 2f3b340a1..6ec1c553c 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -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[];