#---------
# POST to scheduling outbox for freebusy query on user2
#
TYPE=POST
URL=http://regression.host/caldav.php/user1/.out/
HEADER=User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.18pre) Gecko/20080917 Sunbird/0.9
HEADER=Accept: text/xml
HEADER=Accept-Language: en-us,en;q=0.5
HEADER=Accept-Charset: utf-8,*;q=0.1
HEADER=Content-Type: text/calendar; charset=utf-8
HEADER=Originator: mailto:user1@example.net
HEADER=Recipient: mailto:user3@example.net

HEAD

REPLACE=/^DTSTAMP:\d{4}[01]\d[0123]\dT[012]\d[0-5]\d[0-6]\dZ\r?$/DTSTAMP:yyyymmddThhmmssZ/
REPLACE=/^ETag: "[0-9a-f]+".?$/ETag: "some valid etag"/

BEGINDATA
BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VFREEBUSY
DTSTAMP:20081022T062945Z
ORGANIZER:mailto:user1@example.net
DTSTART:20081020T110000Z
DTEND:20081105T110000Z
UID:c5bd82ea-cd89-4f58-8d31-336f47e44f97
ATTENDEE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;CUTYPE=INDIVIDUAL:
 mailto:user3@example.net
END:VFREEBUSY
END:VCALENDAR
ENDDATA

QUERY
SELECT calendar_item.rrule AS "c)  RRule", calendar_item.status,
   to_char(calendar_item.dtstart at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS "a)  Start",
   to_char(calendar_item.dtend at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS "b) Finish",
   calendar_item.dtstart at time zone olson_name AS "d)  Start",
   timezones.olson_name,
   class
 FROM caldav_data INNER JOIN calendar_item USING(dav_id,user_no,dav_name,collection_id)
         INNER JOIN collection USING(collection_id)
         LEFT JOIN timezones ON (tz_id=tzid)
 WHERE caldav_data.dav_name ~ '^/user3/'
   AND rrule_event_overlaps( dtstart, dtend, rrule, '20081020T110000Z', '20081105T110000Z')
   AND caldav_data.caldav_type IN ( 'VEVENT', 'VTODO' )
   AND (calendar_item.transp != 'TRANSPARENT' OR calendar_item.transp IS NULL)
   AND (calendar_item.status != 'CANCELLED' OR calendar_item.status IS NULL)
   AND collection.is_calendar
   AND collection.schedule_transp = 'opaque'
ENDQUERY
