all: use variables for xml.Name values
This commit is contained in:
@@ -6,15 +6,11 @@ import (
|
||||
"github.com/emersion/go-vcard"
|
||||
)
|
||||
|
||||
const namespace = "urn:ietf:params:xml:ns:carddav"
|
||||
|
||||
type AddressBook struct {
|
||||
Href string
|
||||
Description string
|
||||
}
|
||||
|
||||
var addressBookName = xml.Name{namespace, "addressbook"}
|
||||
|
||||
type AddressBookQuery struct {
|
||||
Props []string
|
||||
}
|
||||
|
@@ -6,6 +6,10 @@ import (
|
||||
"github.com/emersion/go-webdav/internal"
|
||||
)
|
||||
|
||||
const namespace = "urn:ietf:params:xml:ns:carddav"
|
||||
|
||||
var addressBookName = xml.Name{namespace, "addressbook"}
|
||||
|
||||
type addressbookHomeSet struct {
|
||||
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-home-set"`
|
||||
Href string `xml:"href"`
|
||||
|
@@ -111,7 +111,7 @@ func (b *backend) Propfind(r *http.Request, propfind *internal.Propfind, depth i
|
||||
|
||||
func (b *backend) propfindAddressBook(propfind *internal.Propfind) (*internal.Response, error) {
|
||||
props := map[xml.Name]internal.PropfindFunc{
|
||||
{"DAV:", "resourcetype"}: func(*internal.RawXMLValue) (interface{}, error) {
|
||||
internal.ResourceTypeName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||
return internal.NewResourceType(internal.CollectionName, addressBookName), nil
|
||||
},
|
||||
}
|
||||
@@ -121,10 +121,7 @@ func (b *backend) propfindAddressBook(propfind *internal.Propfind) (*internal.Re
|
||||
|
||||
func (b *backend) propfindAddressObject(propfind *internal.Propfind, ao *AddressObject) (*internal.Response, error) {
|
||||
props := map[xml.Name]internal.PropfindFunc{
|
||||
{"DAV:", "resourcetype"}: func(*internal.RawXMLValue) (interface{}, error) {
|
||||
return internal.NewResourceType(), nil
|
||||
},
|
||||
{"DAV:", "getcontenttype"}: func(*internal.RawXMLValue) (interface{}, error) {
|
||||
internal.GetContentTypeName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||
return &internal.GetContentType{Type: vcard.MIMEType}, nil
|
||||
},
|
||||
// TODO getlastmodified, getetag
|
||||
|
Reference in New Issue
Block a user