/** Get TZID property value from iCal component. * * @param comp iCal component. * * @return TZID value (string) or NULL. */ const char *icalcomponent_get_tzid(icalcomponent *comp) { icalproperty *prop; if (comp) { prop = icalcomponent_get_first_property(comp, ICAL_TZID_PROPERTY); if (prop) { return icalproperty_get_tzid(prop); } } return NULL; }
/** Gets the TZID, LOCATION/X-LIC-LOCATION and TZNAME properties of the VTIMEZONE component and stores them in the icaltimezone. It returns 1 on success, or 0 if the TZID can't be found. Note that it expects the zone to be initialized or reset - it doesn't free any old values. */ static int icaltimezone_get_vtimezone_properties (icaltimezone *zone, icalcomponent *component) { icalproperty *prop; const char *tzid; prop = icalcomponent_get_first_property (component, ICAL_TZID_PROPERTY); if (!prop) return 0; /* A VTIMEZONE MUST have a TZID, or a lot of our code won't work. */ tzid = icalproperty_get_tzid (prop); if (!tzid) return 0; zone->tzid = strdup (tzid); zone->component = component; if ( zone->location != 0 ) free ( zone->location ); zone->location = icaltimezone_get_location_from_vtimezone (component); zone->tznames = icaltimezone_get_tznames_from_vtimezone (component); return 1; }