+typedef struct CalAttendee
+{
+ StrBuf *AttendeeStr;
+ icalparameter_partstat partstat;
+} CalAttendee;
+
+void DeleteAtt(void *vAtt)
+{
+ CalAttendee *att = (CalAttendee*) vAtt;
+ FreeStrBuf(&att->AttendeeStr);
+ free(vAtt);
+}
+
+HashList *iterate_get_ical_attendees(StrBuf *Target, WCTemplputParams *TP)
+{
+ icalcomponent *cal = (icalcomponent *) CTX(CTX_ICAL);
+ icalparameter *partstat_param;
+ icalproperty *p;
+ CalAttendee *Att;
+ HashList *Attendees = NULL;
+ const char *ch;
+ int n = 0;
+
+ /* If the component has attendees, iterate through them. */
+ for (p = icalcomponent_get_first_property(cal, ICAL_ATTENDEE_PROPERTY);
+ (p != NULL);
+ p = icalcomponent_get_next_property(cal, ICAL_ATTENDEE_PROPERTY)) {
+ ch = icalproperty_get_attendee(p);
+ if ((ch != NULL) && !strncasecmp(ch, "MAILTO:", 7)) {
+ Att = (CalAttendee*) malloc(sizeof(CalAttendee));
+
+ /** screen name or email address */
+ Att->AttendeeStr = NewStrBufPlain(ch + 7, -1);
+ StrBufTrim(Att->AttendeeStr);
+
+ /** participant status */
+ partstat_param = icalproperty_get_first_parameter(
+ p,
+ ICAL_PARTSTAT_PARAMETER
+ );
+ if (partstat_param == NULL) {
+ Att->partstat = ICAL_PARTSTAT_X;
+ }
+ else {
+ Att->partstat = icalparameter_get_partstat(partstat_param);
+ }
+ if (Attendees == NULL)
+ Attendees = NewHash(1, Flathash);
+ Put(Attendees, IKEY(n), Att, DeleteAtt);
+ n++;
+ }
+ }
+ return Attendees;
+}
+
+void tmplput_ICalAttendee(StrBuf *Target, WCTemplputParams *TP)
+{
+ CalAttendee *Att = (CalAttendee*) CTX(CTX_ICALATTENDEE);
+ StrBufAppendTemplate(Target, TP, Att->AttendeeStr, 0);
+}
+int cond_ICalAttendeeState(StrBuf *Target, WCTemplputParams *TP)
+{
+ CalAttendee *Att = (CalAttendee*) CTX(CTX_ICALATTENDEE);
+ icalparameter_partstat which_partstat;
+
+ which_partstat = GetTemplateTokenNumber(Target, TP, 2, ICAL_PARTSTAT_X);
+ return Att->partstat == which_partstat;
+}
+ /* If the component has subcomponents, recurse through them. * /
+ for (c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
+ (c != 0);
+ c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)) {
+ // Recursively process subcomponent
+ cal_process_object(Target, c, recursion_level+1, msgnum, cal_partnum);
+ }
+ */