Example #1
0
static icalproperty *
find_attendee (icalcomponent *ical_comp, const char *address)
{
	icalproperty *prop;

	if (address == NULL)
		return NULL;

	for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
	     prop != NULL;
	     prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY)) {
		icalvalue *value;
		const char *attendee;
		char *text;

		value = icalproperty_get_value (prop);
		if (!value)
			continue;

		attendee = icalvalue_get_string (value);

		text = g_strdup (itip_strip_mailto (attendee));
		text = g_strstrip (text);
		if (!g_ascii_strcasecmp (address, text)) {
			g_free (text);
			break;
		}
		g_free (text);
	}

	return prop;
}
nsresult calIcalComponent::GetStringProperty(icalproperty_kind kind, nsACString &str)
{
    icalproperty *prop = icalcomponent_get_first_property(mComponent, kind);
    if (!prop) {
        str.Truncate();
        str.SetIsVoid(true);
    } else {
        str.Assign(icalvalue_get_string(icalproperty_get_value(prop)));
    }
    return NS_OK;
}
calIcalComponent::GetLibicalTimezone()
{
    NS_ASSERTION(icalcomponent_isa(mComponent) == ICAL_VTIMEZONE_COMPONENT, "no VTIMEZONE -- unexpected!");
    if (!mTimezone && (icalcomponent_isa(mComponent) == ICAL_VTIMEZONE_COMPONENT)) {
        // xxx todo: libical needs a parent VCALENDAR to retrieve a icaltimezone
        NS_ASSERTION(mParent, "VTIMEZONE has no parent!");
        if (mParent) {
            icalproperty * const tzidProp = icalcomponent_get_first_property(mComponent, ICAL_TZID_PROPERTY);
            NS_ASSERTION(tzidProp, "no TZID property in VTIMEZONE!?");
            if (tzidProp) {
                mTimezone = icalcomponent_get_timezone(mParent->GetLibicalComponent(),
                                                       icalvalue_get_string(icalproperty_get_value(tzidProp)));
            }
        }
    }
    return mTimezone;
}