Client.RemoveAll had no way to send conditional headers, so a client
could not delete a resource only if it still has a known ETag. Take a
*RemoveAllOptions, the same type FileSystem.RemoveAll uses on the server
side. A nil value keeps the previous unconditional behavior.
SyncCollection already requests calendar-data via the query's CompRequest, but
only the ETag and last-modified props were decoded, so a caller had to follow
every sync with a multiget even when the server (e.g. Radicale, SOGo) returned
the calendar object inline in the sync-collection response.
Decode the calendar-data prop into CalendarObject.Data when it is present; when
the server omits it, Data is left nil and the caller fetches it with a multiget
as before. Backward compatible.
Signed-off-by: Henry Stern <henry@stern.ca>
Assisted-by: Claude (Anthropic) <noreply@anthropic.com>
The server hard-coded DAV:read + DAV:write in current-user-privilege-set for
every collection (with a TODO). Add a ReadOnly field to Calendar and AddressBook
that the backend sets per request; report DAV:write only when it is false, so
clients (e.g. DAVx5, Apple) correctly mark read-only collections. Default
(false) keeps the previous read-write behavior.
This change adds FindCalendar function to the caldav client. It can be
used to get calendar information without loading all the events, once the
path of the calendar is known.
The previous code failed to properly handle PROPFIND with an empty request body
(RFC 4918 section 9.1) for XML content type requests.
Refactor the logic to always consider PROPFIND requests with empty request
bodies as "allprop" requests, regardless of content type.
There is no need to worry about the request's content type if the request body
is empty anyway, so only parse if we know it is not.
This change set implements the "context path" discovery for the
CalDav/CardDav endpoints.
This basically implements the bootstrapping process as defined in
RFC6764 section 6, point 2 and 3.
What's missing in this implementation is the fallback that is described
in point 3, subpoint 3, which says that if the context path discovered
in the TXT RR is not reachable the .well-known URI should be used
instead.
I propose to implement this in a future iteration.
NewPropFindResponse uses callbacks to lazily build the response.
However, some props are static: they don't require any processing
to generate. Add a small helper to reduce boilerplate a bit.
Both the displayname and the description can be absent for both
calendars and address books. If this is the case they should not show up
in PROPFIND responses as empty string.
It seems like e.g. Apples reminders likes to send `PropPatch`, and
currently this just fills up my logs because of the panic. I thought it
would be better to signal that this isn't supported yet, which should
hopefully make it easier to dig through the logs.
Now that the handling for multiple address books is in place, this
commit adds initial support for creation and deletion of address books.
These operations obviously require support from the backend, so the
interface gains two new methods. All properties of the address book
passed to `CreateAddressBook()` may be unset (e.g. when a client sends a
MKCOL request without a body), except for the path, which is always set.
It is up to the backend to put any desired default values in place.
This is the equivalent of #127 (and #140) for CardDAV and finally allows
backends to serve different address books to different users.
While I'm breaking the interface, correct one last instance of
"Addressbook" to "AddressBook" (in `AddressBookHomeSetPath`).