mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 16:24:14 +00:00
carddav: add address-data to server responses
This commit is contained in:
parent
4a2a520522
commit
797b2f8fc5
@ -15,6 +15,8 @@ var (
|
|||||||
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"}
|
||||||
|
|
||||||
|
addressDataName = xml.Name{namespace, "address-data"}
|
||||||
)
|
)
|
||||||
|
|
||||||
type addressbookHomeSet struct {
|
type addressbookHomeSet struct {
|
||||||
@ -74,7 +76,7 @@ type addressDataResp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type reportReq struct {
|
type reportReq struct {
|
||||||
Query *addressbookQuery
|
Query *addressbookQuery
|
||||||
Multiget *addressbookMultiget
|
Multiget *addressbookMultiget
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,8 +209,15 @@ func (b *backend) propfindAddressObject(propfind *internal.Propfind, ao *Address
|
|||||||
internal.GetContentTypeName: func(*internal.RawXMLValue) (interface{}, error) {
|
internal.GetContentTypeName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
return &internal.GetContentType{Type: vcard.MIMEType}, nil
|
return &internal.GetContentType{Type: vcard.MIMEType}, nil
|
||||||
},
|
},
|
||||||
|
addressBookDataName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
if err := vcard.NewEncoder(&buf).Encode(ao.Card); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &addressDataResp{Data: buf.Bytes()}, nil
|
||||||
|
},
|
||||||
// TODO: getlastmodified, getetag
|
// TODO: getlastmodified, getetag
|
||||||
// TODO: address-data
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return internal.NewPropfindResponse(ao.Href, propfind, props)
|
return internal.NewPropfindResponse(ao.Href, propfind, props)
|
||||||
|
Loading…
Reference in New Issue
Block a user