carddav: add addressbook-home-set to server

This commit is contained in:
Simon Ser 2020-01-19 15:10:54 +01:00
parent 6bac674701
commit c4718a3a49
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 7 additions and 2 deletions

View File

@ -10,8 +10,9 @@ import (
const namespace = "urn:ietf:params:xml:ns:carddav" const namespace = "urn:ietf:params:xml:ns:carddav"
var ( var (
addressBookHomeSetName = xml.Name{namespace, "addressbook-home-set"}
addressBookName = xml.Name{namespace, "addressbook"} addressBookName = xml.Name{namespace, "addressbook"}
addressBookHomeSetName = xml.Name{namespace, "addressbook-home-set"}
addressBookDescriptionName = xml.Name{namespace, "addressbook-description"} addressBookDescriptionName = xml.Name{namespace, "addressbook-description"}
addressBookQueryName = xml.Name{namespace, "addressbook-query"} addressBookQueryName = xml.Name{namespace, "addressbook-query"}
addressBookMultigetName = xml.Name{namespace, "addressbook-multiget"} addressBookMultigetName = xml.Name{namespace, "addressbook-multiget"}
@ -22,6 +23,7 @@ var (
maxResourceSizeName = xml.Name{namespace, "max-resource-size"} maxResourceSizeName = xml.Name{namespace, "max-resource-size"}
) )
// https://tools.ietf.org/html/rfc6352#section-6.2.3
type addressbookHomeSet struct { type addressbookHomeSet struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-home-set"` XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-home-set"`
Href string `xml:"href"` Href string `xml:"href"`

View File

@ -219,7 +219,10 @@ func (b *backend) propfindAddressBook(propfind *internal.Propfind, ab *AddressBo
}, },
}, nil }, nil
}, },
// TODO: addressbook-home-set // TODO: this is a principal property
addressBookHomeSetName: func(*internal.RawXMLValue) (interface{}, error) {
return &addressbookHomeSet{Href: "/"}, nil
},
} }
if ab.MaxResourceSize > 0 { if ab.MaxResourceSize > 0 {