From 7e29f37bd810fcdbaa8e3079291ee92ad2bedf84 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 22 Jan 2020 18:59:01 +0100 Subject: [PATCH] carddav: add allprop and propname support to query and multiget in server --- carddav/elements.go | 16 +++++++++------- carddav/server.go | 10 ++++++---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/carddav/elements.go b/carddav/elements.go index 5f07a68..799da11 100644 --- a/carddav/elements.go +++ b/carddav/elements.go @@ -54,18 +54,20 @@ type maxResourceSize struct { // https://tools.ietf.org/html/rfc6352#section-10.3 type addressbookQuery struct { - XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-query"` - Prop *internal.Prop `xml:"DAV: prop,omitempty"` - // TODO: DAV:allprop | DAV:propname + XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-query"` + Prop *internal.Prop `xml:"DAV: prop,omitempty"` + AllProp *struct{} `xml:"DAV: allprop,omitempty"` + PropName *struct{} `xml:"DAV: propname,omitempty"` // TODO: filter, limit? } // https://tools.ietf.org/html/rfc6352#section-8.7 type addressbookMultiget struct { - XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-multiget"` - Hrefs []internal.Href `xml:"DAV: href"` - Prop *internal.Prop `xml:"DAV: prop,omitempty"` - // TODO: DAV:allprop | DAV:propname + XMLName xml.Name `xml:"urn:ietf:params:xml:ns:carddav addressbook-multiget"` + Hrefs []internal.Href `xml:"DAV: href"` + Prop *internal.Prop `xml:"DAV: prop,omitempty"` + AllProp *struct{} `xml:"DAV: allprop,omitempty"` + PropName *struct{} `xml:"DAV: propname,omitempty"` } func newProp(name string, noValue bool) *internal.RawXMLValue { diff --git a/carddav/server.go b/carddav/server.go index 2bce373..6a67283 100644 --- a/carddav/server.go +++ b/carddav/server.go @@ -86,8 +86,9 @@ func (h *Handler) handleQuery(w http.ResponseWriter, query *addressbookQuery) er for _, ao := range aos { b := backend{h.Backend} propfind := internal.Propfind{ - Prop: query.Prop, - // TODO: Allprop, Propnames + Prop: query.Prop, + AllProp: query.AllProp, + PropName: query.PropName, } resp, err := b.propfindAddressObject(&propfind, &ao) if err != nil { @@ -110,8 +111,9 @@ func (h *Handler) handleMultiget(w http.ResponseWriter, multiget *addressbookMul b := backend{h.Backend} propfind := internal.Propfind{ - Prop: multiget.Prop, - // TODO: Allprop, Propnames + Prop: multiget.Prop, + AllProp: multiget.AllProp, + PropName: multiget.PropName, } resp, err := b.propfindAddressObject(&propfind, ao) if err != nil {