carddav: add AddressObject.Remove

This commit is contained in:
emersion 2017-09-14 11:51:57 +02:00
parent 579a25f989
commit f8d9f83cbc
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 12 additions and 1 deletions

View File

@ -24,6 +24,7 @@ type AddressObject interface {
Stat() (os.FileInfo, error) // can return nil, nil Stat() (os.FileInfo, error) // can return nil, nil
Card() (vcard.Card, error) Card() (vcard.Card, error)
SetCard(vcard.Card) error SetCard(vcard.Card) error
Remove() error
} }
type AddressBook interface { type AddressBook interface {

View File

@ -370,7 +370,17 @@ func (fs *fileSystem) OpenFile(ctx context.Context, name string, flag int, perm
} }
func (fs *fileSystem) RemoveAll(ctx context.Context, name string) error { func (fs *fileSystem) RemoveAll(ctx context.Context, name string) error {
return errNotYetImplemented if name == "/" {
return errUnsupported
}
id := fs.addressObjectID(name)
ao, err := fs.ab.GetAddressObject(id)
if err != nil {
return err
}
return ao.Remove()
} }
func (fs *fileSystem) Rename(ctx context.Context, oldName, newName string) error { func (fs *fileSystem) Rename(ctx context.Context, oldName, newName string) error {