$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.
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
wprintf("<TR><TD><B>Attendee:</B></TD><TD>");
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("</TD></TR>\n");
}
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
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("</TEXTAREA></TD></TR>\n");
/*
* 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<num_tokens(form_attendees, ','); ++i) {
extract_token(buf, form_attendees, i, ',');
striplt(buf);
}
}
}
+
+
+
+/*
+ * Strip a boundarized substring out of a string (for example, remove
+ * parentheses and anything inside them).
+ *
+ * This improved version can strip out *multiple* boundarized substrings.
+ */
+void stripout(char *str, char leftboundary, char rightboundary) {
+ int a;
+ int lb = (-1);
+ int rb = (-1);
+
+ do {
+ lb = (-1);
+ rb = (-1);
+
+ for (a = 0; a < strlen(str); ++a) {
+ if (str[a] == leftboundary) lb = a;
+ if (str[a] == rightboundary) rb = a;
+ }
+
+ if ( (lb > 0) && (rb > lb) ) {
+ strcpy(&str[lb - 1], &str[rb + 1]);
+ }
+
+ } while ( (lb > 0) && (rb > lb) );
+
+}
+
+
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);
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
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[];