carddav: add max-resource-size to serve

This commit is contained in:
Simon Ser 2020-01-19 15:06:09 +01:00
parent 238e72b73e
commit 6bac674701
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
3 changed files with 19 additions and 4 deletions

View File

@ -8,6 +8,7 @@ type AddressBook struct {
Href string
Name string
Description string
MaxResourceSize int64
}
type AddressBookQuery struct {

View File

@ -18,6 +18,8 @@ var (
addressBookSupportedAddressData = xml.Name{namespace, "addressbook-supported-address-data"}
addressDataName = xml.Name{namespace, "address-data"}
maxResourceSizeName = xml.Name{namespace, "max-resource-size"}
)
type addressbookHomeSet struct {
@ -42,6 +44,12 @@ type addressDataType struct {
Version string `xml:"version,attr"`
}
// https://tools.ietf.org/html/rfc6352#section-6.2.3
type maxResourceSize struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav max-resource-size"`
Size int64 `xml:",chardata"`
}
// https://tools.ietf.org/html/rfc6352#section-10.3
type addressbookQuery struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-query"`

View File

@ -219,7 +219,13 @@ func (b *backend) propfindAddressBook(propfind *internal.Propfind, ab *AddressBo
},
}, nil
},
// TODO: addressbook-max-resource-size, addressbook-home-set
// TODO: addressbook-home-set
}
if ab.MaxResourceSize > 0 {
props[maxResourceSizeName] = func(*internal.RawXMLValue) (interface{}, error) {
return &maxResourceSize{Size: ab.MaxResourceSize}, nil
}
}
return internal.NewPropfindResponse("/", propfind, props)