mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 16:24:14 +00:00
carddav: add addressbook-supprted-address-data to server
This commit is contained in:
parent
edfc2804b5
commit
238e72b73e
@ -15,6 +15,7 @@ var (
|
||||
addressBookDescriptionName = xml.Name{namespace, "addressbook-description"}
|
||||
addressBookQueryName = xml.Name{namespace, "addressbook-query"}
|
||||
addressBookMultigetName = xml.Name{namespace, "addressbook-multiget"}
|
||||
addressBookSupportedAddressData = xml.Name{namespace, "addressbook-supported-address-data"}
|
||||
|
||||
addressDataName = xml.Name{namespace, "address-data"}
|
||||
)
|
||||
@ -29,6 +30,18 @@ type addressbookDescription struct {
|
||||
Description string `xml:",chardata"`
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc6352#section-6.2.2
|
||||
type addressbookSupportedAddressData struct {
|
||||
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-supported-address-data"`
|
||||
Types []addressDataType `xml:"address-data-type"`
|
||||
}
|
||||
|
||||
type addressDataType struct {
|
||||
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav address-data-type"`
|
||||
ContentType string `xml:"content-type,attr"`
|
||||
Version string `xml:"version,attr"`
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc6352#section-10.3
|
||||
type addressbookQuery struct {
|
||||
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-query"`
|
||||
|
@ -211,7 +211,15 @@ func (b *backend) propfindAddressBook(propfind *internal.Propfind, ab *AddressBo
|
||||
addressBookDescriptionName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||
return &addressbookDescription{Description: ab.Description}, nil
|
||||
},
|
||||
// TODO: addressbook-supported-address-data, addressbook-max-resource-size, addressbook-home-set
|
||||
addressBookSupportedAddressData: func(*internal.RawXMLValue) (interface{}, error) {
|
||||
return &addressbookSupportedAddressData{
|
||||
Types: []addressDataType{
|
||||
{ContentType: vcard.MIMEType, Version: "3.0"},
|
||||
{ContentType: vcard.MIMEType, Version: "4.0"},
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
// TODO: addressbook-max-resource-size, addressbook-home-set
|
||||
}
|
||||
|
||||
return internal.NewPropfindResponse("/", propfind, props)
|
||||
|
Loading…
Reference in New Issue
Block a user