Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Z-Push
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
mail
Z-Push
Merge requests
!7
CalDAV: Implement MeetingResponse
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
CalDAV: Implement MeetingResponse
cern_vb_2_cern
into
cern
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
CalDAV: Implement MeetingResponse
Vincent Brillault
requested to merge
cern_vb_2_cern
into
cern
Jan 7, 2021
Overview
0
Commits
1
Pipelines
0
Changes
1
0
0
Merge request reports
Compare
cern
cern (base)
and
latest version
latest version
976986ba
1 commit,
Jan 7, 2021
1 file
+
40
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/backend/caldav/caldav.php
+
40
−
0
View file @ 976986ba
Edit in single-file editor
Open in Web IDE
Show full file
@@ -263,6 +263,46 @@ class BackendCalDAV extends BackendDiff {
return
false
;
}
/**
* Processes a response to a meeting request.
* CalendarID is a reference and has to be set if a new calendar item is created
* @see BackendDiff::MeetingResponse()
*/
public
function
MeetingResponse
(
$requestid
,
$folderid
,
$response
)
{
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"BackendCalDAV->MeetingResponse('%s','%s','%s')"
,
$requestid
,
$folderid
,
$response
));
if
(
$folderid
[
0
]
!=
"C"
)
throw
new
StatusException
(
"BackendCalDAV->MeetingResponse(): Folder is not a calendar!"
,
SYNC_ITEMOPERATIONSSTATUS_INVALIDATT
);
$message
=
$this
->
GetMessageByID
(
$folderid
,
$requestid
);
if
(
$message
==
null
)
throw
new
StatusException
(
"BackendCalDAV->MeetingResponse(): Error, event not found"
,
SYNC_ITEMOPERATIONSSTATUS_INVALIDATT
);
$userDetails
=
ZPush
::
GetBackend
()
->
GetCurrentUsername
();
$vcal
=
Sabre\VObject\Reader
::
read
(
$message
[
'data'
],
Sabre\VObject\Reader
::
OPTION_FORGIVING
);
foreach
(
$vcal
->
VEVENT
as
$vevent
)
{
foreach
(
$vevent
->
children
()
as
$property
)
{
if
(
$property
->
name
!=
"ATTENDEE"
)
continue
;
$att_email
=
str_ireplace
(
"MAILTO:"
,
""
,
(
string
)
$property
);
if
(
$att_email
==
$userDetails
[
'emailaddress'
])
{
switch
(
$response
)
{
case
1
:
// Accepted
$property
[
'PARTSTAT'
]
=
"ACCEPTED"
;
break
;
case
2
:
// Tentatively accepted
$property
[
'PARTSTAT'
]
=
"TENTATIVE"
;
break
;
case
3
:
// Declined
$property
[
'PARTSTAT'
]
=
"DECLINED"
;
break
;
}
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"BackendCalDAV->MeetingResponse(): Updated participation to %s"
,
$property
[
'PARTSTAT'
]));
}
}
}
$url
=
$this
->
_caldav_path
.
substr
(
$folderid
,
1
)
.
"/"
.
$requestid
;
$this
->
CreateUpdateCalendar
(
$vcal
->
serialize
(),
$url
,
$message
[
'etag'
]);
return
$requestid
;
}
/**
* Get a list of all the folders we are going to sync.
* Each caldav calendar can contain tasks (prefix T) and events (prefix C), so duplicate each calendar found.
Loading