Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

carddav: PROPPATCH support for address books#147

Open
bitfehler wants to merge 1 commit intoemersion:masterfrom
bitfehler:bitfehler/carddav-proppatch
Open

carddav: PROPPATCH support for address books#147
bitfehler wants to merge 1 commit intoemersion:masterfrom
bitfehler:bitfehler/carddav-proppatch

Conversation

Copy link
Collaborator

bitfehler commented Feb 8, 2024

The groundwork for address objects is also there, but it's not fully implemented.

I'll be honest: none of the usual suspects (DavX5, TB/CardBook, Evolution) actually use this, but that just makes me mad. They all rename address books client side only (or not at all). However, since PROPPATCH is a standard WebDAV operation, I successfully renamed my address books on the server using cadaver. I still think this is worth implementing, because if any sane client ever comes along, they might really want to use this.

Regarding the support for address objects, it might be worth taking a closer look at the worthwhileness before going through with it. I suspect that again no major client actually uses it, and for address objects it's also slightly less useful (because e.g. the "displayname" property is likely not used, because a contact is displayed by its name, etc.).

Copy link
Owner

emersion commented Feb 9, 2024

Does it help clients to advertise PROPPATCH here?

func (b *backend) Options(r *http.Request) (caps []string, allow []string, err error) {

Copy link
Collaborator Author

bitfehler commented Feb 9, 2024

Does it help clients to advertise PROPPATCH here?

Good call, but no. I tried, and it doesn't change anything. For DavX5, there isn't even an option to change it, which seems to be a known issue, and e.g. CardBook never does an OPTIONS request anyways. Evolution does do one, but still doesn't bother -\_(tsu)_/-

emersion reviewed Feb 12, 2024
emersion reviewed Feb 12, 2024
Comment on lines 652 to 660
for _, prop := range update.Remove {
emptyVal := internal.NewRawXMLElement(prop.Prop.XMLName, nil, nil)
if err := resp.EncodeProp(http.StatusNotImplemented, emptyVal); err != nil {
return nil, err
for _, raw := range prop.Prop.Raw {
rxn, ok := raw.XMLName()
if !ok {
return nil, fmt.Errorf("failed to parse properties")
}
emptyVal := internal.NewRawXMLElement(rxn, nil, nil)
if err := resp.EncodeProp(http.StatusMethodNotAllowed, emptyVal); err != nil {
return nil, err
}
}
}
for _, prop := range update.Set {
emptyVal := internal.NewRawXMLElement(prop.Prop.XMLName, nil, nil)
if err := resp.EncodeProp(http.StatusNotImplemented, emptyVal); err != nil {
return nil, err
for _, raw := range prop.Prop.Raw {
rxn, ok := raw.XMLName()
if !ok {
return nil, fmt.Errorf("failed to parse properties")
}
emptyVal := internal.NewRawXMLElement(rxn, nil, nil)
if err := resp.EncodeProp(http.StatusMethodNotAllowed, emptyVal); err != nil {
return nil, err
}
}
}
Copy link
Owner

emersion Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to write out a multi-status here? Can't we just reply with a toplevel HTTP status instead? Something like internal.HTTPErrorf?

emersion reviewed Feb 12, 2024
}
default:
emptyVal := internal.NewRawXMLElement(rxn, nil, nil)
if err := resp.EncodeProp(http.StatusNotImplemented, emptyVal); err != nil {
Copy link
Owner

emersion Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a 404 be more appropriate for the properties we don't know about?

Copy link
Owner

emersion commented Feb 12, 2024

Good call, but no. I tried, and it doesn't change anything.

OK, too bad.

Can we still advertise PROPPATCH for address books?

bitfehler force-pushed the bitfehler/carddav-proppatch branch from 4de6415 to 20d0ee3 Compare March 15, 2024 15:08
Copy link
Collaborator Author

bitfehler commented Mar 15, 2024

Changed the interface so that the backend can implement UpdateAddressbook atomically, also simplified some things a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

emersion emersion left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants