/** * e2k_freebusy_add_from_calendar_uri: * @fb: an #E2kFreebusy * @uri: the URI of a calendar folder * @start_tt: start of the range to add * @end_tt: end of the range to add * * This queries the server for events between @start_tt and @end_tt in * the calendar at @uri (which the caller must have permission to * read) and adds them @fb. Any previously-existing events during that * range are removed. * * Return value: an HTTP status code. **/ E2kHTTPStatus e2k_freebusy_add_from_calendar_uri (E2kFreebusy *fb, const char *uri, time_t start_tt, time_t end_tt) { char *start, *end, *busystatus; E2kBusyStatus busy; E2kRestriction *rn; E2kResultIter *iter; E2kResult *result; e2k_freebusy_clear_interval (fb, start_tt, end_tt); start = e2k_make_timestamp (start_tt); end = e2k_make_timestamp (end_tt); rn = e2k_restriction_andv ( e2k_restriction_prop_string (E2K_PR_DAV_CONTENT_CLASS, E2K_RELOP_EQ, "urn:content-classes:appointment"), e2k_restriction_prop_date (E2K_PR_CALENDAR_DTEND, E2K_RELOP_GT, start), e2k_restriction_prop_date (E2K_PR_CALENDAR_DTSTART, E2K_RELOP_LT, end), e2k_restriction_prop_string (E2K_PR_CALENDAR_BUSY_STATUS, E2K_RELOP_NE, "FREE"), NULL); iter = e2k_context_search_start (fb->ctx, NULL, uri, freebusy_props, n_freebusy_props, rn, NULL, TRUE); e2k_restriction_unref (rn); g_free (start); g_free (end); while ((result = e2k_result_iter_next (iter))) { start = e2k_properties_get_prop (result->props, E2K_PR_CALENDAR_DTSTART); end = e2k_properties_get_prop (result->props, E2K_PR_CALENDAR_DTEND); busystatus = e2k_properties_get_prop (result->props, E2K_PR_CALENDAR_BUSY_STATUS); if (!start || !end || !busystatus) continue; if (!strcmp (busystatus, "TENTATIVE")) busy = E2K_BUSYSTATUS_TENTATIVE; else if (!strcmp (busystatus, "OUTOFOFFICE")) busy = E2K_BUSYSTATUS_OOF; else busy = E2K_BUSYSTATUS_BUSY; e2k_freebusy_add_interval (fb, busy, e2k_parse_timestamp (start), e2k_parse_timestamp (end)); } return e2k_result_iter_free (iter); }
/** * e2k_timestamp_to_icaltime: * @timestamp: an Exchange timestamp string * * Converts @timestamp to an #icaltimetype * * Return value: the #icaltimetype **/ struct icaltimetype e2k_timestamp_to_icaltime (const gchar *timestamp) { return icaltime_from_timet_with_zone ( e2k_parse_timestamp (timestamp), FALSE, icaltimezone_get_utc_timezone ()); }