mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 16:24:14 +00:00
carddav: add max-resource-size to serve
This commit is contained in:
parent
238e72b73e
commit
6bac674701
@ -5,9 +5,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type AddressBook struct {
|
type AddressBook struct {
|
||||||
Href string
|
Href string
|
||||||
Name string
|
Name string
|
||||||
Description string
|
Description string
|
||||||
|
MaxResourceSize int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddressBookQuery struct {
|
type AddressBookQuery struct {
|
||||||
|
@ -18,6 +18,8 @@ var (
|
|||||||
addressBookSupportedAddressData = xml.Name{namespace, "addressbook-supported-address-data"}
|
addressBookSupportedAddressData = xml.Name{namespace, "addressbook-supported-address-data"}
|
||||||
|
|
||||||
addressDataName = xml.Name{namespace, "address-data"}
|
addressDataName = xml.Name{namespace, "address-data"}
|
||||||
|
|
||||||
|
maxResourceSizeName = xml.Name{namespace, "max-resource-size"}
|
||||||
)
|
)
|
||||||
|
|
||||||
type addressbookHomeSet struct {
|
type addressbookHomeSet struct {
|
||||||
@ -42,6 +44,12 @@ type addressDataType struct {
|
|||||||
Version string `xml:"version,attr"`
|
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
|
// https://tools.ietf.org/html/rfc6352#section-10.3
|
||||||
type addressbookQuery struct {
|
type addressbookQuery struct {
|
||||||
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-query"`
|
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-query"`
|
||||||
|
@ -219,7 +219,13 @@ func (b *backend) propfindAddressBook(propfind *internal.Propfind, ab *AddressBo
|
|||||||
},
|
},
|
||||||
}, nil
|
}, 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)
|
return internal.NewPropfindResponse("/", propfind, props)
|
||||||
|
Loading…
Reference in New Issue
Block a user