From 6249f128dbbb2cbf1686b6e1d6813c198cd99be0 Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 2 Aug 2023 11:01:58 +0200 Subject: [PATCH] fix error, if there is no old vacation specifying a number of days, setting now same default as UI: 3 days also some docu fixes --- doc/REST-CalDAV-CardDAV/Mail.md | 2 +- doc/REST-CalDAV-CardDAV/README.md | 7 +++++-- mail/src/ApiHandler.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/REST-CalDAV-CardDAV/Mail.md b/doc/REST-CalDAV-CardDAV/Mail.md index 15130a26ec..36a4f2a01e 100644 --- a/doc/REST-CalDAV-CardDAV/Mail.md +++ b/doc/REST-CalDAV-CardDAV/Mail.md @@ -154,7 +154,7 @@ The content of the POST request is a JSON encoded object with following attribut ``` curl -i https://example.org/egroupware/groupdav.php/mail/vacation --user -X POST -H 'Content-Type: application/json' \ - --data-binary '{"message":"I'm away from $$start$$ to $$end$$, will respond when I'm back.","start":"2023-01-01","end":"2023-01-10"}' + --data-binary '{"text":"I'm away from $$start$$ to $$end$$, will respond when I'm back.","start":"2023-01-01","end":"2023-01-10"}' HTTP/1.1 200 Ok diff --git a/doc/REST-CalDAV-CardDAV/README.md b/doc/REST-CalDAV-CardDAV/README.md index cc6824d718..0f773bf559 100644 --- a/doc/REST-CalDAV-CardDAV/README.md +++ b/doc/REST-CalDAV-CardDAV/README.md @@ -31,7 +31,7 @@ One can use the following URLs relative (!) to https://example.org/egroupware/gr - ```/infolog/``` infologs of current user - ```/(resources|locations)//calendar``` calendar of a resource/location, if user has rights to view - ```//(resource|location)-``` shared calendar from a resource/location -- ```/mail/``` only REST API, currently only send EMail or launch interactive compose windows +- ```/mail/``` REST API only Shared addressbooks or calendars are only shown in the users home-set, if he subscribed to it via his CalDAV preferences! @@ -41,7 +41,10 @@ from the data of an ```allprop``` PROPFIND, allow browsing CalDAV/CardDAV tree w ## REST API: using EGroupware CalDAV/CardDAV server with JSON - [Addressbook](Addressbook.md) - [Calendar](Calendar.md) (currently recurring events are readonly, they are returned but can not be created or modified) -- [Mail](Mail.md) (currently only sending mails or opening interactive compose windows) +- [Mail](Mail.md) (currently only sending mails, opening interactive compose windows and vacation handling) + +> For the REST API you always have to send an "Accept: application/json" header and for POST & PUT requests additionally +> a "Content-Type: application/json" header, otherwise you talk to the CalDAV/CardDAV server and don't get the response you expect! Following RFCs / drafts used/planned for JSON encoding of resources * [draft-ietf-jmap-jscontact: JSContact: A JSON Representation of Contact Data](https://datatracker.ietf.org/doc/html/draft-ietf-jmap-jscontact) diff --git a/mail/src/ApiHandler.php b/mail/src/ApiHandler.php index 7150424a4e..92ef1f81e6 100644 --- a/mail/src/ApiHandler.php +++ b/mail/src/ApiHandler.php @@ -190,7 +190,7 @@ class ApiHandler extends Api\CalDAV\Handler } $vacation_rule = null; $sieve = new Api\Mail\Sieve($account->imapServer()); - $sieve->setVacation(array_merge($vacation, $update), null, $vacation_rule, true); + $sieve->setVacation(array_merge(['days' => 3], $vacation, $update), null, $vacation_rule, true); echo json_encode([ 'status' => 200, 'message' => 'Vacation handling updated',