diff --git a/plugins/carddav/carddav.go b/plugins/carddav/carddav.go index 0c1a06d..2509872 100644 --- a/plugins/carddav/carddav.go +++ b/plugins/carddav/carddav.go @@ -28,3 +28,19 @@ func newClient(u *url.URL, session *koushin.Session) (*carddav.Client, error) { } return carddav.NewClient(&http.Client{Transport: &rt}, u.String()) } + +type AddressObject struct { + *carddav.AddressObject +} + +func newAddressObjectList(aos []carddav.AddressObject) []AddressObject { + l := make([]AddressObject, len(aos)) + for i := range aos { + l[i] = AddressObject{&aos[i]} + } + return l +} + +func (ao AddressObject) URL() string { + return "/contacts/" + url.PathEscape(ao.Path) +} diff --git a/plugins/carddav/plugin.go b/plugins/carddav/plugin.go index 5afdde2..3002da1 100644 --- a/plugins/carddav/plugin.go +++ b/plugins/carddav/plugin.go @@ -37,6 +37,10 @@ type plugin struct { homeSetCache map[string]string } +func (p *plugin) client(session *koushin.Session) (*carddav.Client, error) { + return newClient(p.url, session) +} + func (p *plugin) clientWithAddressBook(session *koushin.Session) (*carddav.Client, *carddav.AddressBook, error) { c, err := newClient(p.url, session) if err != nil { diff --git a/plugins/carddav/public/address-book.html b/plugins/carddav/public/address-book.html index 3c31017..d4e13b9 100644 --- a/plugins/carddav/public/address-book.html +++ b/plugins/carddav/public/address-book.html @@ -17,7 +17,7 @@