#
# Request a freebusy report by URL
#
TYPE=GET
URL=http://regression.host/freebusy.php/user1@example.net?start=20061001T000000&end=20070630T235959
HEAD


REPLACE=/^DTSTAMP:\d{8}T\d{6}Z\r?$/DTSTAMP:yyyymmddThhmmssZ/
REPLACE=/^DTSTART:20061001T000000Z\r?$/DTSTART:correct/
REPLACE=/^DTEND:20070630T235959Z\r?$/DTEND:correct/

QUERY
SELECT calendar_item.rrule, status,
       to_char(calendar_item.dtstart at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS start,
       to_char(calendar_item.dtend at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS finish
  FROM caldav_data INNER JOIN calendar_item USING(dav_id,user_no,dav_name)
 WHERE caldav_data.user_no = 10
   AND rrule_event_overlaps( dtstart, dtend, rrule, '20061001T000000', '20070630T235959')
   AND caldav_data.caldav_type IN ( 'VEVENT', 'VFREEBUSY' )
   AND (calendar_item.status != 'CANCELLED' OR calendar_item.status IS NULL)
   AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL)
 ORDER BY 2, 3
ENDQUERY
