Пример #1
0
static icalproperty *icalmessage_find_attendee(icalcomponent *comp, const char *user)
{
    icalcomponent *inner = icalmessage_get_inner(comp);
    icalproperty *p, *attendee = 0;
    char *luser = lowercase(user);

    for (p = icalcomponent_get_first_property(inner, ICAL_ATTENDEE_PROPERTY);
         p != 0;
         p = icalcomponent_get_next_property(inner, ICAL_ATTENDEE_PROPERTY)) {

        char *lattendee;

        lattendee = lowercase(icalproperty_get_attendee(p));

        if (strstr(lattendee, user) != 0) {
            free(lattendee);
            attendee = p;
            break;
        }

        free(lattendee);
    }

    free(luser);

    return attendee;
}
Пример #2
0
icalcomponent *icalmessage_new_delegate_request(icalcomponent *c,
                                                const char *user,
                                                const char *delegatee, const char *msg)
{
    icalcomponent *reply;
    icalproperty *attendee;
    icalcomponent *inner;
    icalparameter *delegateeParam;

    icalerror_check_arg_rz(c, "c");

    reply = icalmessage_new_reply_base(c, user, msg);
    inner = icalmessage_get_inner(reply);

    if (reply == 0) {
        return 0;
    }

    icalcomponent_set_method(reply, ICAL_METHOD_REQUEST);

    attendee = icalcomponent_get_first_property(inner, ICAL_ATTENDEE_PROPERTY);

    icalproperty_set_parameter(attendee, icalparameter_new_partstat(ICAL_PARTSTAT_DELEGATED));

    icalproperty_set_parameter(attendee, icalparameter_new_delegatedto(delegatee));

    delegateeParam = icalparameter_new_delegatedfrom(icalproperty_get_attendee(attendee));
    icalcomponent_add_property(
        inner,
        icalproperty_vanew_attendee(delegatee, delegateeParam, 0));
    icalparameter_free(delegateeParam);
    return reply;
}
Пример #3
0
const char *icalproperty_get_invitee(icalproperty *prop)
{
    const char *recip;

    if (icalproperty_isa(prop) == ICAL_VOTER_PROPERTY) {
        recip = icalproperty_get_voter(prop);
    }
    else {
        recip = icalproperty_get_attendee(prop);
    }

    return recip;
}
Пример #4
0
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 get_required_attendees(icalcomponent* event)
{
    icalproperty* p;
    icalparameter* parameter;

    assert(event != 0);
    assert(icalcomponent_isa(event) == ICAL_VEVENT_COMPONENT);

    /* This loop iterates over all of the ATTENDEE properties in the
       event */

    /* The iteration routines save their state in the event
       struct, so the are not thread safe unless you lock the whole
       component. */

    for(
        p = icalcomponent_get_first_property(event,ICAL_ATTENDEE_PROPERTY);
        p != 0;
        p = icalcomponent_get_next_property(event,ICAL_ATTENDEE_PROPERTY)
        ) {

        /* Get the first ROLE parameter in the property. There should
           only be one, so we won't bother to iterate over them. But,
           you can iterate over parameters just like with properties */

        parameter = icalproperty_get_first_parameter(p,ICAL_ROLE_PARAMETER);

        /* If the parameter indicates the participant is required, get
           the attendees name and stick a copy of it into the output
           array */

        if ( icalparameter_get_role(parameter) == ICAL_ROLE_REQPARTICIPANT)
        {
            /* Remember, the caller does not own this string, so you
               should strdup it if you want to change it. */
            const char *attendee = icalproperty_get_attendee(p);
            printf("%s",attendee);
        }
    }

}
Пример #6
0
static icalproperty *
get_attendee_prop (icalcomponent *icalcomp,
                   const gchar *address)
{
	icalproperty *prop;

	if (!(address && *address))
		return NULL;

	for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
	     prop;
	     prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
		const gchar *attendee = icalproperty_get_attendee (prop);

		if (g_str_equal (itip_strip_mailto (attendee), address)) {
			return prop;
		}
	}

	return NULL;
}