From: Art Cancro Date: Sun, 5 Jan 2003 20:51:01 +0000 (+0000) Subject: * Display PARTSTAT for attendees X-Git-Tag: v7.86~6056 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=fe85bb758793dc0517d4b06fd09e0391d631c727 * Display PARTSTAT for attendees --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 23cb8acf7..d296691cb 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,7 @@ $Log$ +Revision 400.76 2003/01/05 20:51:01 ajc +* Display PARTSTAT for attendees + Revision 400.75 2003/01/05 05:01:00 ajc * Add "today's calendar events" to the summary page. @@ -1214,4 +1217,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/calendar.c b/webcit/calendar.c index f1b20868f..3b9bf2e86 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -200,11 +200,17 @@ void cal_process_object(icalcomponent *cal, wprintf("Attendee:"); strcpy(buf, icalproperty_get_attendee(p)); if (!strncasecmp(buf, "MAILTO:", 7)) { + + /* screen name or email address */ strcpy(buf, &buf[7]); striplt(buf); escputs(buf); + wprintf(" "); + + /* participant status */ + partstat_as_string(buf, p); + escputs(buf); } - /* FIXME add status */ wprintf("\n"); } diff --git a/webcit/calendar_tools.c b/webcit/calendar_tools.c index 9426716b3..85c348ce0 100644 --- a/webcit/calendar_tools.c +++ b/webcit/calendar_tools.c @@ -178,5 +178,45 @@ void generate_new_uid(char *buf) { serv_info.serv_fqdn); } +/* + * Render a PARTSTAT parameter as a string (and put it in parentheses) + */ +void partstat_as_string(char *buf, icalproperty *attendee) { + icalparameter *partstat_param; + icalparameter_partstat partstat; + + strcpy(buf, "(status unknown)"); + + partstat_param = icalproperty_get_first_parameter( + attendee, + ICAL_PARTSTAT_PARAMETER + ); + if (partstat_param == NULL) { + return; + } + + partstat = icalparameter_get_partstat(partstat_param); + switch(partstat) { + case ICAL_PARTSTAT_X: + strcpy(buf, "(x)"); + case ICAL_PARTSTAT_NEEDSACTION: + strcpy(buf, "(needs action)"); + case ICAL_PARTSTAT_ACCEPTED: + strcpy(buf, "(accepted)"); + case ICAL_PARTSTAT_DECLINED: + strcpy(buf, "(declined)"); + case ICAL_PARTSTAT_TENTATIVE: + strcpy(buf, "(tenative)"); + case ICAL_PARTSTAT_DELEGATED: + strcpy(buf, "(delegated)"); + case ICAL_PARTSTAT_COMPLETED: + strcpy(buf, "(completed)"); + case ICAL_PARTSTAT_INPROCESS: + strcpy(buf, "(in process)"); + case ICAL_PARTSTAT_NONE: + strcpy(buf, "(none)"); + } +} + #endif diff --git a/webcit/event.c b/webcit/event.c index 4bc59bca6..45d1e2932 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -281,10 +281,17 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) 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); if (i++) wprintf(", "); escputs(attendee_string); + wprintf(" "); + + /* participant status */ + partstat_as_string(buf, attendee); + escputs(buf); } } wprintf("\n"); @@ -492,7 +499,12 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) { /* * Add any new attendees listed in the web form */ + + /* First, strip out the parenthesized partstats. */ strcpy(form_attendees, bstr("attendees")); + stripout(form_attendees, '(', ')'); + + /* Now iterate! */ for (i=0; i 0) && (rb > lb) ) { + strcpy(&str[lb - 1], &str[rb + 1]); + } + + } while ( (lb > 0) && (rb > lb) ); + +} + + diff --git a/webcit/webcit.h b/webcit/webcit.h index 1588fbfc0..16cfe39f6 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -235,6 +235,7 @@ void url(char *buf); void escputs1(char *strbuf, int nbsp); long extract_long(char *source, long int parmnum); int extract_int(char *source, int parmnum); +void stripout(char *str, char leftboundary, char rightboundary); void dump_vars(void); void embed_main_menu(void); void serv_read(char *buf, int bytes); @@ -356,6 +357,7 @@ void display_calendar(long msgnum); void display_task(long msgnum); void do_calendar_view(void); void free_calendar_buffer(void); +void calendar_summary_view(void); int load_msg_ptrs(char *servcmd); #ifdef HAVE_ICAL_H @@ -371,6 +373,7 @@ void generate_new_uid(char *); void respond_to_request(void); void handle_rsvp(void); void ical_dezonify(icalcomponent *cal); +void partstat_as_string(char *buf, icalproperty *attendee); #endif extern char *months[];